Class: Appwrite::Role
- Inherits:
-
Object
- Object
- Appwrite::Role
- Defined in:
- lib/appwrite/role.rb
Overview
Helper class to generate role strings for Permission.
Class Method Summary collapse
-
.any ⇒ String
Grants access to anyone.
-
.guests ⇒ String
Grants access to any guest user without a session.
-
.label(name) ⇒ String
Grants access to a user with the specified label.
-
.member(id) ⇒ String
Grants access to a specific member of a team.
-
.team(id, role = "") ⇒ String
Grants access to a team by team ID.
-
.user(id, status = "") ⇒ String
Grants access to a specific user by user ID.
-
.users(status = "") ⇒ String
Grants access to any authenticated or anonymous user.
Class Method Details
.any ⇒ String
Grants access to anyone.
This includes authenticated and unauthenticated users.
11 12 13 |
# File 'lib/appwrite/role.rb', line 11 def self.any 'any' end |
.guests ⇒ String
Grants access to any guest user without a session.
Authenticated users don’t have access to this role.
53 54 55 |
# File 'lib/appwrite/role.rb', line 53 def self.guests 'guests' end |
.label(name) ⇒ String
Grants access to a user with the specified label.
91 92 93 |
# File 'lib/appwrite/role.rb', line 91 def self.label(name) "label:#{name}" end |
.member(id) ⇒ String
Grants access to a specific member of a team.
When the member is removed from the team, they will no longer have access.
82 83 84 |
# File 'lib/appwrite/role.rb', line 82 def self.member(id) "member:#{id}" end |
.team(id, role = "") ⇒ String
Grants access to a team by team ID.
You can optionally pass a role for role to target team members with the specified role.
66 67 68 69 70 71 72 |
# File 'lib/appwrite/role.rb', line 66 def self.team(id, role = "") if(role.empty?) "team:#{id}" else "team:#{id}/#{role}" end end |
.user(id, status = "") ⇒ String
Grants access to a specific user by user ID.
You can optionally pass verified or unverified for status to target specific types of users.
24 25 26 27 28 29 30 |
# File 'lib/appwrite/role.rb', line 24 def self.user(id, status = "") if(status.empty?) "user:#{id}" else "user:#{id}/#{status}" end end |
.users(status = "") ⇒ String
Grants access to any authenticated or anonymous user.
You can optionally pass verified or unverified for status to target specific types of users.
40 41 42 43 44 45 46 |
# File 'lib/appwrite/role.rb', line 40 def self.users(status = "") if(status.empty?) 'users' else "users/#{status}" end end |