Class: ResourceIn::Authorization
- Inherits:
-
Object
- Object
- ResourceIn::Authorization
- Defined in:
- lib/resource_in/authorization.rb
Constant Summary collapse
- MSG_PERMISSION_ERROR =
'Permission denied for this operation'
- CMD_WBINFO =
'/usr/bin/wbinfo'
Class Method Summary collapse
-
._get_gid(name) ⇒ Object
XXX: Now using ‘wbinfo’ command to get group information from krb5 cache.
- .is_admin? ⇒ Boolean
- .is_user? ⇒ Boolean
- .is_viewer? ⇒ Boolean
Class Method Details
._get_gid(name) ⇒ Object
XXX: Now using ‘wbinfo’ command to get group information from krb5 cache.
It's preferred to get it directly from winbind without 'wbinfo' command.
20 21 22 |
# File 'lib/resource_in/authorization.rb', line 20 def _get_gid(name) `#{CMD_WBINFO} --group-info='#{name}'`.split(':')[2].to_i end |
.is_admin? ⇒ Boolean
14 15 16 |
# File 'lib/resource_in/authorization.rb', line 14 def is_admin? Process.groups.any? {|x| x == self._get_gid('resourcein admin')} end |
.is_user? ⇒ Boolean
11 12 13 |
# File 'lib/resource_in/authorization.rb', line 11 def is_user? self.is_admin? or Process.groups.any? {|x| x == self._get_gid('resourcein user')} end |
.is_viewer? ⇒ Boolean
8 9 10 |
# File 'lib/resource_in/authorization.rb', line 8 def is_viewer? self.is_user? or Process.groups.any? {|x| x == self._get_gid('resourcein viewer')} end |