Skip to content
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

Move entity package back to shared #12911

Merged
merged 2 commits into from Feb 19, 2024

Conversation

markylaing
Copy link
Contributor

This PR reverts b463884 and adds a follow up commit to fix imports that have been added after that commit.

We do need to have the entity package in shared so that when adding permissions to groups we can parse the input and create a standardised URL. If the client is very out of date with the server, the worst that might happen is the server will respond to say it doesn't recognise the URL or the entity type. If this is not sufficient, perhaps we can add entity types and entitlements to the metadata API and validate client side that way first.

This reverts commit b463884.

Signed-off-by: Mark Laing <mark.laing@canonical.com>
Signed-off-by: Mark Laing <mark.laing@canonical.com>
@tomponline
Copy link
Member

We do need to have the entity package in shared so that when adding permissions to groups we can parse the input and create a standardised URL. If the client is very out of date with the server, the worst that might happen is the server will respond to say it doesn't recognise the URL or the entity type. If this is not sufficient, perhaps we can add entity types and entitlements to the metadata API and validate client side that way first.

This seems OK.

Please could you give me an example of where it would be needed to a construct a URL from input?

@tomponline tomponline merged commit 58e8c93 into canonical:main Feb 19, 2024
27 checks passed
@markylaing
Copy link
Contributor Author

Please could you give me an example of where it would be needed to a construct a URL from input?

When adding permissions to a group we have:

lxc auth group permission add <entity_type> [<entity_name>] <entitlement> [<key>=<value>]

Say we have:

lxc auth group permission add storage_volume vol1 can_manage_snapshots project=my-project type=custom pool=default

We need to construct the /1.0/storage/default/volumes/custom/vol1?project=my-project URL. This is added to the api.Permission as a string in the EntityReference field. The server will parse that URL and get an ID for it to be used in the permissions table.

@tomponline
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants