Commit 06479426 authored by Etienne Baqué's avatar Etienne Baqué

Merge branch 'vij-add-member-state-to-entity' into 'master'

Update Member entity to expose member state

See merge request gitlab-org/gitlab!74624
parents d40b13bc a454ca62
...@@ -65,7 +65,8 @@ Example response: ...@@ -65,7 +65,8 @@ Example response:
"web_url": "http://192.168.1.8:3000/root", "web_url": "http://192.168.1.8:3000/root",
"expires_at": "2012-10-22T14:13:35Z", "expires_at": "2012-10-22T14:13:35Z",
"access_level": 30, "access_level": 30,
"group_saml_identity": null "group_saml_identity": null,
"membership_state": "active"
}, },
{ {
"id": 2, "id": 2,
...@@ -81,7 +82,8 @@ Example response: ...@@ -81,7 +82,8 @@ Example response:
"extern_uid":"ABC-1234567890", "extern_uid":"ABC-1234567890",
"provider": "group_saml", "provider": "group_saml",
"saml_provider_id": 10 "saml_provider_id": 10
} },
"membership_state": "active"
} }
] ]
``` ```
...@@ -126,7 +128,8 @@ Example response: ...@@ -126,7 +128,8 @@ Example response:
"web_url": "http://192.168.1.8:3000/root", "web_url": "http://192.168.1.8:3000/root",
"expires_at": "2012-10-22T14:13:35Z", "expires_at": "2012-10-22T14:13:35Z",
"access_level": 30, "access_level": 30,
"group_saml_identity": null "group_saml_identity": null,
"membership_state": "active"
}, },
{ {
"id": 2, "id": 2,
...@@ -142,7 +145,8 @@ Example response: ...@@ -142,7 +145,8 @@ Example response:
"extern_uid":"ABC-1234567890", "extern_uid":"ABC-1234567890",
"provider": "group_saml", "provider": "group_saml",
"saml_provider_id": 10 "saml_provider_id": 10
} },
"membership_state": "active"
}, },
{ {
"id": 3, "id": 3,
...@@ -153,7 +157,8 @@ Example response: ...@@ -153,7 +157,8 @@ Example response:
"web_url": "http://192.168.1.8:3000/root", "web_url": "http://192.168.1.8:3000/root",
"expires_at": "2012-11-22T14:13:35Z", "expires_at": "2012-11-22T14:13:35Z",
"access_level": 30, "access_level": 30,
"group_saml_identity": null "group_saml_identity": null,
"membership_state": "active"
} }
] ]
``` ```
...@@ -191,7 +196,8 @@ Example response: ...@@ -191,7 +196,8 @@ Example response:
"email": "john@example.com", "email": "john@example.com",
"created_at": "2012-10-22T14:13:35Z", "created_at": "2012-10-22T14:13:35Z",
"expires_at": null, "expires_at": null,
"group_saml_identity": null "group_saml_identity": null,
"membership_state": "active"
} }
``` ```
...@@ -229,7 +235,8 @@ Example response: ...@@ -229,7 +235,8 @@ Example response:
"access_level": 30, "access_level": 30,
"email": "john@example.com", "email": "john@example.com",
"expires_at": null, "expires_at": null,
"group_saml_identity": null "group_saml_identity": null,
"membership_state": "active"
} }
``` ```
......
...@@ -15,6 +15,8 @@ module EE ...@@ -15,6 +15,8 @@ module EE
expose :override, expose :override,
if: ->(member, _) { member.source_type == 'Namespace' && member.ldap? } if: ->(member, _) { member.source_type == 'Namespace' && member.ldap? }
expose :human_state_name, as: :membership_state
end end
end end
end end
......
...@@ -51,4 +51,11 @@ RSpec.describe API::Entities::Member do ...@@ -51,4 +51,11 @@ RSpec.describe API::Entities::Member do
expect(entity_representation.keys).not_to include(:email) expect(entity_representation.keys).not_to include(:email)
end end
end end
context 'with state' do
it 'exposes human_state_name as membership_state' do
expect(entity_representation.keys).to include(:membership_state)
expect(entity_representation[:membership_state]).to eq member.human_state_name
end
end
end end
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