lib/cratus/user.rb in cratus-0.3.9 vs lib/cratus/user.rb in cratus-0.4.0
- old
+ new
@@ -12,9 +12,23 @@
basedn: @search_base,
attrs: self.class.ldap_return_attributes
).last
end
+ # Add a user to a group
+ def add_to_group(group)
+ raise 'InvalidGroup' unless group.respond_to?(:add_user)
+ # just be lazy and hand off to the group to do the work...
+ group.add_user(self)
+ end
+
+ # Remove a user from a group
+ def remove_from_group(group)
+ raise 'InvalidGroup' unless group.respond_to?(:remove_user)
+ # just be lazy and hand off to the group to do the work...
+ group.remove_user(self)
+ end
+
def department
@raw_ldap_data[Cratus.config.user_department_attribute].last
end
def dn