Skip to content

Get user by id doesnt work if user doesn't have enough rights #542

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

Open
andrejcermak opened this issue Mar 13, 2025 · 5 comments
Open

Get user by id doesnt work if user doesn't have enough rights #542

andrejcermak opened this issue Mar 13, 2025 · 5 comments

Comments

@andrejcermak
Copy link
Contributor

Get user by id doesn't work if user doesn't have enough rights because of the first 2 lines

def find_by_id(id) cached_user = find { |user| user.id == id } return cached_user if cached_user
as it calls the list_all_users in the all function, so if the user doesn't have sufficient rights to list all users, this fails.

@geemus
Copy link
Member

geemus commented Mar 17, 2025

@andrejcermak Thanks for the detailed report. Any ideas on how we might fix or workaround this? (I haven't used openstack in years at this point, so I don't feel equipped to easily fix/test).

@andrejcermak
Copy link
Contributor Author

IMO just deleting the 2 lines that handle the cached_user variable should be enough to prevent this happening.

@geemus
Copy link
Member

geemus commented Mar 18, 2025

I'm open to some kind of change, though I presume it was there for some reason/need. So maybe it could still be there, but fail more gracefully (and then presumably disable caching) rather than removing caching altogether?

@andrejcermak
Copy link
Contributor Author

Is there any standardized way of handling errors in this project? I think an easy solution would be to try the cache call once, catch the exception and then disable the caching somehow.

@geemus
Copy link
Member

geemus commented Mar 20, 2025

@andrejcermak Yeah, my thought was similar. I don't think there is an existing pattern that matches this particularly well (or at least not one that comes to mind).

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

No branches or pull requests

2 participants