module NonGrata::Tenant

Public Instance Methods

authorization_roles() click to toggle source
# File lib/non_grata/tenant.rb, line 23
def authorization_roles
    NonGrata:AuthorizationRole.where(tenant_id: self.id, tenant_type: self.class.name)
end
authorization_scheme() click to toggle source
# File lib/non_grata/tenant.rb, line 27
def authorization_scheme 
    :main
end
create_role(attributes) click to toggle source
# File lib/non_grata/tenant.rb, line 4
def create_role(attributes) 
    attributes[:tenant_id] ||= self.id
    attributes[:tenant_type] ||= self.class.name
    attributes[:scheme_name] ||= self.authorization_scheme
    role = NonGrata::AuthorizationRole.create(attributes)
end
destroy_role(name) click to toggle source
# File lib/non_grata/tenant.rb, line 15
def destroy_role(name)
    role = NonGrata::AuthorizationRole.find_by(
        name: name, 
        scheme_name: authorization_scheme.to_s, 
        tenant_id: self.id, tenant_type: self.class.name)
    role.destroy if role
end
roles() click to toggle source
# File lib/non_grata/tenant.rb, line 11
def roles
    NonGrata::AuthorizationRole.where(tenant_id: self.id, tenant_type: self.class.name)
end