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

Fix --all-projects for restricted users #605

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

presztak
Copy link
Collaborator

Allows to use --all-projects for restricted users.

Fixes: #591

@presztak presztak marked this pull request as ready for review March 11, 2024 20:31
@presztak presztak requested a review from stgraber as a code owner March 11, 2024 20:31
@stgraber
Copy link
Member

@presztak hmm, so that will definitely make --all-projects work but I don't see how this is then restricting the list of projects to those the user has access to, am I missing something?

Based on what I'm reading, I'd expect this PR to let me pass ?all-projects=true and see entries from any project even those that I'm not normally allowed to see.

@presztak
Copy link
Collaborator Author

presztak commented Mar 11, 2024

@stgraber e.g. for instances we have this check:

if !userHasPermission(auth.ObjectInstance(inst.Project, inst.Name)) {
continue
}
which actually perform this part of code:
return slices.Contains(projectNames, object.Project())

so entries for projects to which user doesn't have access will be not displayed.

@stgraber
Copy link
Member

Ah, good, so we need to make sure that the same is true everywhere else all-projects is allowed.

That appears to include:

  • instances
  • images
  • operations
  • events
  • network allocations
  • storage volumes

@presztak presztak force-pushed the all_projects_restricted_users branch from b5db6a7 to e252334 Compare March 11, 2024 21:31
@presztak
Copy link
Collaborator Author

presztak commented Mar 11, 2024

@stgraber yup,

but actually we don't need to modify CheckPermission method. Changes in GetPermissionChecker are enough.

@stgraber stgraber merged commit bf0a030 into lxc:main Mar 11, 2024
25 checks passed
@stgraber
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
Development

Successfully merging this pull request may close these issues.

Have incus list --all-projects work for restricted users
2 participants