Closed pnzrr closed 1 year ago
Done, but not released yet. Will close when released to app.phasetwo.io.
OpenAPI spec change here: https://github.com/p2-inc/phasetwo-docs/blob/master/openapi.yaml#L415
Endpoint example: https://app.phasetwo.io/auth/realms/test/orgs/me
Response example (200):
{
"a7de9f72-896c-4ad4-8bb8-3b4217d39235": {
"name": "foo",
"displayName": "Foo corp",
"url": "https://foo.com",
"roles": [ "view-organization", "manage-organization" ],
"attributes": { "a": [ "b", "c" ] }
},
"6ad5a9e5-6ca1-4e9c-b429-a91668954cf8": {
"name": "bar",
"displayName": "Bar Inc.",
"url": "https://www2.bar.net",
"roles": [ "view-organization", "manage-organization", "view-invitations" ],
"attributes": { "a": [ "b", "c" ], "x": [ "y", "z" ] }
}
}
This will return all orgs/roles for which the user (identified by the token) is a member. The user doesn't need ANY roles in order to call this.
@pnzrr This is released.
Right now you need the
view-roles
role in order to get a response back from the endpoint that tells you what roles any user for an org has. The issue is that if your user does not have that role, you can't even view your roles on an org. There needs to be an endpoint that allows one to check their own roles for an organization. For convenience, it would be nice if the endpoint returned an object of all roles and if its available or not.Proposed endpoint
/self
https://app.phasetwo.io/auth/realms/test/orgs/${orgId}/roles/self