Class: UcbGroups::CampusGroup
- Inherits:
-
Object
- Object
- UcbGroups::CampusGroup
- Defined in:
- lib/ucb_groups/campus_group.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#dn ⇒ Object
Returns the value of attribute dn.
-
#name ⇒ Object
Returns the value of attribute name.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ldap_entry) ⇒ CampusGroup
constructor
A new instance of CampusGroup.
Constructor Details
#initialize(ldap_entry) ⇒ CampusGroup
Returns a new instance of CampusGroup.
5 6 7 8 9 |
# File 'lib/ucb_groups/campus_group.rb', line 5 def initialize(ldap_entry) @dn = ldap_entry[:dn].first.to_s @description = ldap_entry[:description].first.to_s @namespace, @name = parse_dn end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/ucb_groups/campus_group.rb', line 3 def description @description end |
#dn ⇒ Object
Returns the value of attribute dn.
3 4 5 |
# File 'lib/ucb_groups/campus_group.rb', line 3 def dn @dn end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/ucb_groups/campus_group.rb', line 3 def name @name end |
#namespace ⇒ Object
Returns the value of attribute namespace.
3 4 5 |
# File 'lib/ucb_groups/campus_group.rb', line 3 def namespace @namespace end |
Class Method Details
.build_filter(namespace) ⇒ Object
27 28 29 |
# File 'lib/ucb_groups/campus_group.rb', line 27 def self.build_filter(namespace) "(&(objectclass=*)(cn=edu:berkeley:app:#{namespace}*))" end |
.find(namespace) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/ucb_groups/campus_group.rb', line 11 def self.find(namespace) args = { :base => "ou=campus groups,dc=berkeley,dc=edu", :filter => build_filter(namespace), :attributes => %w(dn description name), } LdapConn.conn.search(args).map { |entry| CampusGroup.new(entry) } end |