summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-10-05 23:38:02 +0900
committerShinya Maeda <shinya@gitlab.com>2018-10-05 23:38:02 +0900
commit7542a5d102bc48f5f7b8104fda22f0975b2dd931 (patch)
tree9a94528103422fa5baaab096091e34ae6463d507 /lib/api
parent8deb9c010fb4ab24b56a68470ecbf4b875467248 (diff)
parent88fa9a3c31d250ae9b88bb3250204b39eabc14b4 (diff)
downloadgitlab-ce-7542a5d102bc48f5f7b8104fda22f0975b2dd931.tar.gz
Merge branch 'master-ce' into scheduled-manual-jobs
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/projects.rb6
-rw-r--r--lib/api/users.rb6
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 00bad49ebdc..ae2d327e45b 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -287,6 +287,12 @@ module API
present_projects forks
end
+ desc 'Check pages access of this project'
+ get ':id/pages_access' do
+ authorize! :read_pages_content, user_project unless user_project.public_pages?
+ status 200
+ end
+
desc 'Update an existing project' do
success Entities::Project
end
diff --git a/lib/api/users.rb b/lib/api/users.rb
index 11a7f4ef64d..501c5cf1df3 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -256,7 +256,7 @@ module API
end
# rubocop: enable CodeReuse/ActiveRecord
- desc 'Get the SSH keys of a specified user. Available only for admins.' do
+ desc 'Get the SSH keys of a specified user.' do
success Entities::SSHKey
end
params do
@@ -265,10 +265,8 @@ module API
end
# rubocop: disable CodeReuse/ActiveRecord
get ':id/keys' do
- authenticated_as_admin!
-
user = User.find_by(id: params[:id])
- not_found!('User') unless user
+ not_found!('User') unless user && can?(current_user, :read_user, user)
present paginate(user.keys), with: Entities::SSHKey
end