Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
view-permission-based-on-project-membership
Note that users now have two collections of projects: `projects` are the projects that users own, and `joined_projects` are the projects they have joined as members.

We can now define view permission on projects, stories and tasks according to project membership.

SHOW_PATCH
  • Loading branch information
bryanlarsen committed Feb 19, 2010
1 parent 957e199 commit 5de4365
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/project.rb
Expand Up @@ -28,7 +28,7 @@ def destroy_permitted?
end

def view_permitted?(field)
true
acting_user.administrator? || acting_user == owner || acting_user.in?(members)
end

end
2 changes: 1 addition & 1 deletion app/models/story.rb
Expand Up @@ -28,7 +28,7 @@ def destroy_permitted?
end

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

end
2 changes: 1 addition & 1 deletion app/models/task.rb
Expand Up @@ -29,7 +29,7 @@ def destroy_permitted?
end

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

end

0 comments on commit 5de4365

Please sign in to comment.