lib/fabric/map.rb in fabric-0.3.5 vs lib/fabric/map.rb in fabric-0.3.6
- old
+ new
@@ -73,9 +73,17 @@
if role_conditions.include?(:except)
roles = roles.all(:name.not => role_conditions[:except])
end
+ if role_conditions.include?(:groups)
+ role_conditions[:groups].each do |group|
+ users.each do |user|
+ user.groups.create(:name => group)
+ end
+ end
+ end
+
raise DataMapper::ObjectNotFoundError if users.empty? or roles.empty?
roles.each do |role|
role.users += users
end
\ No newline at end of file