Class: ZimbraInterceptingProxy::User
- Inherits:
-
Object
- Object
- ZimbraInterceptingProxy::User
- Defined in:
- lib/zimbra_intercepting_proxy/user.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#zimbraId ⇒ Object
Returns the value of attribute zimbraId.
Class Method Summary collapse
Instance Method Summary collapse
- #backend ⇒ Object
- #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].
-
#migrated? ⇒ Boolean
If user has email (unless email.nil?).
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]
8 9 10 11 12 |
# File 'lib/zimbra_intercepting_proxy/user.rb', line 8 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_intercepting_proxy/user.rb', line 4 def email @email end |
#zimbraId ⇒ Object
Returns the value of attribute zimbraId.
4 5 6 |
# File 'lib/zimbra_intercepting_proxy/user.rb', line 4 def zimbraId @zimbraId end |
Class Method Details
.DB ⇒ Object
41 42 43 |
# File 'lib/zimbra_intercepting_proxy/user.rb', line 41 def self.DB load_migrated_users end |
.load_migrated_users ⇒ Object
37 38 39 |
# File 'lib/zimbra_intercepting_proxy/user.rb', line 37 def self.load_migrated_users YAML.load_file ZimbraInterceptingProxy::Config.migrated_users_file end |
Instance Method Details
#backend ⇒ Object
19 20 21 22 |
# File 'lib/zimbra_intercepting_proxy/user.rb', line 19 def backend return ZimbraInterceptingProxy::Config.new_backend if migrated? ZimbraInterceptingProxy::Config.old_backend end |
#find_in_db ⇒ Object
24 25 26 27 |
# File 'lib/zimbra_intercepting_proxy/user.rb', line 24 def find_in_db return User.DB[email] if has_email? return User.DB.invert[zimbraId] if has_zimbraId? end |
#has_email? ⇒ Boolean
29 30 31 |
# File 'lib/zimbra_intercepting_proxy/user.rb', line 29 def has_email? !email.nil? end |
#has_zimbraId? ⇒ Boolean
33 34 35 |
# File 'lib/zimbra_intercepting_proxy/user.rb', line 33 def has_zimbraId? !zimbraId.nil? end |
#migrated? ⇒ Boolean
If user has email (unless email.nil?)
15 16 17 |
# File 'lib/zimbra_intercepting_proxy/user.rb', line 15 def migrated? !find_in_db.nil? end |