mirror of https://github.com/apache/archiva.git
[MRM-1612] reduce number of security checks for a configuration change to avoid
blocking when the number of repositories gets large git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295553 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
630ae74fc1
commit
fa3688a693
|
@ -100,9 +100,12 @@ public class SecuritySynchronization
|
||||||
|
|
||||||
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
|
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
|
||||||
{
|
{
|
||||||
if ( ConfigurationNames.isManagedRepositories( propertyName ) )
|
if ( ConfigurationNames.isManagedRepositories( propertyName ) && propertyName.endsWith( ".id" ) )
|
||||||
{
|
{
|
||||||
synchConfiguration( archivaConfiguration.getConfiguration().getManagedRepositories() );
|
if ( propertyValue != null )
|
||||||
|
{
|
||||||
|
syncRepoConfiguration( (String) propertyValue );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,32 +119,32 @@ public class SecuritySynchronization
|
||||||
// NOTE: Remote Repositories do not have roles or security placed around them.
|
// NOTE: Remote Repositories do not have roles or security placed around them.
|
||||||
|
|
||||||
for ( ManagedRepositoryConfiguration repoConfig : repos )
|
for ( ManagedRepositoryConfiguration repoConfig : repos )
|
||||||
|
{
|
||||||
|
syncRepoConfiguration( repoConfig.getId() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncRepoConfiguration( String id )
|
||||||
{
|
{
|
||||||
// manage roles for repositories
|
// manage roles for repositories
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
|
if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, id ) )
|
||||||
repoConfig.getId() ) )
|
|
||||||
{
|
{
|
||||||
roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
|
roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, id );
|
||||||
repoConfig.getId() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
|
roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, id );
|
||||||
repoConfig.getId() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
|
if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, id ) )
|
||||||
repoConfig.getId() ) )
|
|
||||||
{
|
{
|
||||||
roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
|
roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, id );
|
||||||
repoConfig.getId() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
|
roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, id );
|
||||||
repoConfig.getId() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( RoleManagerException e )
|
catch ( RoleManagerException e )
|
||||||
|
@ -150,7 +153,6 @@ public class SecuritySynchronization
|
||||||
log.error( "Unable to create roles for configured repositories: " + e.getMessage(), e );
|
log.error( "Unable to create roles for configured repositories: " + e.getMessage(), e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void startup()
|
public void startup()
|
||||||
throws ArchivaException
|
throws ArchivaException
|
||||||
|
|
Loading…
Reference in New Issue