Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-05-11 15:49:29 +0300
committerRobert Speicher <robert@gitlab.com>2016-05-11 15:49:29 +0300
commit24f353edc4e90a7846bb6706f6b89e1bb6db7469 (patch)
tree7dee14d6f545f26de63e740d5194cba1f3249746 /lib/api
parentd526cda5028c9b55241a6996f32cc6a967e8fcba (diff)
parentacd8930c46c06312f87c5ea0bb549b5435feece8 (diff)
Merge branch '17249-starred' into 'master'
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. Closes #17249. See merge request !4108
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/projects.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index cc2c7a0c503..9b595772675 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -44,7 +44,7 @@ module API
# Example Request:
# GET /projects/starred
get '/starred' do
- @projects = current_user.starred_projects
+ @projects = current_user.viewable_starred_projects
@projects = filter_projects(@projects)
@projects = paginate @projects
present @projects, with: Entities::Project