Back

When creating document what Permission.create() means here? Its so confusing

  • 0
  • Databases
  • Web
Misho
11 Jul, 2024, 17:24
TypeScript
async function createUserDB(
  id: UserId,
  values: CreateUserParams
): Promise<User> {
  const { databases } = await createAdminClient();
  const document = await databases.createDocument<User>(
    envi.NEXT_PUBLIC_DATABASE_ID,
    envi.NEXT_PUBLIC_USERS_COLLECTION_ID,
    id,
    values,
    [
      Permission.read(Role.any()),
      Permission.update(Role.user(id)),
      Permission.delete(Role.user(id)),
    ]
  );

  return document;
}

i added read, update and delete permissions, can u explain what create Permission means here?

TL;DR
The developer is confused about the `Permission.create()` function in their code. They are unsure of its purpose in relation to reading, updating, and deleting permissions. The `Permission.create()` function is not a valid permission type. The solution for the developer is to remove `Permission.create()` and only utilize `Permission.read()`, `Permission.update()`, and `Permission.delete()` for the specific permissions needed in the code.
Arif Qayoom
11 Jul, 2024, 17:36

yep In first here anyone can read your database of Your project on the other hand last two permissions are users can update & delete

Misho
11 Jul, 2024, 17:59

what about create Permission.create()

Misho
11 Jul, 2024, 17:59

if i add here [Permission.create(Role.user(id)),

Misho
11 Jul, 2024, 18:00

what will be goal of that?

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