View Source Appwrite.Utils.Role (appwrite v0.2.1)
Helpers for generating Appwrite role strings to use with Appwrite.Utils.Permission.
Usage
alias Appwrite.Utils.Role
alias Appwrite.Utils.Permission
Permission.read(Role.any()) # public read
Permission.write(Role.user("abc123")) # owner write
Permission.read(Role.team("team1", "admin"))
Permission.create(Role.users("verified"))
Summary
Functions
Grants access to anyone — authenticated and unauthenticated users alike.
Grants access to unauthenticated (guest) users only.
Grants access to any user who has been assigned a specific label name.
Grants access to a specific team member by their membership id.
Grants access to all members of a team identified by id.
Grants access to a specific user by id.
Grants access to any authenticated user.
Functions
@spec any() :: String.t()
Grants access to anyone — authenticated and unauthenticated users alike.
Examples
iex> Appwrite.Utils.Role.any()
"any"
@spec guests() :: String.t()
Grants access to unauthenticated (guest) users only.
Authenticated users do not match this role.
Examples
iex> Appwrite.Utils.Role.guests()
"guests"
Grants access to any user who has been assigned a specific label name.
Examples
iex> Appwrite.Utils.Role.label("manager")
"label:manager"
Grants access to a specific team member by their membership id.
Access is revoked automatically when the member is removed from the team.
Examples
iex> Appwrite.Utils.Role.member("member123")
"member:member123"
Grants access to all members of a team identified by id.
Optionally restrict to members who hold a specific role within that team.
Examples
iex> Appwrite.Utils.Role.team("team123")
"team:team123"
iex> Appwrite.Utils.Role.team("team123", "admin")
"team:team123/admin"
Grants access to a specific user by id.
Optionally pass status as "verified" or "unverified" to target only
users with that email-verification state.
Examples
iex> Appwrite.Utils.Role.user("12345")
"user:12345"
iex> Appwrite.Utils.Role.user("12345", "verified")
"user:12345/verified"
Grants access to any authenticated user.
Optionally restrict to "verified" or "unverified" users.
Examples
iex> Appwrite.Utils.Role.users()
"users"
iex> Appwrite.Utils.Role.users("verified")
"users/verified"