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 committed Nov 14, 2011
1 parent f4b9616 commit f8357ad
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 @@ -18,15 +18,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 @@ -17,15 +17,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 @@ -12,19 +12,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 f8357ad

Please sign in to comment.