aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2020-11-26 22:21:03 +0100
committerMartin Stockhammer <martin_s@apache.org>2020-11-26 22:21:03 +0100
commit2f4b1d241950261ce635d84f04ed45132e88e2ba (patch)
tree9cc4ab2feb6f15e508b0b113cca90a0448a36cbc /archiva-modules/archiva-web
parenta2442befca1e7b9c9f81cc434d86cf7b7ed8cd41 (diff)
downloadarchiva-2f4b1d241950261ce635d84f04ed45132e88e2ba.tar.gz
archiva-2f4b1d241950261ce635d84f04ed45132e88e2ba.zip
Adding id methods for roles
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java2
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaLockedAdminEnvironmentCheck.java2
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java12
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java4
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java6
5 files changed, 14 insertions, 12 deletions
diff --git a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
index 6487e9d23..d877c69f1 100644
--- a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
+++ b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
@@ -170,7 +170,7 @@ public abstract class AbstractSecurityTest
log.info( "ignore RbacObjectNotFoundException for id {} during restoreGuestInitialValues", userId );
return;
}
- userAssignment.setRoleNames( new ArrayList( Arrays.asList( "Guest" ) ) );
+ userAssignment.setRoleIds( new ArrayList( Arrays.asList( "guest" ) ) );
rbacManager.saveUserAssignment( userAssignment );
CacheManager.getInstance().clearAll();
}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaLockedAdminEnvironmentCheck.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaLockedAdminEnvironmentCheck.java
index 86f27fcf1..b30e28ed1 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaLockedAdminEnvironmentCheck.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaLockedAdminEnvironmentCheck.java
@@ -112,7 +112,7 @@ public class ArchivaLockedAdminEnvironmentCheck
continue;
}
List<String> roles = new ArrayList<>();
- roles.add( RedbackRoleConstants.SYSTEM_ADMINISTRATOR_ROLE );
+ roles.add( RedbackRoleConstants.SYSTEM_ADMINISTRATOR_ROLE_ID );
List<? extends UserAssignment> systemAdminstrators;
try
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java
index d0995b735..4884882eb 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java
@@ -812,9 +812,9 @@ public class ArchivaRbacManager
UserAssignment userAssignment = rbacManager.getUserAssignment( principal );
if ( userAssignment != null )
{
- for ( String roleName : userAssignment.getRoleNames() )
+ for ( String roleId : userAssignment.getRoleIds() )
{
- ua.addRoleName( roleName );
+ ua.addRoleId( roleId );
}
}
}
@@ -900,9 +900,9 @@ public class ArchivaRbacManager
UserAssignment userAssignment = allUserAssignments.get( ua.getPrincipal() );
if ( userAssignment != null )
{
- for ( String roleName : ua.getRoleNames() )
+ for ( String roleId : ua.getRoleIds() )
{
- userAssignment.addRoleName( roleName );
+ userAssignment.addRoleId( roleId );
}
}
allUserAssignments.put( ua.getPrincipal(), ua );
@@ -923,7 +923,7 @@ public class ArchivaRbacManager
}
@Override
- public List<UserAssignment> getUserAssignmentsForRoles( Collection<String> roleNames )
+ public List<UserAssignment> getUserAssignmentsForRoles( Collection<String> roleIds )
throws RbacManagerException
{
List<UserAssignment> allUserAssignments = new ArrayList<>();
@@ -933,7 +933,7 @@ public class ArchivaRbacManager
{
try
{
- List<? extends UserAssignment> userAssignments = rbacManager.getUserAssignmentsForRoles( roleNames );
+ List<? extends UserAssignment> userAssignments = rbacManager.getUserAssignmentsForRoles( roleIds );
allUserAssignments.addAll( userAssignments );
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java
index 7b487803b..dc0d2e882 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java
@@ -244,12 +244,12 @@ public class SecuritySynchronization
ua = rbacManager.createUserAssignment( principal );
}
- ua.addRoleName( ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) );
+ ua.addRoleId( ArchivaRoleConstants.toRepositoryObserverRoleId( repoId ) );
rbacManager.saveUserAssignment( ua );
}
catch ( RbacManagerException e )
{
- log.warn( "Unable to add role [{}] to {} user.", ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ), principal, e );
+ log.warn( "Unable to add role [{}] to {} user.", ArchivaRoleConstants.toRepositoryObserverRoleId( repoId ), principal, e );
}
}
}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java
index 442f21d37..b1a32a24a 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java
@@ -47,10 +47,11 @@ public class RoleManagerStub
}
@Override
- public void createTemplatedRole( String templateId, String resource )
+ public String createTemplatedRole( String templateId, String resource )
throws RoleManagerException
{
//To change body of implemented methods use File | Settings | File Templates.
+ return null;
}
@Override
@@ -61,10 +62,11 @@ public class RoleManagerStub
}
@Override
- public void moveTemplatedRole( String templateId, String oldResource, String newResource )
+ public String moveTemplatedRole( String templateId, String oldResource, String newResource )
throws RoleManagerException
{
//To change body of implemented methods use File | Settings | File Templates.
+ return null;
}
@Override