Module: Reactor::Cm::Permissions
- Included in:
- Group, User::Internal
- Defined in:
- lib/reactor/cm/permissions.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#global_permission?(name) ⇒ Boolean
Returns true, if a global permission with the given
nameexists, false otherwise. -
#grant_global_permissions!(permissions) ⇒ Object
Add the given
permissionsto the current set of group permissions. -
#revoke_global_permissions!(permissions) ⇒ Object
Take away the given
permissionsfrom the current set of group permissions. -
#set_global_permissions!(permissions) ⇒ Object
Set the group permissions to the given
permissions.
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 |
# File 'lib/reactor/cm/permissions.rb', line 4 def self.included(base) base.instance_eval do attribute :global_permissions, :name => :globalPermissions, :type => :list end end |
Instance Method Details
#global_permission?(name) ⇒ Boolean
Returns true, if a global permission with the given name exists, false otherwise.
11 12 13 |
# File 'lib/reactor/cm/permissions.rb', line 11 def (name) self..include?(name.to_s) end |
#grant_global_permissions!(permissions) ⇒ Object
Add the given permissions to the current set of group permissions.
16 17 18 19 20 21 |
# File 'lib/reactor/cm/permissions.rb', line 16 def () = .kind_of?(Array) ? : [] = self. | () end |
#revoke_global_permissions!(permissions) ⇒ Object
Take away the given permissions from the current set of group permissions.
24 25 26 27 28 29 |
# File 'lib/reactor/cm/permissions.rb', line 24 def () = .kind_of?(Array) ? : [] = self. - () end |
#set_global_permissions!(permissions) ⇒ Object
Set the group permissions to the given permissions.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/reactor/cm/permissions.rb', line 32 def () request = XmlRequest.prepare do |xml| xml.where_key_tag!(base_name, self.class.primary_key, self.name) xml.set_key_tag!(base_name, self.class.xml_attribute(:global_permissions).name, ) end request.execute! self. = end |