Class: CanTango::PermissionEngine::Selector::Licenses

Inherits:
Base
  • Object
show all
Defined in:
lib/cantango/permission_engine/selector/licenses.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#subject

Instance Method Summary collapse

Methods inherited from Base

#select

Constructor Details

#initialize(subject) ⇒ Licenses

Returns a new instance of Licenses.



7
8
9
10
# File 'lib/cantango/permission_engine/selector/licenses.rb', line 7

def initialize subject
  @roles  = subject.roles_list
  @role_groups = subject.role_groups_list
end

Instance Attribute Details

#role_groupsObject (readonly)

Returns the value of attribute role_groups.



5
6
7
# File 'lib/cantango/permission_engine/selector/licenses.rb', line 5

def role_groups
  @role_groups
end

#rolesObject (readonly)

Returns the value of attribute roles.



5
6
7
# File 'lib/cantango/permission_engine/selector/licenses.rb', line 5

def roles
  @roles
end

Instance Method Details

#relevant?(permission) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/cantango/permission_engine/selector/licenses.rb', line 12

def relevant? permission
  (roles | role_groups).include? permission.to_sym
end