sugar syntax...
Signed-off-by: olivier lamy <olamy@apache.org>
This commit is contained in:
parent
714f508973
commit
0ce53f4567
@ -195,11 +195,7 @@ public User logIn( LoginRequest loginRequest )
|
||||
{
|
||||
throw new RedbackServiceException( e.getMessage(), Response.Status.FORBIDDEN.getStatusCode() );
|
||||
}
|
||||
catch ( UserNotFoundException e )
|
||||
{
|
||||
throw new RedbackServiceException( e.getMessage() );
|
||||
}
|
||||
catch ( AccountLockedException e )
|
||||
catch ( UserNotFoundException | AccountLockedException e )
|
||||
{
|
||||
throw new RedbackServiceException( e.getMessage() );
|
||||
}
|
||||
|
@ -434,8 +434,7 @@ public Role getRole( String roleName )
|
||||
}
|
||||
}
|
||||
|
||||
List<org.apache.archiva.redback.rest.api.model.User> otherUsers =
|
||||
new ArrayList<org.apache.archiva.redback.rest.api.model.User>();
|
||||
List<org.apache.archiva.redback.rest.api.model.User> otherUsers = new ArrayList<>();
|
||||
for ( User u : userManager.getUsers() )
|
||||
{
|
||||
org.apache.archiva.redback.rest.api.model.User user =
|
||||
@ -455,11 +454,7 @@ public Role getRole( String roleName )
|
||||
|
||||
return role;
|
||||
}
|
||||
catch ( RbacManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( new ErrorMessage( e.getMessage() ) );
|
||||
}
|
||||
catch ( UserManagerException e )
|
||||
catch ( RbacManagerException | UserManagerException e )
|
||||
{
|
||||
throw new RedbackServiceException( new ErrorMessage( e.getMessage() ) );
|
||||
}
|
||||
@ -619,7 +614,7 @@ public List<ApplicationRoles> getApplicationRoles( String username )
|
||||
|
||||
List<ModelApplication> modelApplications = roleManager.getModel().getApplications();
|
||||
|
||||
List<ApplicationRoles> applicationRolesList = new ArrayList<ApplicationRoles>( modelApplications.size() );
|
||||
List<ApplicationRoles> applicationRolesList = new ArrayList<>( modelApplications.size() );
|
||||
|
||||
for ( ModelApplication modelApplication : modelApplications )
|
||||
{
|
||||
@ -631,7 +626,7 @@ public List<ApplicationRoles> getApplicationRoles( String username )
|
||||
Collection<? extends org.apache.archiva.redback.rbac.Role> appRoles =
|
||||
filterApplicationRoles( modelApplication, allRoles, modelApplication.getTemplates() );
|
||||
|
||||
List<String> roleNames = new ArrayList<String>( toRoleNames( appRoles ) );
|
||||
List<String> roleNames = new ArrayList<>( toRoleNames( appRoles ) );
|
||||
|
||||
Collections.sort( roleNames );
|
||||
|
||||
@ -645,7 +640,7 @@ public List<ApplicationRoles> getApplicationRoles( String username )
|
||||
|
||||
// cleanup app roles remove roles coming from templates
|
||||
|
||||
List<String> appRoleNames = new ArrayList<String>( appRoles.size() );
|
||||
List<String> appRoleNames = new ArrayList<>( appRoles.size() );
|
||||
|
||||
for ( String appRoleName : applicationRoles.getGlobalRoles() )
|
||||
{
|
||||
@ -766,8 +761,7 @@ private Collection<? extends org.apache.archiva.redback.rbac.Role> filterApplica
|
||||
List<? extends org.apache.archiva.redback.rbac.Role> allRoles,
|
||||
List<ModelTemplate> applicationTemplates )
|
||||
{
|
||||
Set<org.apache.archiva.redback.rbac.Role> applicationRoles =
|
||||
new HashSet<org.apache.archiva.redback.rbac.Role>();
|
||||
Set<org.apache.archiva.redback.rbac.Role> applicationRoles = new HashSet<>();
|
||||
List<ModelRole> roles = application.getRoles();
|
||||
|
||||
for ( ModelRole modelRole : roles )
|
||||
@ -812,7 +806,7 @@ private boolean roleFromTemplate( String roleName, List<ModelTemplate> applicati
|
||||
|
||||
private List<String> toRoleNames( Collection<? extends org.apache.archiva.redback.rbac.Role> roles )
|
||||
{
|
||||
List<String> names = new ArrayList<String>( roles.size() );
|
||||
List<String> names = new ArrayList<>( roles.size() );
|
||||
|
||||
for ( org.apache.archiva.redback.rbac.Role r : roles )
|
||||
{
|
||||
@ -826,7 +820,7 @@ private List<RoleTemplate> toRoleTemplates( List<ModelTemplate> modelTemplates )
|
||||
{
|
||||
if ( modelTemplates == null || modelTemplates.isEmpty() )
|
||||
{
|
||||
return new ArrayList<RoleTemplate>( 0 );
|
||||
return new ArrayList<>( 0 );
|
||||
}
|
||||
|
||||
List<RoleTemplate> roleTemplates = new ArrayList<RoleTemplate>( modelTemplates.size() );
|
||||
@ -849,7 +843,7 @@ private List<RoleTemplate> toRoleTemplates( List<ModelTemplate> modelTemplates )
|
||||
private Set<String> discoverResources( List<ModelTemplate> applicationTemplates,
|
||||
Collection<? extends org.apache.archiva.redback.rbac.Role> roles )
|
||||
{
|
||||
Set<String> resources = new HashSet<String>();
|
||||
Set<String> resources = new HashSet<>();
|
||||
for ( ModelTemplate modelTemplate : applicationTemplates )
|
||||
{
|
||||
for ( org.apache.archiva.redback.rbac.Role role : roles )
|
||||
@ -888,8 +882,7 @@ protected List<? extends org.apache.archiva.redback.rbac.Role> filterRolesForCur
|
||||
}
|
||||
String currentUser = redbackRequestInformation.getUser().getUsername();
|
||||
|
||||
List<org.apache.archiva.redback.rbac.Role> filteredRoleList =
|
||||
new ArrayList<org.apache.archiva.redback.rbac.Role>();
|
||||
List<org.apache.archiva.redback.rbac.Role> filteredRoleList = new ArrayList<>();
|
||||
try
|
||||
{
|
||||
Map<String, List<? extends Permission>> assignedPermissionMap = rbacManager.getAssignedPermissionMap( currentUser );
|
||||
|
Loading…
x
Reference in New Issue
Block a user