Module: Concerns::User::UserRoles

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

Overview

This concern contains all the role related methods to use within Faalis::User

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) admin?

A shortcut for role? :admin

Returns:

  • (Boolean)


16
17
18
# File 'app/models/faalis/concerns/user/user_roles.rb', line 16

def admin?
  role? :admin
end

- (Boolean) role?(role)

Returns:

  • (Boolean)


11
12
13
# File 'app/models/faalis/concerns/user/user_roles.rb', line 11

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

- (Object) roles

Return an array of user roles.



7
8
9
# File 'app/models/faalis/concerns/user/user_roles.rb', line 7

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