Class: Webhookdb::Role

Inherits:
Object
  • Object
show all
Defined in:
lib/webhookdb/role.rb

Class Method Summary collapse

Class Method Details

.admin_roleObject

n.b. Because of the uniqueness constraint on “name”, there is only one “admin” role. Its meaning depends on the context: if the customer has this role, they are an admin; if the org membership has this role, the customer is an org admin.



9
10
11
12
13
# File 'lib/webhookdb/role.rb', line 9

def self.admin_role
  return Webhookdb.cached_get("role_admin") do
    self.find_or_create_or_find(name: "admin")
  end
end

.non_admin_roleObject



15
16
17
18
19
# File 'lib/webhookdb/role.rb', line 15

def self.non_admin_role
  return Webhookdb.cached_get("role_member") do
    self.find_or_create_or_find(name: "member")
  end
end