Bug 996177 - Errors in server log after unassigning and reassigning again the same LDAP group in role assignment UI
Summary: Errors in server log after unassigning and reassigning again the same LDAP gr...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: UI
Version: JON 3.2
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER03
: JON 3.2.0
Assignee: Heiko W. Rupp
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-12 15:09 UTC by Sunil Kondkar
Modified: 2014-01-02 20:35 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-01-02 20:35:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Screenshot-UI_Warning (108.59 KB, image/png)
2013-08-12 15:11 UTC, Sunil Kondkar
no flags Details
Server_log (52.50 KB, text/plain)
2013-08-12 15:11 UTC, Sunil Kondkar
no flags Details

Description Sunil Kondkar 2013-08-12 15:09:27 UTC
Description of problem:

Configured the LDAP configuration properties and navigated to role assignment UI. Assigned one LDAP group to the role and saved it. 

Again edited the role and unassigned the ldap group from the role, searched for the same ldap group and reassigned again to the role. 

After clicking save button, the UI displays warning 'Server returned FAILURE with no error message.' The server log displays BatchUpdateException.

Please find attached the UI warning message and server log errors.

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

JBoss ON Version: 3.2.0.ALPHA_QA
Build Number: 1878d58:5e6b489
Postgres 8.3.8

How reproducible:

Always

Steps to Reproduce:

1. Configure the LDAP configuration properties in Administration->System Settings->LDAP Configuration Properties
2. Navigate to Administration->Roles
3. Create a role in Jboss ON and assign a LDAP group ( Ex: testgroup1 ) to the role and save.
4. Click on the role created above to edit.
5. Navigate to 'LDAP Groups' tab.
6. Unassign the LDAP group ( Ex: testgroup1 )
7. Search for the same LDAP group on the role assignment UI ( Ex: testgroup1 - If this step is not performed, the bug will not be reproducible)

8. Assign the same LDAP group again to the JBoss ON role after search.
9. Click on 'Save' button.
10. The JBoss ON UI shows the warning 'Server returned FAILURE with no error message.
11. The server log displays errors.

Actual results:

UI has a warning message and server log has errors

Expected results:

No errors in UI and server log.

Additional info:

1. If unassign a LDAP group and assign another LDAP group..no errors
2. If unassign a LDAP group and without doing a search, if the same LDAP group is assigned again, no errors
3. Reproducible with less than 10 LDAP groups - not an performance related bug. 
4. Reproducible on Windows 2003 AD server and Redhat Directory server 8.2.0

Comment 1 Sunil Kondkar 2013-08-12 15:11:00 UTC
Created attachment 785749 [details]
Screenshot-UI_Warning

Comment 2 Sunil Kondkar 2013-08-12 15:11:29 UTC
Created attachment 785751 [details]
Server_log

Comment 3 Heiko W. Rupp 2013-09-25 12:08:22 UTC
20:24:44,556 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/0.0.0.0:7080-2) SQL Error: 0, SQLState: 23505
20:24:44,556 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/0.0.0.0:7080-2) Batch entry 0 insert into RHQ_ROLE_LDAP_GROUP (LDAP_GROUP_NAME, ROLE_ID, ID) values ('sunilgroupad', 10001, 10011) was aborted.  Call getNextException to see the cause.
20:24:44,556 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/0.0.0.0:7080-2) SQL Error: 0, SQLState: 23505
20:24:44,556 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/0.0.0.0:7080-2) ERROR: duplicate key value violates unique constraint "rhq_role_ldap_group_idx"

20:24:44,578 ERROR [org.jboss.as.ejb3.invocation] (http-/0.0.0.0:7080-2) JBAS014134: EJB Invocation failed on component RoleManagerBean for method public abstract org.rhq.core.domain.authz.Role org.rhq.enterprise.server.authz.RoleManagerLocal.updateRole(org.rhq.core.domain.auth.Subject,org.rhq.core.domain.authz.Role): 


/org/rhq/enterprise/server/authz/RoleManagerBean.java:468


            for (LdapGroup ldapGroup : currentLdapGroups) {
                if (!newLdapGroups.contains(ldapGroup)) {
                    attachedRole.removeLdapGroup(ldapGroup);
                    entityManager.remove(ldapGroup);
                }

the contains() succeeds and thus the if (!contains()) fails and the block is not removing the old association. Then in the next block that group-role is attached again, but fails, as a group with that name still exits.

Comment 4 Heiko W. Rupp 2013-09-25 12:09:37 UTC
master 8e3e7bbe8ac0d

Comment 5 Simeon Pinder 2013-10-08 07:41:16 UTC
Moving to ON_QA for testing.

Comment 6 Sunil Kondkar 2013-10-11 11:17:29 UTC
Verified on Version: 3.2.0.ER3 Build Number: c0742ed:cbad264

Followed the steps and verified that there are no errors in UI and server log after unassigning and reassigning again the same LDAP group in role assignment UI.


Note You need to log in before you can comment on or make changes to this bug.