use a bulk update mode with passing a list of update

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1476986 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-04-29 12:21:03 +00:00
parent 88610b6e15
commit 3d0d471254
2 changed files with 27 additions and 22 deletions

View File

@ -21,6 +21,7 @@ package org.apache.archiva.redback.rest.api.services;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
import org.apache.archiva.redback.rest.api.model.LdapGroupMapping;
import org.apache.archiva.redback.rest.api.model.LdapGroupMappingUpdateRequest;
import org.apache.archiva.redback.rest.api.model.StringList;
import javax.ws.rs.Consumes;
@ -76,7 +77,7 @@ public interface LdapGroupMappingService
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@RedbackAuthorization(permissions = RedbackRoleConstants.CONFIGURATION_EDIT_OPERATION)
Boolean updateLdapGroupMapping( LdapGroupMapping ldapGroupMapping )
Boolean updateLdapGroupMapping( LdapGroupMappingUpdateRequest ldapGroupMappingUpdateRequest )
throws RedbackServiceException;
}

View File

@ -25,6 +25,7 @@ import org.apache.archiva.redback.common.ldap.connection.LdapException;
import org.apache.archiva.redback.common.ldap.role.LdapRoleMapper;
import org.apache.archiva.redback.common.ldap.role.LdapRoleMapperConfiguration;
import org.apache.archiva.redback.rest.api.model.LdapGroupMapping;
import org.apache.archiva.redback.rest.api.model.LdapGroupMappingUpdateRequest;
import org.apache.archiva.redback.rest.api.model.StringList;
import org.apache.archiva.redback.rest.api.services.LdapGroupMappingService;
import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
@ -146,14 +147,17 @@ public class DefaultLdapGroupMappingService
return Boolean.TRUE;
}
public Boolean updateLdapGroupMapping( LdapGroupMapping ldapGroupMapping )
public Boolean updateLdapGroupMapping( LdapGroupMappingUpdateRequest ldapGroupMappingUpdateRequest )
throws RedbackServiceException
{
try
{
for ( LdapGroupMapping ldapGroupMapping : ldapGroupMappingUpdateRequest.getLdapGroupMapping() )
{
ldapRoleMapperConfiguration.updateLdapMapping( ldapGroupMapping.getGroup(),
new ArrayList( ldapGroupMapping.getRoleNames() ) );
}
}
catch ( MappingException e )
{
log.error( e.getMessage(), e );