Class: SakaiInfo::UserProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/sakai-info/user.rb

Class Method Summary collapse

Class Method Details

.find_by_user_id(user_id) ⇒ Object



300
301
302
303
304
305
306
307
# File 'lib/sakai-info/user.rb', line 300

def self.find_by_user_id(user_id)
  properties = {}
  DB.connect[:sakai_user_property].
    where(:user_id => user_id).all.each do |row|
    properties[row[:name]] = row[:value].read
  end
  return properties
end

.get(user_id, property_name) ⇒ Object



290
291
292
293
294
295
296
297
298
# File 'lib/sakai-info/user.rb', line 290

def self.get(user_id, property_name)
  row = DB.connect[:sakai_user_property].
    filter(:user_id => user_id, :name => property_name).first
  if row.nil?
    nil
  else
    row[:value].read
  end
end