Skip to content

Commit

Permalink
task-assignment-permissions
Browse files Browse the repository at this point in the history
The stories, tasks and task assignments associated with the project
need permissions similar to that of their containing project.  Let's
set their permission to check their containing project:

SHOW_PATCH
  • Loading branch information
bryanlarsen authored and iox committed Aug 12, 2013
1 parent 4d7525b commit 6bc889d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions app/models/story.rb
Expand Up @@ -19,15 +19,15 @@ class Story < ActiveRecord::Base
# --- Permissions --- #

def create_permitted?
acting_user.administrator?
project.creatable_by?(acting_user)
end

def update_permitted?
acting_user.signed_up? && !project_changed?
project.updatable_by?(acting_user)
end

def destroy_permitted?
acting_user.administrator?
project.destroyable_by?(acting_user)
end

def view_permitted?(field)
Expand Down
6 changes: 3 additions & 3 deletions app/models/task.rb
Expand Up @@ -18,15 +18,15 @@ class Task < ActiveRecord::Base
# --- Permissions --- #

def create_permitted?
acting_user.administrator?
story.creatable_by?(acting_user)
end

def update_permitted?
acting_user.signed_up? && !story_changed?
story.updatable_by?(acting_user)
end

def destroy_permitted?
acting_user.administrator?
story.destroyable_by?(acting_user)
end

def view_permitted?(field)
Expand Down
8 changes: 4 additions & 4 deletions app/models/task_assignment.rb
Expand Up @@ -13,19 +13,19 @@ class TaskAssignment < ActiveRecord::Base
# --- Permissions --- #

def create_permitted?
acting_user.administrator?
task.creatable_by?(acting_user)
end

def update_permitted?
acting_user.administrator?
task.updatable_by?(acting_user)
end

def destroy_permitted?
acting_user.administrator?
task.destroyable_by?(acting_user)
end

def view_permitted?(field)
true
task.viewable_by?(acting_user)
end

end

0 comments on commit 6bc889d

Please sign in to comment.