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 tag filtering for indirect RBAC #15088

Merged

Conversation

lpichler
Copy link
Contributor

@lpichler lpichler commented May 15, 2017

in #14095 was added tenant scope filter
for tenant restriction for associated models(indirect RBAC).

In method combine_filtered_ids was the issue that ids determined by tag filters, belongs filters and self-services users were joined to ids determined by tenant scope filter.
But both sets of ids express limitation so they have to be combined by intersection.

Example:

Tenant:
MyCompany->
Tenant1 ->
Tenant2

User is tight with group(with Tenant2) and role with
filtering by tag 'my_tag'

Vm1 Belongs to Tenant2 and is not tagged with any tag
Vm2 Belongs to Tenant2 and is tagged with tag 'my_tag'

the user have to see only VMs from his tenant and
from these VMs he will only VMs which are tagged with tag 'my_tag'.

Links

https://bugzilla.redhat.com/show_bug.cgi?id=1448994
#14095

@miq-bot add_label fine/yes
@miq-bot add_label euwe/yes
@miq-bot assign @gtanzillo

cc @kbrock

@miq-bot add_label bug, rbac, blocker

lpichler added 3 commits May 15, 2017 11:32
filtered_ids  = ids of items determined from filters like belongs to filter, managed filter, self_service user filter
tenant_filter_ids = additional filter based on tenant hiearchy (only for indirect rbac)

before:
there was a union for filtered_ids and tenant_filter
which was selected improperly because both
sets of ids are basically expressing limitation so there
have to find intersection.

example:

Tenant:
MyCompany->
     Tenant1 ->
       Tenant2

User is tight with group(with Tenant2) and role with
tag filter A

Vm1 Belongs to Tenant2 and is not tagged with any tag
Vm2 Belongs to Tenant2 and is tagged with tag A

the user have to see only VMs from his tenant and
from these VMs only which are tagged with tag A
————
this covers
when filtered_ids and tenant_filter_ids are not empty
when filtered_ids is not nil and tenant_filter_ids is nil
then return  filtered_ids

when filtered_ids is nil and tenant_filter_ids is nil
then return  nil
@lpichler lpichler changed the title Fix tag filtering for indirect RBAC [WIP] Fix tag filtering for indirect RBAC May 15, 2017
@miq-bot miq-bot added the wip label May 15, 2017
@miq-bot
Copy link
Member

miq-bot commented May 15, 2017

Checked commits lpichler/manageiq@7f18378~...e4a78ce with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 🏆

@lpichler lpichler changed the title [WIP] Fix tag filtering for indirect RBAC Fix tag filtering for indirect RBAC May 15, 2017
@miq-bot
Copy link
Member

miq-bot commented May 15, 2017

@lpichler unrecognized command 'remove', ignoring...

Accepted commands are: add_label, assign, close_issue, move_issue, remove_label, rm_label, set_milestone

@lpichler
Copy link
Contributor Author

@miq-bot remove_label wip

@miq-bot miq-bot removed the wip label May 15, 2017
Copy link
Member

@gtanzillo gtanzillo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good!

@gtanzillo gtanzillo added this to the Sprint 61 Ending May 22, 2017 milestone May 16, 2017
@gtanzillo gtanzillo merged commit 2facb0b into ManageIQ:master May 16, 2017
@lpichler lpichler deleted the fix_tag_filtering_for_indirect_rbac branch May 16, 2017 14:41
@lpichler
Copy link
Contributor Author

@simaishi

simaishi pushed a commit that referenced this pull request May 16, 2017
@simaishi
Copy link
Contributor

Fine backport details:

$ git log -1
commit 378e4a3526aeb7ad7d5f8fe02d1d94f10d81ca6e
Author: Gregg Tanzillo <[email protected]>
Date:   Tue May 16 09:51:14 2017 -0400

    Merge pull request #15088 from lpichler/fix_tag_filtering_for_indirect_rbac
    
    Fix tag filtering for indirect RBAC
    (cherry picked from commit 2facb0bcbc0e3e8176a585ce1ea8a8d325ebc46f)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1451395

simaishi pushed a commit that referenced this pull request May 16, 2017
@simaishi
Copy link
Contributor

Euwe backport details:

$ git log -1
commit 3d48d356e96f8b760e24ea81d1ee2c9da70d228c
Author: Gregg Tanzillo <[email protected]>
Date:   Tue May 16 09:51:14 2017 -0400

    Merge pull request #15088 from lpichler/fix_tag_filtering_for_indirect_rbac
    
    Fix tag filtering for indirect RBAC
    (cherry picked from commit 2facb0bcbc0e3e8176a585ce1ea8a8d325ebc46f)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1451396

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.

4 participants