Back

[SOLVED] Document level `Permissions and Roles` using any server SDK, specifically NODE here?

  • 0
  • Databases
  • Functions
  • Web
Sandeep K. Dasari
11 Jun, 2023, 03:57
TL;DR
The user made some mistakes with their code while trying to implement document level permissions and roles using a server SDK in Node.js. They were able to find the solution with the help of Steven. They also asked for code examples for handling images and image previews, as well as how to change the type to module. Finally, they asked if permissions can be created while creating a document using the server SDK, and if they imported the classes correctly. The solution provided was to check the documentation for the correct syntax and use static methods for the permission types. There was no solution given for changing the type to module or creating permissions while creating a document.
Sandeep K. Dasari
11 Jun, 2023, 04:00

Is this the wrong way of importing?

Sandeep K. Dasari
11 Jun, 2023, 04:01

Can we create permissions while creating document using serverSDK? Please Help :)

Sandeep K. Dasari
11 Jun, 2023, 04:05
Drake
11 Jun, 2023, 04:21

That's not the right way to use those classes. They are static methods and called like Permission.read() as mentioned in the docs: https://appwrite.io/docs/permissions#permission-types

Sandeep K. Dasari
11 Jun, 2023, 04:22

Could you suggest me some good workaround.

Sandeep K. Dasari
11 Jun, 2023, 04:23

SO, they are individual?

Sandeep K. Dasari
11 Jun, 2023, 04:23

how to import them in node--sdk?

Drake
11 Jun, 2023, 04:23

They are imported just like Client. Type sdk. and look at the autocomplete

Sandeep K. Dasari
11 Jun, 2023, 04:25

alright.

Sandeep K. Dasari
11 Jun, 2023, 04:29

This is the way, right?

Sandeep K. Dasari
11 Jun, 2023, 04:36

Right, It's lower case right!

Drake
11 Jun, 2023, 04:36

The role parts are incorrect

Sandeep K. Dasari
11 Jun, 2023, 04:36

Yeah I have rectified.

Sandeep K. Dasari
11 Jun, 2023, 04:36

By the way, Why I couldn't change type: module

Sandeep K. Dasari
11 Jun, 2023, 04:36

my function code!

Sandeep K. Dasari
11 Jun, 2023, 04:38

Thanks, It worked. Now I will handle uploading Files and Images... Could you please suggest me good example code for handling images and image previews?

Sandeep K. Dasari
11 Jun, 2023, 04:41

My intension is to show all the sellers to the customer who come to my e-commerce site, but what this undefined?

Sandeep K. Dasari
11 Jun, 2023, 04:41

I have written the code like this to produce above payload.

Drake
11 Jun, 2023, 04:42

Read the docs again

Sandeep K. Dasari
11 Jun, 2023, 04:42

Do I need to mention user(all)

Sandeep K. Dasari
11 Jun, 2023, 04:43

verified and unverified are the params for user right!

Drake
11 Jun, 2023, 04:44

No, read it carefully

Sandeep K. Dasari
11 Jun, 2023, 04:52

yeah! That's Role.users() , Due to drowsiness, I am committing these silly mistakes. πŸ™‚ Sorry Steven Sir. Thanks for this amazing support. I will be indebted for you for helping me through out this hackathon journey. πŸ™‚

Sandeep K. Dasari
11 Jun, 2023, 04:53

[SOLVED] Document level Permissions and Roles using any server SDK, specifically NODE here?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more