Class UserRole
In: app/models/user_role.rb
Parent: ActiveRecord::Base

Methods

Constants

USER_ROLE_ADMIN = 'admin'
USER_ROLE_USER = 'user'
USER_ROLE_ROOT = 'root'

Public Class methods

[Source]

    # File app/models/user_role.rb, line 10
10:   def self.get_admin
11:     return UserRole.find_by_role(USER_ROLE_ADMIN)
12:   end

[Source]

    # File app/models/user_role.rb, line 14
14:   def self.get_root
15:     return UserRole.find_by_role(USER_ROLE_ROOT)
16:   end

[Source]

    # File app/models/user_role.rb, line 18
18:   def self.get_user
19:     return UserRole.find_by_role(USER_ROLE_USER)
20:   end

Public Instance methods

[Source]

    # File app/models/user_role.rb, line 22
22:   def to_label
23:     role.capitalize
24:   end

Protected Instance methods

[Source]

    # File app/models/user_role.rb, line 40
40:   def authorized_for_create?
41:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_ROOT)
42:   end

[Source]

    # File app/models/user_role.rb, line 44
44:   def authorized_for_destroy?
45:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_ROOT)
46:   end

[Source]

    # File app/models/user_role.rb, line 32
32:   def authorized_for_read?
33:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_USER)
34:   end

[Source]

    # File app/models/user_role.rb, line 36
36:   def authorized_for_update?
37:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_ROOT)
38:   end

[Source]

    # File app/models/user_role.rb, line 28
28:   def role_authorized?
29:     Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_ROOT)
30:   end

[Validate]