mirror of https://github.com/apache/archiva.git
fix chaining of rbac manager to get userassignements
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1449113 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ac6dc59b94
commit
74f2b9475e
|
@ -700,17 +700,26 @@ public class ArchivaRbacManager
|
|||
{
|
||||
return el;
|
||||
}
|
||||
|
||||
UserAssignment ua = null;
|
||||
Exception lastException = null;
|
||||
for ( RBACManager rbacManager : rbacManagersPerId.values() )
|
||||
{
|
||||
try
|
||||
{
|
||||
UserAssignment ua = rbacManager.getUserAssignment( principal );
|
||||
if ( ua != null )
|
||||
if ( ua == null )
|
||||
{
|
||||
userAssignmentsCache.put( principal, ua );
|
||||
return ua;
|
||||
ua = rbacManager.getUserAssignment( principal );
|
||||
}
|
||||
else
|
||||
{
|
||||
UserAssignment userAssignment = rbacManager.getUserAssignment( principal );
|
||||
if ( userAssignment != null )
|
||||
{
|
||||
for ( String roleName : userAssignment.getRoleNames() )
|
||||
{
|
||||
ua.addRoleName( roleName );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( Exception e )
|
||||
|
@ -719,6 +728,12 @@ public class ArchivaRbacManager
|
|||
}
|
||||
}
|
||||
|
||||
if ( ua != null )
|
||||
{
|
||||
userAssignmentsCache.put( principal, ua );
|
||||
return ua;
|
||||
}
|
||||
|
||||
if ( lastException != null )
|
||||
{
|
||||
throw new RbacManagerException( lastException.getMessage(), lastException );
|
||||
|
@ -784,6 +799,14 @@ public class ArchivaRbacManager
|
|||
List<UserAssignment> userAssignments = rbacManager.getAllUserAssignments();
|
||||
for ( UserAssignment ua : userAssignments )
|
||||
{
|
||||
UserAssignment userAssignment = allUserAssignments.get( ua.getPrincipal() );
|
||||
if ( userAssignment != null )
|
||||
{
|
||||
for ( String roleName : ua.getRoleNames() )
|
||||
{
|
||||
userAssignment.addRoleName( roleName );
|
||||
}
|
||||
}
|
||||
allUserAssignments.put( ua.getPrincipal(), ua );
|
||||
}
|
||||
allFailed = false;
|
||||
|
|
Loading…
Reference in New Issue