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

Explicitly shortcut "everything" for privileges #17526

Merged
merged 1 commit into from
Jun 5, 2018

Conversation

kbrock
Copy link
Member

@kbrock kbrock commented Jun 5, 2018

The seeds in the database have "everything" as the root of all miq_product_features. Features are in a tree, so asking a role if it has a feature will work it's way up the tree. If an miq_user_role with the "everything" role returns true for any request.

Before:

When writing tests, it is currently not possible to create an miq_product_feature hierarchy with "everything" at the root. We are getting around by stubbing our authorization code to true.
This stub methods no longer works with the new way we are checking for the admin feature. (e.g.: request_admin_user?)

After

This change states that if a role has the miq_product_feature of "everything", then it has the privilege to perform all product features. This used to be more data driven before rather than hardcoded in the ruby logic.

So it does special case "everything" and the code now actually knows that everything means everything. On the up side, this change allow us to remove the stubbed out authentication logic.

This change is part of #17444 - it currently helps get ManageIQ/manageiq-ui-classic#3993 to pass

The seeds in the database have everything as the root of all features
So this is not a problem in production

But for tests, it is currently not possible to create this hierarchy and
tricky to work around it.

This change just admits that everything means everything and doesn't
require complex feature checks to test user roles
@miq-bot
Copy link
Member

miq-bot commented Jun 5, 2018

Checked commit kbrock@4b7b96c with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🍰

@gtanzillo gtanzillo added this to the Sprint 88 Ending Jun 18, 2018 milestone Jun 5, 2018
@gtanzillo gtanzillo merged commit ad1145a into ManageIQ:master Jun 5, 2018
@kbrock kbrock deleted the super_admin_feature_everything branch June 5, 2018 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants