Class: Artisan::Teams::Team
- Inherits:
-
Object
- Object
- Artisan::Teams::Team
- Defined in:
- lib/artisan/teams/team.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #add_team_member(user) ⇒ Object
- #add_team_owner(user) ⇒ Object
-
#initialize(project, current_user) ⇒ Team
constructor
A new instance of Team.
- #owner?(user) ⇒ Boolean
- #owners ⇒ Object
- #remove_user(user) ⇒ Object
- #user?(user) ⇒ Boolean
Constructor Details
#initialize(project, current_user) ⇒ Team
Returns a new instance of Team.
10 11 12 |
# File 'lib/artisan/teams/team.rb', line 10 def initialize(project, current_user) @project = project end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
8 9 10 |
# File 'lib/artisan/teams/team.rb', line 8 def project @project end |
Instance Method Details
#add_team_member(user) ⇒ Object
14 15 16 |
# File 'lib/artisan/teams/team.rb', line 14 def add_team_member(user) add_member(user, false) end |
#add_team_owner(user) ⇒ Object
18 19 20 |
# File 'lib/artisan/teams/team.rb', line 18 def add_team_owner(user) add_member(user, true) end |
#owner?(user) ⇒ Boolean
22 23 24 25 |
# File 'lib/artisan/teams/team.rb', line 22 def owner?(user) return false if project.nil? || !user?(user) project_repo.is_owner?(project, user) end |
#owners ⇒ Object
38 39 40 |
# File 'lib/artisan/teams/team.rb', line 38 def owners project_repo.owners(project) end |
#remove_user(user) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/artisan/teams/team.rb', line 31 def remove_user(user) project_repo.remove_member(project, user) if !user.nil? Artisan::Member.new(OpenStruct.new(:user => user, :project => project)).remove_from_email_lists end end |
#user?(user) ⇒ Boolean
27 28 29 |
# File 'lib/artisan/teams/team.rb', line 27 def user?(user) project_repo.is_member?(project, user) end |