use last modello 1.6 for redback-rbac-role-manager to be use 1.5
jpox part has been removed from modello plugin so not possible .... git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1415426 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0f75dfab50
commit
cd099ede58
|
@ -102,6 +102,7 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.modello</groupId>
|
||||
<artifactId>modello-maven-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
@ -111,7 +112,10 @@
|
|||
<goal>stax-writer</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<model>src/main/mdo/redback-role-profiles.mdo</model>
|
||||
<useJava5>true</useJava5>
|
||||
<models>
|
||||
<model>src/main/mdo/redback-role-profiles.mdo</model>
|
||||
</models>
|
||||
<version>1.0.0</version>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
@ -112,11 +112,11 @@ public class DefaultRoleManager
|
|||
|
||||
RedbackRoleModel roleModel = reader.read( inputStreamReader );
|
||||
|
||||
for ( ModelApplication app : (List<ModelApplication>) roleModel.getApplications() )
|
||||
for ( ModelApplication app : roleModel.getApplications() )
|
||||
{
|
||||
if ( !knownResources.containsKey( app.getId() ) )
|
||||
{
|
||||
log.info( "loading " + app.getId() );
|
||||
log.info( "loading {}", app.getId() );
|
||||
loadApplication( app );
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public class DefaultRoleManager
|
|||
public void loadRoleModel( RedbackRoleModel roleModel )
|
||||
throws RoleManagerException
|
||||
{
|
||||
for ( ModelApplication app : (List<ModelApplication>) roleModel.getApplications() )
|
||||
for ( ModelApplication app : roleModel.getApplications() )
|
||||
{
|
||||
if ( !knownResources.containsKey( app.getId() ) )
|
||||
{
|
||||
|
|
|
@ -80,9 +80,9 @@ public class DefaultRoleModelProcessor
|
|||
private void processResources( RedbackRoleModel model )
|
||||
throws RoleManagerException
|
||||
{
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelResource profileResource : (List<ModelResource>) application.getResources() )
|
||||
for ( ModelResource profileResource : application.getResources() )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -115,9 +115,9 @@ public class DefaultRoleModelProcessor
|
|||
private void processOperations( RedbackRoleModel model )
|
||||
throws RoleManagerException
|
||||
{
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelOperation profileOperation : (List<ModelOperation>) application.getOperations() )
|
||||
for ( ModelOperation profileOperation : application.getOperations() )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -65,9 +65,9 @@ public class DefaultRoleTemplateProcessor
|
|||
public void create( RedbackRoleModel model, String templateId, String resource )
|
||||
throws RoleManagerException
|
||||
{
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelTemplate template : (List<ModelTemplate>) application.getTemplates() )
|
||||
for ( ModelTemplate template : application.getTemplates() )
|
||||
{
|
||||
if ( templateId.equals( template.getId() ) )
|
||||
{
|
||||
|
@ -89,9 +89,9 @@ public class DefaultRoleTemplateProcessor
|
|||
public void remove( RedbackRoleModel model, String templateId, String resource )
|
||||
throws RoleManagerException
|
||||
{
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelTemplate template : (List<ModelTemplate>) application.getTemplates() )
|
||||
for ( ModelTemplate template : application.getTemplates() )
|
||||
{
|
||||
if ( templateId.equals( template.getId() ) )
|
||||
{
|
||||
|
|
|
@ -42,12 +42,12 @@ import java.util.List;
|
|||
public class RoleModelUtils
|
||||
{
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
|
||||
public static List<ModelRole> getRoles( RedbackRoleModel model )
|
||||
{
|
||||
List<ModelRole> roleList = new ArrayList<ModelRole>( );
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
roleList.addAll( application.getRoles() );
|
||||
}
|
||||
|
@ -55,12 +55,11 @@ public class RoleModelUtils
|
|||
return roleList;
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public static List<ModelTemplate> getTemplates( RedbackRoleModel model )
|
||||
{
|
||||
List<ModelTemplate> templateList = new ArrayList<ModelTemplate>();
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
templateList.addAll( application.getTemplates() );
|
||||
}
|
||||
|
@ -73,9 +72,9 @@ public class RoleModelUtils
|
|||
{
|
||||
List<String> operationsIdList = new ArrayList<String>();
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelOperation operation : (List<ModelOperation>) application.getOperations() )
|
||||
for ( ModelOperation operation : application.getOperations() )
|
||||
{
|
||||
operationsIdList.add( operation.getId() );
|
||||
}
|
||||
|
@ -89,9 +88,9 @@ public class RoleModelUtils
|
|||
{
|
||||
List<String> resourceIdList = new ArrayList<String>();
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelResource resource : (List<ModelResource>) application.getResources() )
|
||||
for ( ModelResource resource : application.getResources() )
|
||||
{
|
||||
resourceIdList.add( resource.getId() );
|
||||
}
|
||||
|
@ -100,14 +99,13 @@ public class RoleModelUtils
|
|||
return resourceIdList;
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public static List<String> getRoleIdList( RedbackRoleModel model )
|
||||
{
|
||||
List<String> roleIdList = new ArrayList<String>();
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelRole role : (List<ModelRole>) application.getRoles() )
|
||||
for ( ModelRole role : application.getRoles() )
|
||||
{
|
||||
roleIdList.add( role.getId() );
|
||||
}
|
||||
|
@ -116,14 +114,14 @@ public class RoleModelUtils
|
|||
return roleIdList;
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
|
||||
public static List<String> getTemplateIdList( RedbackRoleModel model )
|
||||
{
|
||||
List<String> templateIdList = new ArrayList<String>();
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelTemplate template : (List<ModelTemplate>) application.getTemplates() )
|
||||
for ( ModelTemplate template : application.getTemplates() )
|
||||
{
|
||||
templateIdList.add( template.getId() );
|
||||
}
|
||||
|
@ -145,9 +143,9 @@ public class RoleModelUtils
|
|||
{
|
||||
ModelRole mrole = null;
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelRole role : (List<ModelRole>) application.getRoles() )
|
||||
for ( ModelRole role : application.getRoles() )
|
||||
{
|
||||
if ( roleId.equals( role.getId() ) )
|
||||
{
|
||||
|
@ -171,9 +169,9 @@ public class RoleModelUtils
|
|||
{
|
||||
ModelTemplate mtemplate = null;
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelTemplate template : (List<ModelTemplate>) application.getTemplates() )
|
||||
for ( ModelTemplate template : application.getTemplates() )
|
||||
{
|
||||
if ( templateId.equals( template.getId() ) )
|
||||
{
|
||||
|
@ -197,9 +195,9 @@ public class RoleModelUtils
|
|||
{
|
||||
ModelOperation moperation = null;
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelOperation operation : (List<ModelOperation>) application.getOperations() )
|
||||
for ( ModelOperation operation : application.getOperations() )
|
||||
{
|
||||
if ( operationId.equals( operation.getId() ) )
|
||||
{
|
||||
|
@ -216,9 +214,9 @@ public class RoleModelUtils
|
|||
{
|
||||
ModelResource mresource = null;
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelResource resource : (List<ModelResource>) application.getResources() )
|
||||
for ( ModelResource resource : application.getResources() )
|
||||
{
|
||||
if ( resourceId.equals( resource.getId() ) )
|
||||
{
|
||||
|
@ -236,15 +234,15 @@ public class RoleModelUtils
|
|||
{
|
||||
DAG roleGraph = new DAG();
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelRole role : (List<ModelRole>) application.getRoles() )
|
||||
for ( ModelRole role : application.getRoles() )
|
||||
{
|
||||
roleGraph.addVertex( role.getId() );
|
||||
|
||||
if ( role.getChildRoles() != null )
|
||||
{
|
||||
for ( String childRole : (List<String>) role.getChildRoles() )
|
||||
for ( String childRole : role.getChildRoles() )
|
||||
{
|
||||
roleGraph.addVertex( childRole );
|
||||
|
||||
|
@ -254,7 +252,7 @@ public class RoleModelUtils
|
|||
|
||||
if ( role.getParentRoles() != null )
|
||||
{
|
||||
for ( String parentRole : (List<String>) role.getParentRoles() )
|
||||
for ( String parentRole : role.getParentRoles() )
|
||||
{
|
||||
roleGraph.addVertex( parentRole );
|
||||
|
||||
|
@ -273,15 +271,15 @@ public class RoleModelUtils
|
|||
{
|
||||
DAG templateGraph = generateRoleGraph( model );
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelTemplate template : (List<ModelTemplate>) application.getTemplates() )
|
||||
for ( ModelTemplate template : application.getTemplates() )
|
||||
{
|
||||
templateGraph.addVertex( template.getId() );
|
||||
|
||||
if ( template.getChildRoles() != null )
|
||||
{
|
||||
for ( String childRole : (List<String>) template.getChildRoles() )
|
||||
for ( String childRole : template.getChildRoles() )
|
||||
{
|
||||
templateGraph.addVertex( childRole );
|
||||
|
||||
|
@ -291,7 +289,7 @@ public class RoleModelUtils
|
|||
|
||||
if ( template.getParentRoles() != null )
|
||||
{
|
||||
for ( String parentRole : (List<String>) template.getParentRoles() )
|
||||
for ( String parentRole : template.getParentRoles() )
|
||||
{
|
||||
templateGraph.addVertex( parentRole );
|
||||
|
||||
|
@ -301,7 +299,7 @@ public class RoleModelUtils
|
|||
|
||||
if ( template.getChildTemplates() != null )
|
||||
{
|
||||
for ( String childTemplate : (List<String>) template.getChildTemplates() )
|
||||
for ( String childTemplate : template.getChildTemplates() )
|
||||
{
|
||||
templateGraph.addVertex( childTemplate );
|
||||
|
||||
|
@ -311,7 +309,7 @@ public class RoleModelUtils
|
|||
|
||||
if ( template.getParentTemplates() != null )
|
||||
{
|
||||
for ( String parentTemplate : (List<String>) template.getParentTemplates() )
|
||||
for ( String parentTemplate : template.getParentTemplates() )
|
||||
{
|
||||
templateGraph.addVertex( parentTemplate );
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ public class DefaultRoleModelValidator
|
|||
{
|
||||
// validate model has name
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
if ( application.getId() == null )
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ public class DefaultRoleModelValidator
|
|||
}
|
||||
|
||||
// validate resource bits
|
||||
for ( ModelResource resource : (List<ModelResource>) application.getResources() )
|
||||
for ( ModelResource resource : application.getResources() )
|
||||
{
|
||||
if ( resource.getName() == null )
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ public class DefaultRoleModelValidator
|
|||
}
|
||||
|
||||
// validate the operations
|
||||
for ( ModelOperation operation : (List<ModelOperation>) application.getOperations() )
|
||||
for ( ModelOperation operation : application.getOperations() )
|
||||
{
|
||||
if ( operation.getName() == null )
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ public class DefaultRoleModelValidator
|
|||
}
|
||||
}
|
||||
|
||||
for ( ModelRole role : (List<ModelRole>) application.getRoles() )
|
||||
for ( ModelRole role : application.getRoles() )
|
||||
{
|
||||
if ( role.getId() == null )
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ public class DefaultRoleModelValidator
|
|||
|
||||
if ( role.getPermissions() != null )
|
||||
{
|
||||
for ( ModelPermission permission : (List<ModelPermission>) role.getPermissions() )
|
||||
for ( ModelPermission permission : role.getPermissions() )
|
||||
{
|
||||
if ( permission.getName() == null )
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ public class DefaultRoleModelValidator
|
|||
}
|
||||
}
|
||||
|
||||
for ( ModelTemplate template : (List<ModelTemplate>) application.getTemplates() )
|
||||
for ( ModelTemplate template : application.getTemplates() )
|
||||
{
|
||||
if ( template.getId() == null )
|
||||
{
|
||||
|
@ -190,7 +190,7 @@ public class DefaultRoleModelValidator
|
|||
|
||||
if ( template.getPermissions() != null )
|
||||
{
|
||||
for ( ModelPermission permission : (List<ModelPermission>) template.getPermissions() )
|
||||
for ( ModelPermission permission : template.getPermissions() )
|
||||
{
|
||||
if ( permission.getName() == null )
|
||||
{
|
||||
|
@ -222,19 +222,18 @@ public class DefaultRoleModelValidator
|
|||
*
|
||||
* @param model
|
||||
*/
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private void validateOperationClosure( RedbackRoleModel model )
|
||||
{
|
||||
List<String> operationIdList = RoleModelUtils.getOperationIdList( model );
|
||||
|
||||
// check the operations in role permissions
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelRole role : (List<ModelRole>) application.getRoles() )
|
||||
for ( ModelRole role : application.getRoles() )
|
||||
{
|
||||
if ( role.getPermissions() != null )
|
||||
{
|
||||
for ( ModelPermission permission : (List<ModelPermission>) role.getPermissions() )
|
||||
for ( ModelPermission permission : role.getPermissions() )
|
||||
{
|
||||
if ( !operationIdList.contains( permission.getOperation() ) )
|
||||
{
|
||||
|
@ -246,11 +245,11 @@ public class DefaultRoleModelValidator
|
|||
}
|
||||
|
||||
// check the operations in template permissions
|
||||
for ( ModelTemplate template : (List<ModelTemplate>) application.getTemplates() )
|
||||
for ( ModelTemplate template : application.getTemplates() )
|
||||
{
|
||||
if ( template.getPermissions() != null )
|
||||
{
|
||||
for ( ModelPermission permission : (List<ModelPermission>) template.getPermissions() )
|
||||
for ( ModelPermission permission : template.getPermissions() )
|
||||
{
|
||||
if ( !operationIdList.contains( permission.getOperation() ) )
|
||||
{
|
||||
|
@ -263,17 +262,16 @@ public class DefaultRoleModelValidator
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private void validateResourceClosure( RedbackRoleModel model )
|
||||
{
|
||||
List<String> resourceIdList = RoleModelUtils.getResourceIdList( model );
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelRole role : (List<ModelRole>) application.getRoles() )
|
||||
for ( ModelRole role : application.getRoles() )
|
||||
{
|
||||
if ( role.getPermissions() != null )
|
||||
{
|
||||
for ( ModelPermission permission : (List<ModelPermission>) role.getPermissions() )
|
||||
for ( ModelPermission permission : role.getPermissions() )
|
||||
{
|
||||
if ( !resourceIdList.contains( permission.getResource() ) )
|
||||
{
|
||||
|
@ -286,17 +284,16 @@ public class DefaultRoleModelValidator
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private void validateChildRoleClosure( RedbackRoleModel model )
|
||||
{
|
||||
List<String> roleIdList = RoleModelUtils.getRoleIdList( model );
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelRole role : (List<ModelRole>) application.getRoles() )
|
||||
for ( ModelRole role : application.getRoles() )
|
||||
{
|
||||
if ( role.getChildRoles() != null )
|
||||
{
|
||||
for ( String childRoleId : (List<String>) role.getChildRoles() )
|
||||
for ( String childRoleId : role.getChildRoles() )
|
||||
{
|
||||
if ( !roleIdList.contains( childRoleId ) )
|
||||
{
|
||||
|
@ -307,11 +304,11 @@ public class DefaultRoleModelValidator
|
|||
}
|
||||
}
|
||||
|
||||
for ( ModelTemplate template : (List<ModelTemplate>) application.getTemplates() )
|
||||
for ( ModelTemplate template : application.getTemplates() )
|
||||
{
|
||||
if ( template.getChildRoles() != null )
|
||||
{
|
||||
for ( String childRoleId : (List<String>) template.getChildRoles() )
|
||||
for ( String childRoleId : template.getChildRoles() )
|
||||
{
|
||||
if ( !roleIdList.contains( childRoleId ) )
|
||||
{
|
||||
|
@ -329,13 +326,13 @@ public class DefaultRoleModelValidator
|
|||
{
|
||||
List roleIdList = RoleModelUtils.getRoleIdList( model );
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelRole role : (List<ModelRole>) application.getRoles() )
|
||||
for ( ModelRole role : application.getRoles() )
|
||||
{
|
||||
if ( role.getParentRoles() != null )
|
||||
{
|
||||
for ( String parentRoleId : (List<String>) role.getParentRoles() )
|
||||
for ( String parentRoleId : role.getParentRoles() )
|
||||
{
|
||||
if ( !roleIdList.contains( parentRoleId ) )
|
||||
{
|
||||
|
@ -346,11 +343,11 @@ public class DefaultRoleModelValidator
|
|||
}
|
||||
}
|
||||
|
||||
for ( ModelTemplate template : (List<ModelTemplate>) application.getTemplates() )
|
||||
for ( ModelTemplate template : application.getTemplates() )
|
||||
{
|
||||
if ( template.getParentRoles() != null )
|
||||
{
|
||||
for ( String parentRoleId : (List<String>) template.getParentRoles() )
|
||||
for ( String parentRoleId : template.getParentRoles() )
|
||||
{
|
||||
if ( !roleIdList.contains( parentRoleId ) )
|
||||
{
|
||||
|
@ -363,7 +360,6 @@ public class DefaultRoleModelValidator
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private void validateTemplateClosure( RedbackRoleModel model )
|
||||
{
|
||||
List templateIdList = RoleModelUtils.getTemplateIdList( model );
|
||||
|
@ -371,13 +367,13 @@ public class DefaultRoleModelValidator
|
|||
// template name prefix must be unique
|
||||
List<String> templateNamePrefixList = new ArrayList<String>();
|
||||
|
||||
for ( ModelApplication application : (List<ModelApplication>) model.getApplications() )
|
||||
for ( ModelApplication application : model.getApplications() )
|
||||
{
|
||||
for ( ModelTemplate template : (List<ModelTemplate>) application.getTemplates() )
|
||||
for ( ModelTemplate template : application.getTemplates() )
|
||||
{
|
||||
if ( template.getParentTemplates() != null )
|
||||
{
|
||||
for ( String parentTemplateId : (List<String>) template.getParentTemplates() )
|
||||
for ( String parentTemplateId : template.getParentTemplates() )
|
||||
{
|
||||
if ( !templateIdList.contains( parentTemplateId ) )
|
||||
{
|
||||
|
@ -390,7 +386,7 @@ public class DefaultRoleModelValidator
|
|||
|
||||
if ( template.getChildTemplates() != null )
|
||||
{
|
||||
for ( String childTemplateId : (List<String>) template.getChildTemplates() )
|
||||
for ( String childTemplateId : template.getChildTemplates() )
|
||||
{
|
||||
if ( !templateIdList.contains( childTemplateId ) )
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
~ under the License.
|
||||
-->
|
||||
|
||||
<model>
|
||||
<model xml.namespace="http://archiva.apache.org/redback/role/${version}">
|
||||
<id>redback-role-model</id>
|
||||
<name>RedbackRoleModel</name>
|
||||
<description></description>
|
||||
|
|
Loading…
Reference in New Issue