mirror of https://github.com/apache/archiva.git
verify roles for repository are configured on startup
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1471410 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3c082f7e58
commit
a63168fbbc
|
@ -109,7 +109,7 @@ public class DefaultManagedRepositoryAdmin
|
|||
|
||||
@PostConstruct
|
||||
public void initialize()
|
||||
throws RepositoryAdminException
|
||||
throws RepositoryAdminException, RoleManagerException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -120,10 +120,12 @@ public class DefaultManagedRepositoryAdmin
|
|||
{
|
||||
throw new RepositoryAdminException( e.getMessage(), e );
|
||||
}
|
||||
// initialize index context on start
|
||||
// initialize index context on start and check roles here
|
||||
for ( ManagedRepository managedRepository : getManagedRepositories() )
|
||||
{
|
||||
createIndexContext( managedRepository );
|
||||
addRepositoryRoles( managedRepository.getId() );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,13 +266,13 @@ public class DefaultManagedRepositoryAdmin
|
|||
try
|
||||
{
|
||||
addRepository( repository, config );
|
||||
addRepositoryRoles( repository );
|
||||
addRepositoryRoles( repository.getId() );
|
||||
|
||||
if ( stageRepoNeeded )
|
||||
{
|
||||
ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
|
||||
addRepository( stagingRepository, config );
|
||||
addRepositoryRoles( stagingRepository );
|
||||
addRepositoryRoles( stagingRepository.getId() );
|
||||
triggerAuditEvent( stagingRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
|
||||
}
|
||||
}
|
||||
|
@ -727,7 +729,8 @@ public class DefaultManagedRepositoryAdmin
|
|||
return true;
|
||||
}
|
||||
|
||||
protected void addRepositoryRoles( ManagedRepositoryConfiguration newRepository )
|
||||
|
||||
public void addRepositoryRoles( ManagedRepository newRepository )
|
||||
throws RoleManagerException
|
||||
{
|
||||
String repoId = newRepository.getId();
|
||||
|
@ -746,6 +749,24 @@ public class DefaultManagedRepositoryAdmin
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void addRepositoryRoles( String repoId )
|
||||
throws RoleManagerException
|
||||
{
|
||||
// TODO: double check these are configured on start up
|
||||
// TODO: belongs in the business logic
|
||||
|
||||
if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
|
||||
{
|
||||
getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
|
||||
}
|
||||
|
||||
if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
|
||||
{
|
||||
getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
|
||||
}
|
||||
}
|
||||
|
||||
protected void removeRepositoryRoles( ManagedRepositoryConfiguration existingRepository )
|
||||
throws RoleManagerException
|
||||
{
|
||||
|
|
|
@ -179,6 +179,8 @@ public class DefaultRedbackRuntimeConfigurationService
|
|||
|
||||
ldapUserMapper.initialize();
|
||||
|
||||
//check repositories roles are here !!!
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
catch ( Exception e )
|
||||
|
|
Loading…
Reference in New Issue