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
57 58 59 |
# File 'lib/reactor/cm/user.rb', line 57 def self.create(login, default_group) super(login, { login: login, defaultGroup: default_group }) end |
Instance Method Details
#change_password(new_password) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/reactor/cm/user.rb', line 29 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
44 45 46 |
# File 'lib/reactor/cm/user.rb', line 44 def has_password?(password) ::Reactor::Cm::User.new(login).has_password?(password) end |
#name ⇒ Object
25 26 27 |
# File 'lib/reactor/cm/user.rb', line 25 def name login end |
#super_user? ⇒ Boolean
Returns true if user is root, false otherwise
51 52 53 |
# File 'lib/reactor/cm/user.rb', line 51 def super_user? super_user == "1" end |