Commit 3d14cd02 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Present "plan" data for group/namespace admins

parent c49b3f5f
......@@ -38,7 +38,8 @@ Example response:
"kind": "group"
"full_path": "group1",
"parent_id": "null",
"members_count_with_descendants": 2
"members_count_with_descendants": 2,
"plan": "bronze"
},
{
"id": 3,
......@@ -51,7 +52,7 @@ Example response:
]
```
**Note**: `members_count_with_descendants` are presented only for group masters/owners.
**Note**: `members_count_with_descendants` and `plan` are presented only for group masters/owners.
## Search for namespace
......
......@@ -522,7 +522,7 @@ module API
# EE-only
expose :shared_runners_minutes_limit, if: lambda { |_, options| options[:current_user]&.admin? }
expose :plan, if: lambda { |_, options| options[:current_user]&.admin? }
expose :plan, if: -> (namespace, opts) { Ability.allowed?(opts[:current_user], :admin_namespace, namespace) }
end
class MemberAccess < Grape::Entity
......
......@@ -61,7 +61,7 @@ describe API::Namespaces do
owned_group_response = json_response.find { |resource| resource['id'] == group1.id }
expect(owned_group_response.keys).to contain_exactly('id', 'kind', 'name', 'path', 'full_path',
'parent_id', 'members_count_with_descendants')
'plan', 'parent_id', 'members_count_with_descendants')
end
it "returns correct attributes when user cannot admin group" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment