Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
fbdf0578
Commit
fbdf0578
authored
Oct 12, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove private_token from API user entity
parent
a72d6879
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
20 deletions
+7
-20
doc/api/users.md
doc/api/users.md
+1
-2
lib/api/entities.rb
lib/api/entities.rb
+0
-4
lib/api/users.rb
lib/api/users.rb
+1
-3
spec/fixtures/api/schemas/public_api/v4/user/login.json
spec/fixtures/api/schemas/public_api/v4/user/login.json
+2
-4
spec/support/gitlab_stubs/session.json
spec/support/gitlab_stubs/session.json
+1
-3
spec/support/gitlab_stubs/user.json
spec/support/gitlab_stubs/user.json
+2
-4
No files found.
doc/api/users.md
View file @
fbdf0578
...
@@ -410,8 +410,7 @@ GET /user
...
@@ -410,8 +410,7 @@ GET /user
"can_create_group"
:
true
,
"can_create_group"
:
true
,
"can_create_project"
:
true
,
"can_create_project"
:
true
,
"two_factor_enabled"
:
true
,
"two_factor_enabled"
:
true
,
"external"
:
false
,
"external"
:
false
"private_token"
:
"dd34asd13as"
}
}
```
```
...
...
lib/api/entities.rb
View file @
fbdf0578
...
@@ -57,10 +57,6 @@ module API
...
@@ -57,10 +57,6 @@ module API
expose
:admin?
,
as: :is_admin
expose
:admin?
,
as: :is_admin
end
end
class
UserWithPrivateDetails
<
UserWithAdmin
expose
:private_token
end
class
Email
<
Grape
::
Entity
class
Email
<
Grape
::
Entity
expose
:id
,
:email
expose
:id
,
:email
end
end
...
...
lib/api/users.rb
View file @
fbdf0578
...
@@ -507,9 +507,7 @@ module API
...
@@ -507,9 +507,7 @@ module API
end
end
get
do
get
do
entity
=
entity
=
if
sudo?
if
current_user
.
admin?
Entities
::
UserWithPrivateDetails
elsif
current_user
.
admin?
Entities
::
UserWithAdmin
Entities
::
UserWithAdmin
else
else
Entities
::
UserPublic
Entities
::
UserPublic
...
...
spec/fixtures/api/schemas/public_api/v4/user/login.json
View file @
fbdf0578
...
@@ -27,11 +27,9 @@
...
@@ -27,11 +27,9 @@
"can_create_group"
,
"can_create_group"
,
"can_create_project"
,
"can_create_project"
,
"two_factor_enabled"
,
"two_factor_enabled"
,
"external"
,
"external"
"private_token"
],
],
"properties"
:
{
"properties"
:
{
"$ref"
:
"full.json"
,
"$ref"
:
"full.json"
"private_token"
:
{
"type"
:
"string"
}
}
}
}
}
spec/support/gitlab_stubs/session.json
View file @
fbdf0578
...
@@ -14,7 +14,5 @@
...
@@ -14,7 +14,5 @@
"provider"
:
null
,
"provider"
:
null
,
"is_admin"
:
false
,
"is_admin"
:
false
,
"can_create_group"
:
false
,
"can_create_group"
:
false
,
"can_create_project"
:
false
,
"can_create_project"
:
false
"private_token"
:
"Wvjy2Krpb7y8xi93owUz"
,
"access_token"
:
"Wvjy2Krpb7y8xi93owUz"
}
}
spec/support/gitlab_stubs/user.json
View file @
fbdf0578
...
@@ -14,7 +14,5 @@
...
@@ -14,7 +14,5 @@
"provider"
:
null
,
"provider"
:
null
,
"is_admin"
:
false
,
"is_admin"
:
false
,
"can_create_group"
:
false
,
"can_create_group"
:
false
,
"can_create_project"
:
false
,
"can_create_project"
:
false
"private_token"
:
"Wvjy2Krpb7y8xi93owUz"
,
}
"access_token"
:
"Wvjy2Krpb7y8xi93owUz"
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment