Commit a30d40df authored by Stan Hu's avatar Stan Hu

Merge branch 'peterhegman/add-valid-roles-to-group-members' into 'master'

Add `valid_roles` property to group members

See merge request gitlab-org/gitlab!44358
parents 6a6185aa 612d8a57
...@@ -44,7 +44,8 @@ module Groups::GroupMembersHelper ...@@ -44,7 +44,8 @@ module Groups::GroupMembersHelper
id: source.id, id: source.id,
name: source.full_name, name: source.full_name,
web_url: Gitlab::UrlBuilder.build(source) web_url: Gitlab::UrlBuilder.build(source)
} },
valid_roles: member.valid_level_roles
}.merge(member_created_by_data(member.created_by)) }.merge(member_created_by_data(member.created_by))
if member.invite? if member.invite?
......
...@@ -22,6 +22,10 @@ class GroupGroupLinkEntity < Grape::Entity ...@@ -22,6 +22,10 @@ class GroupGroupLinkEntity < Grape::Entity
expose :group_access, as: :integer_value expose :group_access, as: :integer_value
end end
expose :valid_roles do |group_link|
group_link.class.access_options
end
expose :shared_with_group do expose :shared_with_group do
expose :avatar_url do |group_link| expose :avatar_url do |group_link|
group_link.shared_with_group.avatar_url(only_path: false) group_link.shared_with_group.avatar_url(only_path: false)
......
{ {
"type": "object", "type": "object",
"required": ["id", "created_at", "expires_at", "can_update", "can_remove", "access_level"], "required": [
"id",
"created_at",
"expires_at",
"can_update",
"can_remove",
"access_level",
"valid_roles"
],
"properties": { "properties": {
"id": { "type": "integer" }, "id": { "type": "integer" },
"created_at": { "type": "date-time" }, "created_at": { "type": "date-time" },
...@@ -15,6 +23,7 @@ ...@@ -15,6 +23,7 @@
"string_value": { "type": "string" } "string_value": { "type": "string" }
} }
}, },
"valid_roles": { "type": "object" },
"shared_with_group": { "shared_with_group": {
"type": "object", "type": "object",
"required": ["id", "name", "full_name", "full_path", "avatar_url", "web_url"], "required": ["id", "name", "full_name", "full_path", "avatar_url", "web_url"],
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"access_level", "access_level",
"requested_at", "requested_at",
"source", "source",
"valid_roles",
"can_update", "can_update",
"can_remove", "can_remove",
"can_override" "can_override"
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
"web_url": { "type": "string" } "web_url": { "type": "string" }
} }
}, },
"valid_roles": { "type": "object" },
"created_by": { "created_by": {
"type": "object", "type": "object",
"required": ["name", "web_url"], "required": ["name", "web_url"],
......
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