Skip to content

Instantly share code, notes, and snippets.

@banister
Forked from cored/gist:5033948
Created February 25, 2013 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banister/5034026 to your computer and use it in GitHub Desktop.
Save banister/5034026 to your computer and use it in GitHub Desktop.
module Domain¬
class CollaboratorRepository¬
def self.add(project, users)¬
users.each do |user|¬
user = User.find(user) if user.is_a?(BSON::ObjectId)¬
project.collaborator_ids << user.id unless !user.is_a?(User) or user.guest? or project.collaborator_ids.include?(user.id)¬
Sentry.init(project.id, user.id)¬
end¬ 9 project.save¬
end¬
¬
def self.remove(project, users)¬
users.each do |user|¬
user = User.find(user) if user.is_a?(BSON::ObjectId)¬
project.collaborator_ids.delete(user.id) unless !user.is_a?(User) or user.guest? or !project.collaborators.include?(user)¬
Sentry.init(project.id, user.id).destroy¬
end¬
project.save¬
end¬
end¬
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment