class AdobeConnect::User
Public: Represents a user in a Connect environment.
Attributes
email[RW]
first_name[RW]
last_name[RW]
send_email[RW]
username[W]
uuid[RW]
Public Class Methods
find(user_options)
click to toggle source
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.
# File lib/adobe_connect/user.rb, line 63 def self.find(user_options) user = AdobeConnect::User.new(user_options) 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
new(*)
click to toggle source
Calls superclass method
AdobeConnect::Base::new
# File lib/adobe_connect/user.rb, line 8 def initialize(*) super # Silence a warning about uninitialized instance variable. @username = nil end
Public Instance Methods
attrs()
click to toggle source
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.
# 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()
click to toggle source
Public: Generate a password for this connect user.
Returns a password string.
# File lib/adobe_connect/user.rb, line 53 def password Digest::MD5.hexdigest(uuid)[0..9] end
username()
click to toggle source
Public: Getter for the Connect user's username. If no username is
given, use the email.
Returns a username string.
# File lib/adobe_connect/user.rb, line 46 def username @username || email end