diff options
author | Sean McGivern <sean@gitlab.com> | 2016-05-10 20:03:55 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2016-05-10 20:13:52 +0300 |
commit | 97424ea544d0954e582a356586270e983d3bbb7a (patch) | |
tree | 9d56780368e9823002f0d15ddc29e8db190090bf /app/controllers/dashboard/projects_controller.rb | |
parent | 98d8e3fe9ff4d120469378490c41381ae751597e (diff) |
Restrict starred projects to viewable ones
`User#starred_projects` doesn't perform any visibility checks. This has
a couple of problems:
1. It assumes a user can always view all of their starred projects in
perpetuity (project not changed to private, access revoked, etc.).
2. It assumes that we'll only ever allow a user to star a project they
can view. This is currently the case, but bugs happen.
Add `User#viewable_starred_projects` to filter the starred projects by
those the user either has explicit access to, or are public or
internal. Then use that in all places where we list the user's starred
projects.
Diffstat (limited to 'app/controllers/dashboard/projects_controller.rb')
-rw-r--r-- | app/controllers/dashboard/projects_controller.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index 71acc244a91..c08eb811532 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -28,7 +28,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController end def starred - @projects = current_user.starred_projects.sorted_by_activity + @projects = current_user.viewable_starred_projects.sorted_by_activity @projects = filter_projects(@projects) @projects = @projects.includes(:namespace, :forked_from_project, :tags) @projects = @projects.sort(@sort = params[:sort]) |