Class: Reactor::Cm::User::Internal
- Inherits:
-
ObjectBase
- Object
- ObjectBase
- Reactor::Cm::User::Internal
- Includes:
- Permissions
- Defined in:
- lib/reactor/cm/user.rb
Class Method Summary collapse
-
.create(login, default_group) ⇒ Object
Creates a user with given login and sets its default group Returns instance of the class for user with given login.
Instance Method Summary collapse
- #change_password(new_password) ⇒ Object
- #has_password?(password) ⇒ Boolean
- #name ⇒ Object
-
#super_user? ⇒ Boolean
Returns true if user is root, false otherwise.
Methods included from Permissions
#global_permission?, #grant_global_permissions!, included, #revoke_global_permissions!, #set_global_permissions!
Methods inherited from ObjectBase
#base_name, base_name, #delete, #delete!, delete!, exists?, get, inherited, #initialize, #reload, #save, #save!, serialize_attribute_to_xml, #serialize_attribute_to_xml, set_base_name
Constructor Details
This class inherits a constructor from Reactor::Cm::ObjectBase
Class Method Details
.create(login, default_group) ⇒ Object
Creates a user with given login and sets its default group Returns instance of the class for user with given login
61 62 63 |
# File 'lib/reactor/cm/user.rb', line 61 def self.create(login, default_group) super(login, {:login => login, :defaultGroup => default_group}) end |
Instance Method Details
#change_password(new_password) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/reactor/cm/user.rb', line 33 def change_password(new_password) request = XmlRequest.prepare do |xml| xml.where_key_tag!(base_name, primary_key, primary_key_value) xml.set_tag!(base_name) do xml.tag!('password', :verifyNewPassword => new_password) do xml.text!(new_password) end end end response = request.execute! response.ok? end |
#has_password?(password) ⇒ Boolean
48 49 50 |
# File 'lib/reactor/cm/user.rb', line 48 def has_password?(password) ::Reactor::Cm::User.new(self.login).has_password?(password) end |
#name ⇒ Object
29 30 31 |
# File 'lib/reactor/cm/user.rb', line 29 def name self.login end |
#super_user? ⇒ Boolean
Returns true if user is root, false otherwise
55 56 57 |
# File 'lib/reactor/cm/user.rb', line 55 def super_user? super_user == '1' end |