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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
de35bb22
Commit
de35bb22
authored
Feb 28, 2022
by
Serena Fang
Committed by
Douglas Barbosa Alexandre
Mar 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unneeded changes
Remove uneeded changes
parent
14b4120f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
8 deletions
+6
-8
app/serializers/member_entity.rb
app/serializers/member_entity.rb
+3
-1
app/serializers/request_aware_entity.rb
app/serializers/request_aware_entity.rb
+1
-1
lib/api/entities/user_safe.rb
lib/api/entities/user_safe.rb
+2
-6
No files found.
app/serializers/member_entity.rb
View file @
de35bb22
...
...
@@ -40,7 +40,9 @@ class MemberEntity < Grape::Entity
expose
:valid_level_roles
,
as: :valid_roles
expose
:user
,
if:
->
(
member
)
{
member
.
user
.
present?
},
using:
MemberUserEntity
expose
:user
,
if:
->
(
member
)
{
member
.
user
.
present?
}
do
|
member
,
options
|
MemberUserEntity
.
represent
(
member
.
user
,
options
)
end
expose
:state
...
...
app/serializers/request_aware_entity.rb
View file @
de35bb22
...
...
@@ -10,6 +10,6 @@ module RequestAwareEntity
end
def
request
options
.
fetch
(
:request
,
nil
)
options
.
fetch
(
:request
)
end
end
lib/api/entities/user_safe.rb
View file @
de35bb22
...
...
@@ -3,19 +3,15 @@
module
API
module
Entities
class
UserSafe
<
Grape
::
Entity
include
RequestAwareEntity
expose
:id
,
:username
expose
:name
do
|
user
|
next
user
.
name
unless
user
.
project_bot?
current_user
=
request
.
respond_to?
(
:current_user
)
?
request
.
current_user
:
options
.
fetch
(
:current_user
,
nil
)
if
user
.
groups
next
user
.
name
if
current_user
&
.
can?
(
:read_group
,
user
.
groups
.
first
)
next
user
.
name
if
options
[
:current_user
]
&
.
can?
(
:read_group
,
user
.
groups
.
first
)
end
next
user
.
name
if
current_user
&
.
can?
(
:read_project
,
user
.
projects
.
first
)
next
user
.
name
if
options
[
:current_user
]
&
.
can?
(
:read_project
,
user
.
projects
.
first
)
# If the requester does not have permission to read the project bot name,
# the API returns an arbitrary string. UI changes will be addressed in a follow up issue:
...
...
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