-
Notifications
You must be signed in to change notification settings - Fork 933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auth: Add entitlements to LXD resources (part 3: Enrich LXD resources with entitlements) #14748
base: main
Are you sure you want to change the base?
auth: Add entitlements to LXD resources (part 3: Enrich LXD resources with entitlements) #14748
Conversation
d5f0001
to
3cae833
Compare
e653ad9
to
7f5457a
Compare
171b326
to
1a09849
Compare
1a09849
to
e18b874
Compare
@minaelee thanks for the feedbacks. Fixing that right now |
Adds `fine_grained` field to `GET /1.0/auth/identities/current` to indicate if the current identity interacting with the LXD API is fine-grained (i.e, associated permissions are managed via group membership) and allow LXD entities to be returned with an `entitlements` field if the current identity is fine-grained and if the GET request to fetch the LXD entities has the `with-entitlements=<comma_separated_list_of_candidate_entitlements>` query parameter. Signed-off-by: Gabriel Mougard <[email protected]>
Signed-off-by: Gabriel Mougard <[email protected]>
Signed-off-by: Gabriel Mougard <[email protected]>
b265876
to
6f763e7
Compare
6f763e7
to
c793358
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach and format seems all right from my point of view. Left some comments below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add a test case like the one below?
A restricted user has some entitlements on a project. Request the project list with that user and with a list of entitlements. Then assert the api response contains the correct list of entitlements for that project. Maybe request some entitlements the user has on the project, and some that the user has not to make it cover all the possible cases.
If we build this test case reusable, we can repeat it for all the different entity types, but not sure if that level of coverage is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that seems like a good test case. I can try to build a reusable one for a couple of entities (instance
, volume
, or other ones you think might be useful for your use case)
…ies/current` endpoint This is needed to let know the client if the currently used identity is fine-grained or not. Signed-off-by: Gabriel Mougard <[email protected]>
c793358
to
ed0cbfa
Compare
…e-allocated) Signed-off-by: Gabriel Mougard <[email protected]>
… current identity info Signed-off-by: Gabriel Mougard <[email protected]>
…e `Authorizer` interface These methods return the entitlements corresponding to the entity/entities through calls to the OpenFGA datastore. These functions should be called at the end of a LXD API handler so that the OpenFGA per-request cache can be hit. Signed-off-by: Gabriel Mougard <[email protected]>
… eligible LXD entities Signed-off-by: Gabriel Mougard <[email protected]>
Signed-off-by: Gabriel Mougard <[email protected]>
Signed-off-by: Gabriel Mougard <[email protected]>
Signed-off-by: Gabriel Mougard <[email protected]>
Signed-off-by: Gabriel Mougard <[email protected]>
Signed-off-by: Gabriel Mougard <[email protected]>
Signed-off-by: Gabriel Mougard <[email protected]>
Signed-off-by: Gabriel Mougard <[email protected]>
Signed-off-by: Gabriel Mougard <[email protected]>
Signed-off-by: Gabriel Mougard <[email protected]>
ed0cbfa
to
6725a64
Compare
@@ -623,6 +623,12 @@ func storagePoolVolumesGet(d *Daemon, r *http.Request) response.Response { | |||
return response.SmartError(err) | |||
} | |||
|
|||
// Detect if we want to also returns entitlements for each volume. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Detect if we want to also returns entitlements for each volume. | |
// Detect if we want to also return entitlements for each volume. |
@@ -2016,6 +2035,12 @@ func storagePoolVolumeGet(d *Daemon, r *http.Request) response.Response { | |||
return response.SmartError(err) | |||
} | |||
|
|||
// Detect if we want to also returns entitlements for each volume. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Detect if we want to also returns entitlements for each volume. | |
// Detect if we want to also return entitlements for each volume. |
This is the third part of a group of three stacked PRs.
IsFineGrained
field) #14745