Class: CaTissue::User
- Inherits:
-
Object
- Object
- CaTissue::User
- Includes:
- Person, Jinx::Unique
- Defined in:
- lib/catissue/domain/user.rb,
lib/catissue/migration/unique.rb
Overview
The User domain class.
Instance Method Summary collapse
-
#role_id ⇒ Object
This bug is probably a result of caTissue “fixing” Bug #66.
-
#role_id=(value) ⇒ Object
Sets the role id to the given value, which can be either a String or an Integer.
-
#uniquify ⇒ Object
Makes this User’s login id and email address unique.
Methods included from Person
Instance Method Details
#role_id ⇒ Object
This bug is probably a result of caTissue “fixing” Bug #66.
The work-around to the caTissue bug fix bug is to return nil unless the role id has been set
by a call to the {#role_id=} setter method.
23 24 25 |
# File 'lib/catissue/domain/user.rb', line 23 def role_id @role_id end |
#role_id=(value) ⇒ Object
Sets the role id to the given value, which can be either a String or an Integer. An empty or zero value is converted to nil.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/catissue/domain/user.rb', line 32 def role_id=(value) # value as an integer (nil is zero) value_i = value.to_i # set the Bug #66 work-around i.v. @role_id = value_i.zero? ? nil : value_i # value as a String (if non-nil) value_s = @role_id.to_s if @role_id # call Java with a String setRoleId(value_s) end |
#uniquify ⇒ Object
Makes this User’s login id and email address unique. The result is in the form name___suffix@test.com where:
-
name is the name prefix portion of the original email address
-
suffix is a unique number
71 72 73 74 |
# File 'lib/catissue/migration/unique.rb', line 71 def uniquify email = email_address ||= self.login_name || return self.login_name = self.email_address = uniquify_value(email[/[^@]+/]) + '@test.com' end |