Class: AMT::Service::SecurityAdministration::User

Inherits:
Object
  • Object
show all
Defined in:
lib/amt/service/security_administration/structures.rb

Overview

Class containing information about a user. Either a plain text password or an already hashed password must be provided. If a plain text password is provided, the hashed password is automatically calculated.

Constant Summary collapse

ALLOWED_USERNAME_CHARS =

Contains the characters that are allowed in the username.

(33..126).to_a - ":,<>&\"".unpack('c*')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, password = nil) ⇒ User

Create a new User object with the given username and, optionally, password.



63
64
65
66
# File 'lib/amt/service/security_administration/structures.rb', line 63

def initialize(username, password = nil)
  self.username = username
  self.password = password
end

Instance Attribute Details

#hashed_passwordObject

The hashed password for the user. This or #password must be set.



59
60
61
# File 'lib/amt/service/security_administration/structures.rb', line 59

def hashed_password
  @hashed_password
end

#passwordObject

The password for the user. This or #hashed_password must be set.



56
57
58
# File 'lib/amt/service/security_administration/structures.rb', line 56

def password
  @password
end

#usernameObject

The username to be used. May only contain 7-bit ASCII characters, in the range of 33- 126, excluding ‘:’, ‘,’, ‘<’, ‘>’, ‘&’, and ‘”’ characters. Length is limited to 16 characters.



53
54
55
# File 'lib/amt/service/security_administration/structures.rb', line 53

def username
  @username
end