diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2019-01-15 14:57:17 -0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2019-01-16 14:54:05 -0300 |
commit | ab94a5a53712740df3836413bf26e4856b5f7cb2 (patch) | |
tree | b712300e7011586c86a833232b9afed3c0332f96 /lib/api | |
parent | f821a53b45d4b521ffb734b3b843f48e0d1ecfcd (diff) | |
download | gitlab-ce-ab94a5a53712740df3836413bf26e4856b5f7cb2.tar.gz |
Return max group access level in the projects API
Currently if a project is inside a nested group and a user doesn't have
specific permissions for that group but does have permissions on a
parent group the `GET /projects/:id` API call will return the following
permissions:
```json
permissions: { project_access: null, group_access: null }
```
It could also happen that the group specific permissions are of lower
level than the ones the user has in parent groups. This patch makes it
so that the permission returned for `group_access` is the highest from
amongst the hierarchy, which is (ostensibly) the information that the
API user is interested in for that field.
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index a2a3c0a16d7..f13741f80d2 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -961,7 +961,7 @@ module API if options[:group_members] options[:group_members].find { |member| member.source_id == project.namespace_id } else - project.group.group_member(options[:current_user]) + project.group.highest_group_member(options[:current_user]) end end end |