Class: ZimbraWall::User
- Inherits:
-
Object
- Object
- ZimbraWall::User
- Defined in:
- lib/zimbra_wall/user.rb
Constant Summary collapse
- @@db =
{}
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#zimbraId ⇒ Object
Returns the value of attribute zimbraId.
Class Method Summary collapse
- .DB ⇒ Object
-
.load_migrated_users ⇒ Object
Return the old DB if the YAML file has error.
Instance Method Summary collapse
- #backend ⇒ Object
-
#blocked? ⇒ Boolean
If user has email (unless email.nil?).
- #find_in_db ⇒ Object
- #has_email? ⇒ Boolean
- #has_zimbraId? ⇒ Boolean
-
#initialize(user_identifier) ⇒ User
constructor
user_identifier can be an email address, zimbraId UUID or just the local part of an email address, like user in [email protected].
Constructor Details
#initialize(user_identifier) ⇒ User
user_identifier can be an email address, zimbraId UUID or just the local part of an email address, like user in [email protected]
10 11 12 13 14 |
# File 'lib/zimbra_wall/user.rb', line 10 def initialize(user_identifier) @zimbraId = set_zimbraId user_identifier @email = set_email user_identifier User.load_migrated_users end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
4 5 6 |
# File 'lib/zimbra_wall/user.rb', line 4 def email @email end |
#zimbraId ⇒ Object
Returns the value of attribute zimbraId.
4 5 6 |
# File 'lib/zimbra_wall/user.rb', line 4 def zimbraId @zimbraId end |
Class Method Details
.DB ⇒ Object
46 47 48 49 |
# File 'lib/zimbra_wall/user.rb', line 46 def self.DB load_migrated_users @@db end |
.load_migrated_users ⇒ Object
Return the old DB if the YAML file has error
40 41 42 43 44 |
# File 'lib/zimbra_wall/user.rb', line 40 def self.load_migrated_users data = ZimbraWall::Yamler.db return @@db unless data @@db = data end |
Instance Method Details
#backend ⇒ Object
21 22 23 |
# File 'lib/zimbra_wall/user.rb', line 21 def backend ZimbraWall::Config.backend end |
#blocked? ⇒ Boolean
If user has email (unless email.nil?)
17 18 19 |
# File 'lib/zimbra_wall/user.rb', line 17 def blocked? !find_in_db.nil? end |
#find_in_db ⇒ Object
25 26 27 28 29 |
# File 'lib/zimbra_wall/user.rb', line 25 def find_in_db self.zimbraId = User.DB[email] if has_email? self.email = User.DB.invert[zimbraId] if has_zimbraId? User.DB[email] || User.DB.invert[zimbraId] end |
#has_email? ⇒ Boolean
31 32 33 |
# File 'lib/zimbra_wall/user.rb', line 31 def has_email? !email.nil? end |
#has_zimbraId? ⇒ Boolean
35 36 37 |
# File 'lib/zimbra_wall/user.rb', line 35 def has_zimbraId? !zimbraId.nil? end |