mirror of https://github.com/apache/archiva.git
[MRM-1133] delete artifact role not added on upgrade from previous version
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755486 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fc374c71b8
commit
e000da9c29
|
@ -196,8 +196,7 @@
|
||||||
<id>archiva-delete-artifact</id>
|
<id>archiva-delete-artifact</id>
|
||||||
<name>Delete Artifact</name>
|
<name>Delete Artifact</name>
|
||||||
<operation>archiva-delete-artifact</operation>
|
<operation>archiva-delete-artifact</operation>
|
||||||
<resource>global</resource>
|
<resource>${resource}</resource>
|
||||||
<permanent>true</permanent>
|
|
||||||
</permission>
|
</permission>
|
||||||
<permission>
|
<permission>
|
||||||
<id>archiva-edit-repository</id>
|
<id>archiva-edit-repository</id>
|
||||||
|
|
|
@ -54,7 +54,10 @@ import org.apache.maven.archiva.repository.RepositoryException;
|
||||||
import org.apache.maven.archiva.repository.RepositoryNotFoundException;
|
import org.apache.maven.archiva.repository.RepositoryNotFoundException;
|
||||||
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
|
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
|
||||||
import org.apache.maven.archiva.repository.RepositoryContentFactory;
|
import org.apache.maven.archiva.repository.RepositoryContentFactory;
|
||||||
|
import org.apache.maven.archiva.security.AccessDeniedException;
|
||||||
|
import org.apache.maven.archiva.security.ArchivaSecurityException;
|
||||||
import org.apache.maven.archiva.security.ArchivaXworkUser;
|
import org.apache.maven.archiva.security.ArchivaXworkUser;
|
||||||
|
import org.apache.maven.archiva.security.PrincipalNotFoundException;
|
||||||
import org.apache.maven.archiva.security.UserRepositories;
|
import org.apache.maven.archiva.security.UserRepositories;
|
||||||
import org.codehaus.plexus.redback.rbac.RbacManagerException;
|
import org.codehaus.plexus.redback.rbac.RbacManagerException;
|
||||||
|
|
||||||
|
@ -186,7 +189,7 @@ public class DeleteArtifactAction
|
||||||
|
|
||||||
public void prepare()
|
public void prepare()
|
||||||
{
|
{
|
||||||
managedRepos = new ArrayList<String>( configuration.getConfiguration().getManagedRepositoriesAsMap().keySet() );
|
managedRepos = getManagableRepos();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String input()
|
public String input()
|
||||||
|
@ -412,6 +415,28 @@ public class DeleteArtifactAction
|
||||||
this.auditListeners.remove( listener );
|
this.auditListeners.remove( listener );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<String> getManagableRepos()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return userRepositories.getManagableRepositoryIds( getPrincipal() );
|
||||||
|
}
|
||||||
|
catch ( PrincipalNotFoundException e )
|
||||||
|
{
|
||||||
|
log.warn( e.getMessage(), e );
|
||||||
|
}
|
||||||
|
catch ( AccessDeniedException e )
|
||||||
|
{
|
||||||
|
log.warn( e.getMessage(), e );
|
||||||
|
// TODO: pass this onto the screen.
|
||||||
|
}
|
||||||
|
catch ( ArchivaSecurityException e )
|
||||||
|
{
|
||||||
|
log.warn( e.getMessage(), e );
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
private void triggerAuditEvent( String user, String repositoryId, String resource, String action )
|
private void triggerAuditEvent( String user, String repositoryId, String resource, String action )
|
||||||
{
|
{
|
||||||
AuditEvent event = new AuditEvent( repositoryId, user, resource, action );
|
AuditEvent event = new AuditEvent( repositoryId, user, resource, action );
|
||||||
|
|
|
@ -102,6 +102,11 @@ public class SecuritySynchronization
|
||||||
roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
|
roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
|
||||||
repoConfig.getId() );
|
repoConfig.getId() );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
|
||||||
|
repoConfig.getId() );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
|
if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
|
||||||
repoConfig.getId() ) )
|
repoConfig.getId() ) )
|
||||||
|
@ -109,6 +114,11 @@ public class SecuritySynchronization
|
||||||
roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
|
roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
|
||||||
repoConfig.getId() );
|
repoConfig.getId() );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
|
||||||
|
repoConfig.getId() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch ( RoleManagerException e )
|
catch ( RoleManagerException e )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue