Bug 749538

Summary: When two roles with the same resource group are assigned to the user, the list of all resources is not distinct - contains duplicated resources
Product: [Other] RHQ Project Reporter: bkramer <bkramer>
Component: Core ServerAssignee: Ian Springer <ian.springer>
Status: CLOSED NEXTRELEASE QA Contact: Mike Foley <mfoley>
Severity: low Docs Contact:
Priority: high    
Version: 3.0.1CC: ccrouch, hrupp, loleary
Target Milestone: ---   
Target Release: RHQ 4.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-02 15:59:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 782579    

Description bkramer 2011-10-27 11:57:55 UTC
Description of problem:
Two roles have been assigned to the user. The same resource group is assigned to both roles. When new user log in and select Resources -> All Resources, resulted table will contain duplicated resources. At the same time resource number will be correct. The same happens when select Groups -> All Groups.


Version-Release number of selected component (if applicable):
JON 2.4.1

How reproducible:
every time

Steps to Reproduce:
1. Create a non-recursive group (for instance dynamic group that contains all platforms);
2. Create a new user;
3. Create two new roles (for instance JON-Admin:Administer JON Server settings true and Developer-Read:Subsystem Permissions -> Configure set to true)   and assign to each of them newly created user and newly created group.
4. Log out and log in again using user name and password for that is given to the new user;
5) Select Resources -> All Resources
  
Actual results:
Resulted table contains duplicated number of resources;

Expected results:
Resulted table contains correct number of resources

Additional info:
The same happens if the user select Groups -> All Groups. At the same time, the number of the resources (groups) is correct.

Comment 1 Charles Crouch 2011-10-31 16:07:50 UTC
Is the workaround to use two distinct groups (but with the same members) when 
creating the roles?

Comment 2 bkramer 2011-11-02 08:49:53 UTC
(In reply to comment #1)
> Is the workaround to use two distinct groups (but with the same members) when 
> creating the roles?

That fixes the "All Group" page - as the number of the groups is 2 and it does show 2 groups. But the page "All Resources" still shows duplicated resources.

Comment 3 Ian Springer 2012-02-02 15:43:35 UTC
I have reproduced this on JON 2.4.2. However, I was *not* able to reproduce it with JON 3.0.1-SNAPSHOT or RHQ 4.3.0-SNAPSHOT, so it appears to be fixed in more current branches.

Comment 4 Ian Springer 2012-02-02 15:51:47 UTC
In JON 2.4.2, I also see the duplicate Resources when using the CLI:

tester@localhost:7080$ ResourceManager.findResourcesByCriteria(new ResourceCriteria())
id    name  version   currentAvailability resourceType
-------------------------------------------------------------------------------------------------------------------------------------------
10016 CPU 0 Pentium 4 UP                  CPU         
10016 CPU 0 Pentium 4 UP                  CPU         
2 rows


This tells me the bug is in the Server (probably either an SLSB or the criteria engine), and not in the GUI.

Note, I do *not* see duplicate Resources in the CLI with JON 3.0.1-SNAPSHOT or RHQ 4.3.0-SNAPSHOT.

Comment 5 Charles Crouch 2012-02-02 15:59:09 UTC
Given Ian's comments this will definitely be fixed in JON3.0.1 and I would expect it to be fixed in JON3.0.0 too