Module: Faalis::Concerns::User::UserRoles

Included in:
User
Defined in:
app/models/faalis/concerns/user/user_roles.rb

Instance Method Summary collapse

Instance Method Details

#admin?Boolean

A shortcut for ‘role? :admin`

Returns:

  • (Boolean)


18
19
20
# File 'app/models/faalis/concerns/user/user_roles.rb', line 18

def admin?
  role? :admin
end

#role?(role) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/models/faalis/concerns/user/user_roles.rb', line 13

def role? role
  roles.include? role.to_s
end

#rolesObject

Return an array of user roles.



9
10
11
# File 'app/models/faalis/concerns/user/user_roles.rb', line 9

def roles
  self.groups.to_a.map(&:role)
end