View Source Appwrite.Utils.Role (appwrite v0.1.9)
A helper module for generating role strings for Permission
.
Summary
Functions
Grants access to anyone, including authenticated and unauthenticated users.
Grants access to any guest user without a session. Authenticated users do not have access to this role.
Grants access to a user with the specified label.
Grants access to a specific member of a team. When the member is removed from the team, they will no longer have access.
Grants access to a team by team ID. Optionally, specify role
to target
team members with the specified role.
Grants access to a specific user by user ID. Optionally, specify status
as "verified"
or "unverified"
to target specific types of users.
Grants access to any authenticated or anonymous user. Optionally, specify
status
as "verified"
or "unverified"
.
Functions
@spec any() :: String.t()
Grants access to anyone, including authenticated and unauthenticated users.
Examples
iex> Role.any()
"any"
@spec guests() :: String.t()
Grants access to any guest user without a session. Authenticated users do not have access to this role.
Examples
iex> Role.guests()
"guests"
Grants access to a user with the specified label.
Parameters
- name: A string representing the label name.
Examples
iex> Role.label("manager")
"label:manager"
Grants access to a specific member of a team. When the member is removed from the team, they will no longer have access.
Parameters
- id: A string representing the member ID.
Examples
iex> Role.member("member123")
"member:member123"
Grants access to a team by team ID. Optionally, specify role
to target
team members with the specified role.
Parameters
- id: A string representing the team ID.
- role: (Optional) A string representing the role within the team.
Examples
iex> Role.team("team123")
"team:team123"
iex> Role.team("team123", "admin")
"team:team123/admin"
Grants access to a specific user by user ID. Optionally, specify status
as "verified"
or "unverified"
to target specific types of users.
Parameters
- id: A string representing the user ID.
- status: (Optional) A string representing user verification status.
Examples
iex> Role.user("12345")
"user:12345"
iex> Role.user("12345", "verified")
"user:12345/verified"
Grants access to any authenticated or anonymous user. Optionally, specify
status
as "verified"
or "unverified"
.
Parameters
- status: (Optional) A string representing user verification status.
Examples
iex> Role.users()
"users"
iex> Role.users("verified")
"users/verified"