BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
6 additions
and
19 deletions
+6
-19
users.md
doc/api/users.md
+1
-2
entities.rb
lib/api/entities.rb
+0
-4
users.rb
lib/api/users.rb
+1
-3
login.json
spec/fixtures/api/schemas/public_api/v4/user/login.json
+2
-4
session.json
spec/support/gitlab_stubs/session.json
+1
-3
user.json
spec/support/gitlab_stubs/user.json
+1
-3
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"
}
}
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