Class: AdobeConnect::User
Overview
Public: Represents a user in a Connect environment.
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#send_email ⇒ Object
Returns the value of attribute send_email.
-
#username ⇒ Object
Public: Getter for the Connect user’s username.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Attributes inherited from Base
Class Method Summary collapse
-
.find(user_options) ⇒ Object
Public: Find the given app user on the Connect server.
Instance Method Summary collapse
-
#attrs ⇒ Object
user_options - A hash with the following keys: first_name - User’s first name.
-
#initialize ⇒ User
constructor
A new instance of User.
-
#password ⇒ Object
Public: Generate a password for this connect user.
Methods inherited from Base
#ac_obj_node_name, #ac_obj_type, config, create, #delete, #delete_method_prefix, #method_prefix, #permissions_update, #save, #save_errors, #set_attrs, #update_attributes
Constructor Details
#initialize ⇒ User
Returns a new instance of User.
8 9 10 11 12 |
# File 'lib/adobe_connect/user.rb', line 8 def initialize(*) super # Silence a warning about uninitialized instance variable. @username = nil end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
5 6 7 |
# File 'lib/adobe_connect/user.rb', line 5 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
5 6 7 |
# File 'lib/adobe_connect/user.rb', line 5 def first_name @first_name end |
#last_name ⇒ Object
Returns the value of attribute last_name.
5 6 7 |
# File 'lib/adobe_connect/user.rb', line 5 def last_name @last_name end |
#send_email ⇒ Object
Returns the value of attribute send_email.
5 6 7 |
# File 'lib/adobe_connect/user.rb', line 5 def send_email @send_email end |
#username ⇒ Object
Public: Getter for the Connect user’s username. If no username is
given, use the email.
Returns a username string.
46 47 48 |
# File 'lib/adobe_connect/user.rb', line 46 def username @username || email end |
#uuid ⇒ Object
Returns the value of attribute uuid.
5 6 7 |
# File 'lib/adobe_connect/user.rb', line 5 def uuid @uuid end |
Class Method Details
.find(user_options) ⇒ Object
Public: Find the given app user on the Connect server.
app_user - Generic user options (see #initialize for required
attributes).
Returns an AdobeConnect::User or nil.
63 64 65 66 67 68 69 70 71 |
# File 'lib/adobe_connect/user.rb', line 63 def self.find() user = AdobeConnect::User.new() response = user.service.principal_list(:filter_login => user.username) if principal = response.at_xpath('//principal') user.instance_variable_set(:@id, principal.attr('principal-id')) user end end |
Instance Method Details
#attrs ⇒ Object
user_options - A hash with the following keys:
first_name - User's first name.
last_name - User's last name.
email - The email address for the user.
username - The login for the connect user.
uuid - A unique identifier for this user (used to
generate a password).
send_email - The server sends a welcome e-mail with login information
to the user’s e-mail address.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/adobe_connect/user.rb', line 26 def attrs atrs = { :first_name => first_name, :last_name => last_name, :login => username, :email => email, :has_children => 0 } atrs[:send_email] = send_email unless send_email.nil? if !self.id.nil? atrs.merge!(:principal_id => self.id) else atrs.merge!( :password => password, :type => 'user' ) end atrs end |
#password ⇒ Object
Public: Generate a password for this connect user.
Returns a password string.
53 54 55 |
# File 'lib/adobe_connect/user.rb', line 53 def password Digest::MD5.hexdigest(uuid)[0..9] end |