Merge commit '18b1b16a'
diff --git a/src/docker/apacheds-for-apache-fortress-tests/Dockerfile b/src/docker/apacheds-for-apache-fortress-tests/Dockerfile
index 253b7b7..d943071 100644
--- a/src/docker/apacheds-for-apache-fortress-tests/Dockerfile
+++ b/src/docker/apacheds-for-apache-fortress-tests/Dockerfile
@@ -32,7 +32,7 @@
# Install ApacheDS
RUN \
- wget http://www.apache.org/dist//directory/apacheds/dist/${APACHEDS_VERSION}/apacheds-${APACHEDS_VERSION}-amd64.deb -q -O /tmp/apacheds.deb && \
+ wget http://archive.apache.org/dist//directory/apacheds/dist/${APACHEDS_VERSION}/apacheds-${APACHEDS_VERSION}-amd64.deb -q -O /tmp/apacheds.deb && \
dpkg -i /tmp/apacheds.deb && \
rm /tmp/apacheds.deb
diff --git a/src/main/java/org/apache/directory/fortress/core/AccelMgrFactory.java b/src/main/java/org/apache/directory/fortress/core/AccelMgrFactory.java
index 601d306..da75718 100644
--- a/src/main/java/org/apache/directory/fortress/core/AccelMgrFactory.java
+++ b/src/main/java/org/apache/directory/fortress/core/AccelMgrFactory.java
@@ -59,8 +59,8 @@
public static AccelMgr createInstance(String contextId)
throws SecurityException
{
- String accelClassName = Config.getInstance().getProperty(GlobalIds.ACCEL_IMPLEMENTATION);
-
+ String accelClassName = Config.getInstance().getProperty(GlobalIds.ACCEL_IMPLEMENTATION);
+
VUtil.assertNotNull(contextId, GlobalErrIds.CONTEXT_NULL, CLS_NM + ".createInstance");
AccelMgr accelMgr;
if ( StringUtils.isEmpty( accelClassName ) )
diff --git a/src/main/java/org/apache/directory/fortress/core/AdminMgr.java b/src/main/java/org/apache/directory/fortress/core/AdminMgr.java
index bd91939..127ff7b 100755
--- a/src/main/java/org/apache/directory/fortress/core/AdminMgr.java
+++ b/src/main/java/org/apache/directory/fortress/core/AdminMgr.java
@@ -497,7 +497,7 @@
* @throws SecurityException in the event of validation or system error.
*/
RoleConstraint addRoleConstraint( UserRole uRole, RoleConstraint roleConstraint )
- throws SecurityException;
+ throws SecurityException;
/**
* Thie method removes a roleConstraint (ftRC) from the user ldap entry.
@@ -515,7 +515,7 @@
* @throws SecurityException in the event of validation or system error.
*/
void removeRoleConstraint( UserRole uRole, RoleConstraint roleConstraint )
- throws SecurityException;
+ throws SecurityException;
/**
* Thie method removes a roleConstraint (ftRC) from the user ldap entry.
@@ -612,7 +612,7 @@
* @throws SecurityException - thrown in the event of perm attribute set data or system error.
*/
PermissionAttributeSet addPermissionAttributeSet( PermissionAttributeSet permAttributeSet )
- throws SecurityException;
+ throws SecurityException;
/**
* This method will delete a permission attribute set object.
@@ -650,7 +650,7 @@
* @throws SecurityException - thrown in the event of data or system error
*/
PermissionAttribute addPermissionAttributeToSet( PermissionAttribute permAttribute, String attributeSetName )
- throws SecurityException;
+ throws SecurityException;
/**
* This method removed a permission attribute (ftPA) from an existing permission attribute set.
@@ -660,13 +660,13 @@
* <li>PermissionAttribute#attributeName - contains the name of existing object being targeted for the permission update</li>
* <li>attributeSetName - contains the name of existing permission attribute set being modified</li>
* </ul>
- *
+ *
* @param permAttribute must contain PermissionAttribute#attributeName}
* @param attributeSetName The name of the permission attribute set this pa should be removed from
* @throws SecurityException - thrown in the event of data or system error
*/
void removePermissionAttributeFromSet( PermissionAttribute permAttribute, String attributeSetName )
- throws SecurityException;
+ throws SecurityException;
/**
* This method updates a permission attribute (ftPA) on a permission attribute set.
diff --git a/src/main/java/org/apache/directory/fortress/core/ConfigMgrFactory.java b/src/main/java/org/apache/directory/fortress/core/ConfigMgrFactory.java
index 3d8e4ba..2b3c779 100755
--- a/src/main/java/org/apache/directory/fortress/core/ConfigMgrFactory.java
+++ b/src/main/java/org/apache/directory/fortress/core/ConfigMgrFactory.java
@@ -51,8 +51,8 @@
public static ConfigMgr createInstance()
throws SecurityException
{
- String configClassName = Config.getInstance().getProperty( GlobalIds.CONFIG_IMPLEMENTATION );
- boolean IS_REST = ((Config.getInstance().getProperty(ENABLE_REST) != null) && (Config.getInstance().getProperty(ENABLE_REST).equalsIgnoreCase("true")));
+ String configClassName = Config.getInstance().getProperty( GlobalIds.CONFIG_IMPLEMENTATION );
+ boolean IS_REST = ((Config.getInstance().getProperty(ENABLE_REST) != null) && (Config.getInstance().getProperty(ENABLE_REST).equalsIgnoreCase("true")));
return ConfigMgrFactory.createInstance(configClassName, IS_REST);
}
diff --git a/src/main/java/org/apache/directory/fortress/core/ReviewMgr.java b/src/main/java/org/apache/directory/fortress/core/ReviewMgr.java
index e2c8723..930e9bf 100755
--- a/src/main/java/org/apache/directory/fortress/core/ReviewMgr.java
+++ b/src/main/java/org/apache/directory/fortress/core/ReviewMgr.java
@@ -155,7 +155,7 @@
* thrown in the event of system error.
*/
List<Permission> findPermsByObj( PermObj permObj )
- throws SecurityException;
+ throws SecurityException;
/**
* Method returns a list of Permissions that match any part of the permission object or operation.
@@ -500,7 +500,7 @@
* @throws SecurityException In the event system error occurs.
*/
List<PermissionAttributeSet> rolePermissionAttributeSets( Role role, boolean noInheritance )
- throws SecurityException;
+ throws SecurityException;
/**
* This function returns the set of permissions a given user gets through his/her authorized
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/AccelMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/AccelMgrImpl.java
index 8f69326..68f475c 100644
--- a/src/main/java/org/apache/directory/fortress/core/impl/AccelMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/AccelMgrImpl.java
@@ -85,7 +85,7 @@
*/
public AccelMgrImpl()
{
- aDao = new org.apache.directory.fortress.core.impl.AcceleratorDAO();
+ aDao = new org.apache.directory.fortress.core.impl.AcceleratorDAO();
}
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/AcceleratorDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/AcceleratorDAO.java
index af14943..c741258 100644
--- a/src/main/java/org/apache/directory/fortress/core/impl/AcceleratorDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/AcceleratorDAO.java
@@ -70,8 +70,9 @@
{
private static final Logger LOG = LoggerFactory.getLogger( AcceleratorDAO.class.getName() );
- public AcceleratorDAO(){
- super();
+ public AcceleratorDAO()
+ {
+ super();
}
/**
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/AdminMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/AdminMgrImpl.java
index 5f4a491..f66cb0a 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/AdminMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/AdminMgrImpl.java
@@ -400,9 +400,9 @@
@Override
@AdminPermissionOperation
public void enableRoleConstraint( Role role, RoleConstraint roleConstraint )
- throws SecurityException
+ throws SecurityException
{
- String methodName = "enableRoleConstraint";
+ String methodName = "enableRoleConstraint";
VUtil.assertNotNull( role, GlobalErrIds.ROLE_NULL, CLS_NM + methodName );
VUtil.assertNotNull( role.getName(), GlobalErrIds.ROLE_NM_NULL, CLS_NM + methodName );
VUtil.assertNotNull( roleConstraint, GlobalErrIds.ROLE_CONSTRAINT_NULL, CLS_NM + methodName );
@@ -428,7 +428,7 @@
@Override
@AdminPermissionOperation
public void disableRoleConstraint( Role role, RoleConstraint roleConstraint )
- throws SecurityException
+ throws SecurityException
{
String methodName = "disableRoleConstraint";
setEntitySession( CLS_NM, methodName, role );
@@ -454,9 +454,9 @@
@Override
@AdminPermissionOperation
public RoleConstraint addRoleConstraint( UserRole uRole, RoleConstraint roleConstraint )
- throws SecurityException
+ throws SecurityException
{
- String methodName = "addRoleConstraint";
+ String methodName = "addRoleConstraint";
assertContext( CLS_NM, methodName, uRole, GlobalErrIds.URLE_NULL );
VUtil.assertNotNull( uRole.getName(), GlobalErrIds.ROLE_NM_NULL, CLS_NM + methodName );
VUtil.assertNotNull( roleConstraint, GlobalErrIds.ROLE_CONSTRAINT_NULL, CLS_NM + methodName );
@@ -494,9 +494,9 @@
@Override
@AdminPermissionOperation
public void removeRoleConstraint( UserRole uRole, RoleConstraint roleConstraint )
- throws SecurityException
+ throws SecurityException
{
- String methodName = "removeRoleConstraint";
+ String methodName = "removeRoleConstraint";
assertContext( CLS_NM, methodName, uRole, GlobalErrIds.URLE_NULL );
VUtil.assertNotNull( roleConstraint, GlobalErrIds.ROLE_CONSTRAINT_NULL, CLS_NM + methodName );
VUtil.assertNotNull( uRole.getName(), GlobalErrIds.ROLE_NM_NULL, CLS_NM + methodName );
@@ -615,12 +615,12 @@
@Override
@AdminPermissionOperation
public PermissionAttribute addPermissionAttributeToSet( PermissionAttribute permAttribute, String attributeSetName )
- throws SecurityException
+ throws SecurityException
{
- String methodName = "addPermissionAttributeToSet";
+ String methodName = "addPermissionAttributeToSet";
assertContext( CLS_NM, methodName, permAttribute, GlobalErrIds.PERM_ATTRIBUTE_NULL );
setEntitySession( CLS_NM, methodName, permAttribute );
- return permP.add( permAttribute, attributeSetName );
+ return permP.add( permAttribute, attributeSetName );
}
/**
@@ -629,12 +629,12 @@
@Override
@AdminPermissionOperation
public void removePermissionAttributeFromSet( PermissionAttribute permAttribute, String attributeSetName )
- throws SecurityException
+ throws SecurityException
{
- String methodName = "removePermissionAttributeFromSet";
+ String methodName = "removePermissionAttributeFromSet";
assertContext( CLS_NM, methodName, permAttribute, GlobalErrIds.PERM_ATTRIBUTE_NULL );
- setEntitySession( CLS_NM, methodName, permAttribute );
- permP.delete( permAttribute, attributeSetName );
+ setEntitySession( CLS_NM, methodName, permAttribute );
+ permP.delete( permAttribute, attributeSetName );
}
/**
@@ -645,10 +645,10 @@
public void updatePermissionAttributeInSet(PermissionAttribute permAttribute, String attributeSetName, boolean replaceValidValues)
throws SecurityException
{
- String methodName = "updatePermissionAttributeInSet";
- assertContext( CLS_NM, methodName, permAttribute, GlobalErrIds.PERM_ATTRIBUTE_NULL );
- setEntitySession( CLS_NM, methodName, permAttribute );
- permP.update( permAttribute, attributeSetName, replaceValidValues );
+ String methodName = "updatePermissionAttributeInSet";
+ assertContext( CLS_NM, methodName, permAttribute, GlobalErrIds.PERM_ATTRIBUTE_NULL );
+ setEntitySession( CLS_NM, methodName, permAttribute );
+ permP.update( permAttribute, attributeSetName, replaceValidValues );
}
/**
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleDAO.java
index 21db700..ab525b5 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleDAO.java
@@ -123,7 +123,7 @@
GlobalIds.PROPS_AUX_OBJECT_CLASS_NAME,
POOLS_AUX_OBJECT_CLASS_NAME,
GlobalIds.FT_MODIFIER_AUX_OBJECT_CLASS_NAME
- };
+ };
private static final String ROLE_NM = "ftRoleName";
private static final String[] ROLE_NM_ATR =
{
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
index dd2cefc..1a35b98 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
@@ -107,8 +107,8 @@
*/
ConfigDAO()
{
- super();
- CONFIG_ROOT_DN = Config.getInstance().getProperty( GlobalIds.CONFIG_ROOT_PARAM );
+ super();
+ CONFIG_ROOT_DN = Config.getInstance().getProperty( GlobalIds.CONFIG_ROOT_PARAM );
}
/**
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java
index cc1db96..53b3210 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java
@@ -47,8 +47,9 @@
private ConfigP cfgP;
private static final String CLS_NM = ConfigMgrImpl.class.getName();
- public ConfigMgrImpl() {
- cfgP = new ConfigP();
+ public ConfigMgrImpl()
+ {
+ cfgP = new ConfigP();
}
/**
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/DelAccessMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/DelAccessMgrImpl.java
index e77b1db..d255b4e 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/DelAccessMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/DelAccessMgrImpl.java
@@ -78,7 +78,7 @@
permP = new PermP();
SUPER_ADMIN = Config.getInstance().getProperty("superadmin.role", "fortress-core-super-admin");
REST_ADMIN = Config.getInstance().getProperty("serviceadmin.role", "fortress-rest-admin");
- }
+ }
/**
* {@inheritDoc}
@@ -248,7 +248,7 @@
public List<UserAdminRole> sessionAdminRoles(Session session)
throws SecurityException
{
- String methodName = "sessionAdminRoles";
+ String methodName = "sessionAdminRoles";
VUtil.assertNotNull(session, GlobalErrIds.USER_SESS_NULL, CLS_NM + ".sessionAdminRoles");
setEntitySession(CLS_NM, methodName, session);
return session.getAdminRoles();
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/DelAdminMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/DelAdminMgrImpl.java
index a120e27..fb179d9 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/DelAdminMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/DelAdminMgrImpl.java
@@ -74,7 +74,7 @@
admRP = new AdminRoleP();
permP = new PermP();
userP = new UserP();
- }
+ }
/**
* {@inheritDoc}
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/DelReviewMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/DelReviewMgrImpl.java
index 1cf4cb8..6d87ac1 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/DelReviewMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/DelReviewMgrImpl.java
@@ -66,7 +66,7 @@
ouP = new OrgUnitP();
admRP = new AdminRoleP();
permP = new PermP();
- }
+ }
/**
* {@inheritDoc}
@@ -167,24 +167,26 @@
/**
* {@inheritDoc}
*/
- @Override
- public List<Permission> rolePermissions(AdminRole role)
- throws SecurityException {
- return rolePermissions( role, false );
- }
+ @Override
+ public List<Permission> rolePermissions(AdminRole role)
+ throws SecurityException
+ {
+ return rolePermissions( role, false );
+ }
-
+
/**
* {@inheritDoc}
*/
- @Override
- @AdminPermissionOperation
- public List<Permission> rolePermissions(AdminRole role,
- boolean noInheritance) throws SecurityException {
+ @Override
+ @AdminPermissionOperation
+ public List<Permission> rolePermissions(AdminRole role,
+ boolean noInheritance) throws SecurityException
+ {
String methodName = "rolePermissions";
assertContext(CLS_NM, methodName, role, GlobalErrIds.ROLE_NULL);
checkAccess(CLS_NM, methodName);
return permP.search( role, noInheritance );
- }
+ }
}
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitP.java b/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitP.java
index 1a0ea6f..643fba5 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitP.java
@@ -87,7 +87,7 @@
*/
OrgUnitP()
{
- init();
+ init();
}
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/OrganizationalUnitDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/OrganizationalUnitDAO.java
index 019c9a5..8a4b0e0 100644
--- a/src/main/java/org/apache/directory/fortress/core/impl/OrganizationalUnitDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/OrganizationalUnitDAO.java
@@ -75,7 +75,7 @@
*/
OrganizationalUnitDAO()
{
- super();
+ super();
}
/**
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
index cd67500..bc1b1cd 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
@@ -547,7 +547,7 @@
for(PermissionAttribute pa : entity.getAttributes())
{
pa.setContextId( entity.getContextId() );
- this.createPermissionAttribute(pa, entity.getName());
+ this.createPermissionAttribute(pa, entity.getName());
}
return entity;
@@ -608,7 +608,7 @@
//add one to many valid values
for(String validValue : entity.getValidValues()){
- entry.add( GlobalIds.FT_PERMISSION_ATTRIBUTE_VALID_VALUES, validValue );
+ entry.add( GlobalIds.FT_PERMISSION_ATTRIBUTE_VALID_VALUES, validValue );
}
// organizational name requires CN attribute:
@@ -629,8 +629,8 @@
{
closeAdminConnection( ld );
}
-
- return entity;
+
+ return entity;
}
PermissionAttribute updatePermissionAttribute( PermissionAttribute entity, String paSetName, boolean replaceValidValues ) throws UpdateException
@@ -677,15 +677,15 @@
//if replace, then remove first
if(replaceValidValues){
- mods.add( new DefaultModification(
+ mods.add( new DefaultModification(
ModificationOperation.REMOVE_ATTRIBUTE, GlobalIds.FT_PERMISSION_ATTRIBUTE_VALID_VALUES ) );
}
for(String validValue : entity.getValidValues()){
mods.add( new DefaultModification(
- ModificationOperation.ADD_ATTRIBUTE, GlobalIds.FT_PERMISSION_ATTRIBUTE_VALID_VALUES, validValue ) );
+ ModificationOperation.ADD_ATTRIBUTE, GlobalIds.FT_PERMISSION_ATTRIBUTE_VALID_VALUES, validValue ) );
}
-
+
if ( mods.size() > 0 )
{
ld = getAdminConnection();
@@ -828,13 +828,13 @@
catch ( LdapException e )
{
String error = "deleteAttributeSet name [" + entity.getName() + "]"
- + " caught LdapException=" + e;
+ + " caught LdapException=" + e;
throw new RemoveException( GlobalErrIds.PERM_ATTRIBUTE_SET_DELETE_FAILED, error, e );
}
catch ( CursorException e )
{
String error = "deleteAttributeSet name [" + entity.getName() + "] "
- + " caught LdapException=" + e.getMessage();
+ + " caught LdapException=" + e.getMessage();
throw new RemoveException( GlobalErrIds.PERM_ATTRIBUTE_SET_DELETE_FAILED, error, e );
}
finally
@@ -860,7 +860,7 @@
catch ( LdapException e )
{
String error = "deletePermission name [" + entity.getAttributeName() + "] set ["
- + attributeSetName + "] caught LdapException=" + e;
+ + attributeSetName + "] caught LdapException=" + e;
throw new RemoveException( GlobalErrIds.PERM_ATTRIBUTE_DELETE_FAILED, error, e );
}
finally
@@ -1636,19 +1636,22 @@
filterbuf.append( PERM_OP_OBJECT_CLASS_NAME );
filterbuf.append( ")(|" );
- if(permObjVal != null && permObjVal != ""){
- filterbuf.append("(");
- filterbuf.append( GlobalIds.POBJ_NAME );
- filterbuf.append( "=*" );
- filterbuf.append( permObjVal );
- filterbuf.append( "*)" );
+ if ( permObjVal != null && permObjVal != "" )
+ {
+ filterbuf.append("(");
+ filterbuf.append( GlobalIds.POBJ_NAME );
+ filterbuf.append( "=*" );
+ filterbuf.append( permObjVal );
+ filterbuf.append( "*)" );
}
- if(permOpVal != null && permOpVal != ""){
- filterbuf.append("(");
- filterbuf.append( GlobalIds.POP_NAME );
- filterbuf.append( "=*" );
- filterbuf.append( permOpVal );
- filterbuf.append( "*)" );
+
+ if ( permOpVal != null && permOpVal != "" )
+ {
+ filterbuf.append("(");
+ filterbuf.append( GlobalIds.POP_NAME );
+ filterbuf.append( "=*" );
+ filterbuf.append( permOpVal );
+ filterbuf.append( "*)" );
}
filterbuf.append("))");
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PermP.java b/src/main/java/org/apache/directory/fortress/core/impl/PermP.java
index 4946895..7a079f9 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PermP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PermP.java
@@ -403,7 +403,7 @@
*/
void delete( PermissionAttribute entity, String paSetName ) throws SecurityException
{
- validate( entity );
+ validate( entity );
pDao.deletePermissionAttribute( entity, paSetName );
}
@@ -419,8 +419,8 @@
{
validate( entity );
pDao.updatePermissionAttribute( entity, paSetName, replaceValidValues );
- }
-
+ }
+
/**
* Update existing Permission Object attributes with the input entity. Null or empty attributes will be ignored.
* The Permission Object entity input will be validated to ensure that:
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PolicyP.java b/src/main/java/org/apache/directory/fortress/core/impl/PolicyP.java
index 0bac512..5ae0e93 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PolicyP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PolicyP.java
@@ -87,7 +87,7 @@
*/
PolicyP()
{
- init();
+ init();
}
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PsoUtil.java b/src/main/java/org/apache/directory/fortress/core/impl/PsoUtil.java
index c2b9467..11b1835 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PsoUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PsoUtil.java
@@ -76,8 +76,9 @@
{
synchronized (PsoUtil.class)
{
- if(sINSTANCE == null){
- sINSTANCE = new PsoUtil();
+ if(sINSTANCE == null)
+ {
+ sINSTANCE = new PsoUtil();
}
}
}
@@ -95,7 +96,7 @@
private void init()
{
orgUnitP = new OrgUnitP();
-
+
CacheMgr cacheMgr = CacheMgr.getInstance();
psoCache = cacheMgr.getCache( "fortress.pso" );
}
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PwPolicyMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/PwPolicyMgrImpl.java
index e805341..47bb4a7 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PwPolicyMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PwPolicyMgrImpl.java
@@ -71,9 +71,9 @@
private UserP userP;
public PwPolicyMgrImpl() {
- policyP = new PolicyP();
- userP = new UserP();
- }
+ policyP = new PolicyP();
+ userP = new UserP();
+ }
/**
* {@inheritDoc}
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ReviewMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/ReviewMgrImpl.java
index 8b26aaa..24d452c 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ReviewMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ReviewMgrImpl.java
@@ -30,7 +30,6 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.directory.fortress.annotation.AdminPermissionOperation;
import org.apache.directory.fortress.core.GlobalErrIds;
-import org.apache.directory.fortress.core.GlobalIds;
import org.apache.directory.fortress.core.ReviewMgr;
import org.apache.directory.fortress.core.SecurityException;
import org.apache.directory.fortress.core.model.OrgUnit;
@@ -130,14 +129,14 @@
@Override
@AdminPermissionOperation
public PermissionAttributeSet readPermAttributeSet( PermissionAttributeSet permAttributeSet )
- throws SecurityException
+ throws SecurityException
{
- String methodName = "readPermAttributeSet";
- assertContext( CLS_NM, methodName, permAttributeSet, GlobalErrIds.PERM_ATTRIBUTE_SET_NULL );
- VUtil.assertNotNull( permAttributeSet.getName(), GlobalErrIds.PERM_ATTRIBUTE_SET_NM_NULL, CLS_NM + "." + methodName );
- checkAccess(CLS_NM, methodName);
-
- return permP.read(permAttributeSet);
+ String methodName = "readPermAttributeSet";
+ assertContext( CLS_NM, methodName, permAttributeSet, GlobalErrIds.PERM_ATTRIBUTE_SET_NULL );
+ VUtil.assertNotNull( permAttributeSet.getName(), GlobalErrIds.PERM_ATTRIBUTE_SET_NM_NULL, CLS_NM + "." + methodName );
+ checkAccess(CLS_NM, methodName);
+
+ return permP.read(permAttributeSet);
}
@@ -158,16 +157,17 @@
/**
* {@inheritDoc}
*/
- @Override
- @AdminPermissionOperation
- public List<Permission> findPermsByObj(PermObj permObj)
- throws SecurityException {
+ @Override
+ @AdminPermissionOperation
+ public List<Permission> findPermsByObj(PermObj permObj)
+ throws SecurityException
+ {
String methodName = "findPermsByObj";
assertContext( CLS_NM, methodName, permObj, GlobalErrIds.PERM_OBJECT_NULL );
VUtil.assertNotNullOrEmpty(permObj.getObjName(), GlobalErrIds.PERM_OBJECT_NM_NULL, CLS_NM + "." + methodName);
checkAccess(CLS_NM, methodName);
return permP.searchOperations( permObj );
- }
+ }
/**
* {@inheritDoc}
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java b/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java
index e9edf66..7711f0d 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java
@@ -79,7 +79,7 @@
{
if(sINSTANCE == null)
{
- sINSTANCE = new RoleUtil();
+ sINSTANCE = new RoleUtil();
}
}
}
@@ -96,8 +96,8 @@
*/
private void init()
{
- roleP = new RoleP();
-
+ roleP = new RoleP();
+
CacheMgr cacheMgr = CacheMgr.getInstance();
roleCache = cacheMgr.getCache( "fortress.roles" );
}
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/SDUtil.java b/src/main/java/org/apache/directory/fortress/core/impl/SDUtil.java
index 26321b1..9c21d86 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/SDUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/SDUtil.java
@@ -70,7 +70,7 @@
{
if(sINSTANCE == null)
{
- sINSTANCE = new SDUtil();
+ sINSTANCE = new SDUtil();
}
}
}
@@ -80,7 +80,7 @@
private void init()
{
sp = new SdP();
-
+
// Get a reference to the CacheManager Singleton object:
CacheMgr cacheMgr = CacheMgr.getInstance();
// This cache contains a wrapper entry for DSD and is searchable by both DSD and Role name:
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
index de41657..c498155 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
@@ -209,7 +209,7 @@
UserDAO()
{
initAttrArrays();
- }
+ }
/**
@@ -271,7 +271,7 @@
}
else if( !Config.getInstance().getBoolean( GlobalIds.USER_CREATION_PASSWORD_FIELD, false ) )
{
- myEntry.add( SchemaConstants.USER_PASSWORD_AT, new String() );
+ myEntry.add( SchemaConstants.USER_PASSWORD_AT, new String() );
}
myEntry.add( SchemaConstants.DISPLAY_NAME_AT, entity.getCn() );
@@ -1350,7 +1350,6 @@
ld = getAdminConnection();
SearchCursor searchResults = search( ld, userRoot, SearchScope.ONELEVEL, filterbuf.toString(), USERID_ATR, false,
Config.getInstance().getInt(GlobalIds.CONFIG_LDAP_MAX_BATCH_SIZE, GlobalIds.BATCH_SIZE ) );
- long sequence = 0;
while ( searchResults.next() )
{
@@ -1861,8 +1860,8 @@
*/
void assign( UserRole uRole, RoleConstraint roleConstraint ) throws UpdateException, FinderException
{
- LdapConnection ld = null;
- String szRoleConstraint = "";
+ LdapConnection ld = null;
+ String szRoleConstraint = "";
String userDn = getDn( uRole.getUserId(), uRole.getContextId() );
try
@@ -1873,7 +1872,7 @@
szRoleConstraint = roleConstraint.getRawData(uRole);
mods.add( new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, GlobalIds.USER_ROLE_DATA,
- szRoleConstraint ) );
+ szRoleConstraint ) );
ld = getAdminConnection();
modify( ld, userDn, mods, uRole );
@@ -1899,8 +1898,8 @@
*/
void deassign( UserRole uRole, RoleConstraint roleConstraint ) throws UpdateException, FinderException
{
- LdapConnection ld = null;
- String szRoleConstraint = "";
+ LdapConnection ld = null;
+ String szRoleConstraint = "";
String userDn = getDn( uRole.getUserId(), uRole.getContextId() );
try
@@ -1909,7 +1908,7 @@
szRoleConstraint = roleConstraint.getRawData(uRole);
mods.add( new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, GlobalIds.USER_ROLE_DATA,
- szRoleConstraint ) );
+ szRoleConstraint ) );
ld = getAdminConnection();
modify( ld, userDn, mods, uRole );
@@ -2658,8 +2657,7 @@
*/
private List<UserRole> unloadUserRoles( Entry entry, String userId, String contextId, String roleNameFilter )
{
- //Map<String, UserRole> uRoles = new HashMap<String, UserRole>();
- Map<String, UserRole> uRoles = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
+ Map<String, UserRole> uRoles = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
List<String> roles = getAttributes( entry, GlobalIds.USER_ROLE_DATA );
if ( roles != null )
@@ -2668,29 +2666,32 @@
for ( String raw : roles )
{
- //get role name
- String roleName = raw.substring(0, raw.indexOf( Config.getInstance().getDelimiter() )).toUpperCase();
-
- //if role name filter provided, only unload role if it has that name
- if(roleNameFilter == null || roleNameFilter.toUpperCase().equals( roleName )){
- //if already found, add to user role
- if(uRoles.containsKey(roleName)){
- UserRole ure = uRoles.get(roleName);
- ure.load( raw, contextId, RoleUtil.getInstance() );
- }
- //else create new
- else{
- UserRole ure = new ObjectFactory().createUserRole();
- ure.load( raw, contextId, RoleUtil.getInstance() );
- ure.setUserId( userId );
- ure.setSequenceId( sequence++ );
- uRoles.put(roleName, ure );
- }
- }
+ //get role name
+ String roleName = raw.substring( 0, raw.indexOf( Config.getInstance().getDelimiter() ) ).toUpperCase();
+
+ //if role name filter provided, only unload role if it has that name
+ if ( ( roleNameFilter == null ) || roleNameFilter.toUpperCase().equals( roleName ) )
+ {
+ //if already found, add to user role
+ if(uRoles.containsKey(roleName))
+ {
+ UserRole userRole = uRoles.get(roleName);
+ userRole.load( raw, contextId, RoleUtil.getInstance() );
+ }
+ //else create new
+ else
+ {
+ UserRole userRole = new ObjectFactory().createUserRole();
+ userRole.load( raw, contextId, RoleUtil.getInstance() );
+ userRole.setUserId( userId );
+ userRole.setSequenceId( sequence++ );
+ uRoles.put(roleName, userRole );
+ }
+ }
}
}
- return new ArrayList<UserRole>(uRoles.values());
+ return new ArrayList<UserRole>( uRoles.values() );
}
@@ -2729,13 +2730,8 @@
/**
* Begin RF2307 properties...
*/
-
- //private static final String USER_ROLE_ASSIGN = IS_RFC2307 && Config.getInstance().getProperty( "rfc2307.user.member" ) != null ? Config.getInstance().getProperty( "rfc2307.user.member" ) : "ftRA";
- //private static final String USER_MEMBER = IS_RFC2307 && Config.getInstance().getProperty( "rfc2307.user.member" ) != null ? Config.getInstance().getProperty( "rfc2307.user.member" ) : USER_ROLE_ASSIGN;
-
private void initAttrArrays()
{
-
if ( Config.getInstance().isOpenldap() || Config.getInstance().isApacheds() )
{
// This default set of attributes contains all and is used for search operations.
@@ -2792,9 +2788,9 @@
OPENLDAP_PW_LOCKED_TIME,
GlobalIds.PROPS };
}
-
else
{
+ // Other LDAP servers
defaultAtrs = new String[]
{
GlobalIds.FT_IID,
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UserP.java b/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
index 64d418d..837fd31 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
@@ -711,18 +711,18 @@
//TODO: add documentation
void assign( UserRole uRole, RoleConstraint roleConstraint ) throws SecurityException
- {
- validate( roleConstraint, uRole.getContextId() );
-
- uDao.assign( uRole, roleConstraint );
+ {
+ validate( roleConstraint, uRole.getContextId() );
+
+ uDao.assign( uRole, roleConstraint );
}
//TODO: add documentation, maybe change method name?
void deassign( UserRole uRole, RoleConstraint roleConstraint ) throws SecurityException
{
- //TODO: validate?
-
- uDao.deassign( uRole, roleConstraint );
+ //TODO: validate?
+
+ uDao.deassign( uRole, roleConstraint );
}
@@ -851,7 +851,7 @@
}
if( StringUtils.isEmpty( rc.getValue() ))
{
- throw new ValidationException( GlobalErrIds.ROLE_CONSTRAINT_VALUE_NULL, CLS_NM + ".validate value is NULL" );
+ throw new ValidationException( GlobalErrIds.ROLE_CONSTRAINT_VALUE_NULL, CLS_NM + ".validate value is NULL" );
}
}
@@ -984,19 +984,22 @@
List<RoleConstraint> findRoleConstraints( Set<String> roles, User user, RoleConstraint.RCType rcType, Set<String> paSets ) throws SecurityException
{
- List<RoleConstraint> matchingConstraints = new ArrayList<RoleConstraint>();
-
+ List<RoleConstraint> matchingConstraints = new ArrayList<RoleConstraint>();
+
//TODO: can we do this in a query?
List<UserRole> userRoles = uDao.getUser(user, true).getRoles();
for(UserRole ur : userRoles){
- //only get constraints for passed in roles
- if(roles.contains(ur.getName())){
- for(RoleConstraint rc : ur.getRoleConstraints()){
- if(rc.getType().equals(rcType) && paSets.contains(rc.getKey())){
- matchingConstraints.add(rc);
- }
- }
- }
+ //only get constraints for passed in roles
+ if(roles.contains(ur.getName()))
+ {
+ for(RoleConstraint rc : ur.getRoleConstraints())
+ {
+ if(rc.getType().equals(rcType) && paSets.contains(rc.getKey()))
+ {
+ matchingConstraints.add(rc);
+ }
+ }
+ }
}
return matchingConstraints;
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UsoUtil.java b/src/main/java/org/apache/directory/fortress/core/impl/UsoUtil.java
index a09efc2..4eff1e6 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UsoUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UsoUtil.java
@@ -77,7 +77,7 @@
{
if(sINSTANCE == null)
{
- sINSTANCE = new UsoUtil();
+ sINSTANCE = new UsoUtil();
}
}
}
@@ -92,7 +92,7 @@
private void init()
{
orgUnitP = new OrgUnitP();
-
+
CacheMgr cacheMgr = CacheMgr.getInstance();
usoCache = cacheMgr.getCache( "fortress.uso" );
}
diff --git a/src/main/java/org/apache/directory/fortress/core/model/Permission.java b/src/main/java/org/apache/directory/fortress/core/model/Permission.java
index c404907..b05cfe0 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/Permission.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/Permission.java
@@ -834,7 +834,7 @@
public Set<String> getPaSets() {
if ( paSets == null )
{
- paSets = new HashSet<String>();
+ paSets = new HashSet<String>();
}
return paSets;
}
@@ -846,7 +846,7 @@
public void setPaSetName(String paSet) {
if ( paSets == null )
{
- paSets = new HashSet<String>();
+ paSets = new HashSet<String>();
}
this.paSets.add( paSet );
diff --git a/src/main/java/org/apache/directory/fortress/core/model/UserRole.java b/src/main/java/org/apache/directory/fortress/core/model/UserRole.java
index adda11c..248f210 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/UserRole.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/UserRole.java
@@ -185,56 +185,56 @@
//newer style constaint type
if(tokens[1].equals(RoleConstraint.RC_TYPE_NAME)){
- RoleConstraint rc = new RoleConstraint(tokens[5], tokens[4], RoleConstraint.RCType.valueOf( tokens[2] ),
+ RoleConstraint rc = new RoleConstraint(tokens[5], tokens[4], RoleConstraint.RCType.valueOf( tokens[2] ),
tokens[3]);
- this.getRoleConstraints().add(rc);
+ this.getRoleConstraints().add(rc);
}
else{
- for ( int i = 0; i < tokens.length; i++ )
- {
- if ( StringUtils.isNotEmpty( tokens[i] ) )
- {
- switch ( i )
- {
- case 0:
- name = tokens[i];
- parents = parentUtil.getParentsCB( name.toUpperCase(), contextId );
- break;
-
- case 1:
- timeout = Integer.parseInt( tokens[i] );
- break;
-
- case 2:
- beginTime = tokens[i];
- break;
-
- case 3:
- endTime = tokens[i];
- break;
-
- case 4:
- beginDate = tokens[i];
- break;
-
- case 5:
- endDate = tokens[i];
- break;
-
- case 6:
- beginLockDate = tokens[i];
- break;
-
- case 7:
- endLockDate = tokens[i];
- break;
-
- case 8:
- dayMask = tokens[i];
- break;
- }
- }
- }
+ for ( int i = 0; i < tokens.length; i++ )
+ {
+ if ( StringUtils.isNotEmpty( tokens[i] ) )
+ {
+ switch ( i )
+ {
+ case 0:
+ name = tokens[i];
+ parents = parentUtil.getParentsCB( name.toUpperCase(), contextId );
+ break;
+
+ case 1:
+ timeout = Integer.parseInt( tokens[i] );
+ break;
+
+ case 2:
+ beginTime = tokens[i];
+ break;
+
+ case 3:
+ endTime = tokens[i];
+ break;
+
+ case 4:
+ beginDate = tokens[i];
+ break;
+
+ case 5:
+ endDate = tokens[i];
+ break;
+
+ case 6:
+ beginLockDate = tokens[i];
+ break;
+
+ case 7:
+ endLockDate = tokens[i];
+ break;
+
+ case 8:
+ dayMask = tokens[i];
+ break;
+ }
+ }
+ }
}
}
}
@@ -249,7 +249,7 @@
@Override
public String getRawData()
{
- String delimeter = Config.getInstance().getDelimiter();
+ String delimeter = Config.getInstance().getDelimiter();
StringBuilder sb = new StringBuilder();
sb.append( name );
@@ -694,17 +694,17 @@
}
- public List<RoleConstraint> getRoleConstraints()
+ public List<RoleConstraint> getRoleConstraints()
{
- if(roleConstraints == null)
+ if(roleConstraints == null)
{
- roleConstraints = new ArrayList();
- }
- return roleConstraints;
- }
+ roleConstraints = new ArrayList();
+ }
+ return roleConstraints;
+ }
- public void setRoleConstraints(List<RoleConstraint> roleConstraints) {
- this.roleConstraints = roleConstraints;
- }
+ public void setRoleConstraints(List<RoleConstraint> roleConstraints) {
+ this.roleConstraints = roleConstraints;
+ }
}
diff --git a/src/main/java/org/apache/directory/fortress/core/rest/AdminMgrRestImpl.java b/src/main/java/org/apache/directory/fortress/core/rest/AdminMgrRestImpl.java
index 652bb7f..2117cf6 100644
--- a/src/main/java/org/apache/directory/fortress/core/rest/AdminMgrRestImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/rest/AdminMgrRestImpl.java
@@ -1052,8 +1052,8 @@
/**
* {@inheritDoc}
*/
- @Override
- public RoleConstraint addRoleConstraint(UserRole uRole, RoleConstraint roleConstraint)
+ @Override
+ public RoleConstraint addRoleConstraint(UserRole uRole, RoleConstraint roleConstraint)
throws SecurityException
{
VUtil.assertNotNull( uRole, GlobalErrIds.URLE_NULL, CLS_NM + ".addRoleConstraint" );
@@ -1074,14 +1074,14 @@
throw new SecurityException( response.getErrorCode(), response.getErrorMessage() );
}
return retCnst;
- }
+ }
/**
* {@inheritDoc}
*/
- @Override
- public void removeRoleConstraint( UserRole uRole, RoleConstraint roleConstraint ) throws SecurityException
+ @Override
+ public void removeRoleConstraint( UserRole uRole, RoleConstraint roleConstraint ) throws SecurityException
{
VUtil.assertNotNull( uRole, GlobalErrIds.URLE_NULL, CLS_NM + ".removeRoleConstraint" );
VUtil.assertNotNull( roleConstraint, GlobalErrIds.RCON_NULL, CLS_NM + ".removeRoleConstraint" );
@@ -1095,14 +1095,14 @@
{
throw new SecurityException( response.getErrorCode(), response.getErrorMessage() );
}
- }
+ }
/**
* {@inheritDoc}
*/
- @Override
- public PermissionAttributeSet addPermissionAttributeSet( PermissionAttributeSet permAttributeSet )
+ @Override
+ public PermissionAttributeSet addPermissionAttributeSet( PermissionAttributeSet permAttributeSet )
throws SecurityException
{
VUtil.assertNotNull( permAttributeSet, GlobalErrIds.PERM_ATTRIBUTE_SET_NULL, CLS_NM + ".addPermissionAttributeSet" );
@@ -1121,15 +1121,15 @@
throw new SecurityException( response.getErrorCode(), response.getErrorMessage() );
}
return retSet;
- }
+ }
/**
* {@inheritDoc}
*/
- @Override
- public void deletePermissionAttributeSet(
- PermissionAttributeSet permAttributeSet) throws SecurityException
+ @Override
+ public void deletePermissionAttributeSet(
+ PermissionAttributeSet permAttributeSet) throws SecurityException
{
VUtil.assertNotNull( permAttributeSet, GlobalErrIds.PERM_ATTRIBUTE_SET_NULL, CLS_NM + ".deletePermissionAttributeSet" );
FortRequest request = RestUtils.getRequest( this.contextId );
@@ -1141,15 +1141,15 @@
{
throw new SecurityException( response.getErrorCode(), response.getErrorMessage() );
}
- }
+ }
/**
* {@inheritDoc}
*/
- @Override
- public PermissionAttribute addPermissionAttributeToSet( PermissionAttribute permAttribute, String attributeSetName )
- throws SecurityException
+ @Override
+ public PermissionAttribute addPermissionAttributeToSet( PermissionAttribute permAttribute, String attributeSetName )
+ throws SecurityException
{
VUtil.assertNotNull( permAttribute, GlobalErrIds.PERM_ATTRIBUTE_SET_NULL, CLS_NM + ".addPermissionAttributeToSet" );
VUtil.assertNotNull( attributeSetName, GlobalErrIds.PERM_ATTRIBUTE_SET_NM_NULL, CLS_NM + ".addPermissionAttributeToSet" );
@@ -1169,15 +1169,15 @@
throw new SecurityException( response.getErrorCode(), response.getErrorMessage() );
}
return retAttr;
- }
+ }
/**
* {@inheritDoc}
*/
- @Override
- public void removePermissionAttributeFromSet( PermissionAttribute permAttribute, String attributeSetName )
- throws SecurityException
+ @Override
+ public void removePermissionAttributeFromSet( PermissionAttribute permAttribute, String attributeSetName )
+ throws SecurityException
{
VUtil.assertNotNull( permAttribute, GlobalErrIds.PERM_ATTRIBUTE_SET_NULL, CLS_NM + ".removePermissionAttributeFromSet" );
VUtil.assertNotNull( attributeSetName, GlobalErrIds.PERM_ATTRIBUTE_SET_NM_NULL, CLS_NM + ".removePermissionAttributeFromSet" );
@@ -1191,14 +1191,14 @@
{
throw new SecurityException( response.getErrorCode(), response.getErrorMessage() );
}
- }
+ }
/**
* {@inheritDoc}
*/
- @Override
- public void updatePermissionAttributeInSet(PermissionAttribute permAttribute, String attributeSetName, boolean replaceValidValues)
+ @Override
+ public void updatePermissionAttributeInSet(PermissionAttribute permAttribute, String attributeSetName, boolean replaceValidValues)
throws SecurityException
{
VUtil.assertNotNull( permAttribute, GlobalErrIds.PERM_ATTRIBUTE_SET_NULL, CLS_NM + ".updatePermissionAttributeInSet" );
@@ -1215,7 +1215,7 @@
{
throw new SecurityException( response.getErrorCode(), response.getErrorMessage() );
}
- }
+ }
/**
diff --git a/src/main/java/org/apache/directory/fortress/core/rest/DelReviewMgrRestImpl.java b/src/main/java/org/apache/directory/fortress/core/rest/DelReviewMgrRestImpl.java
index ab85bb7..eba8429 100644
--- a/src/main/java/org/apache/directory/fortress/core/rest/DelReviewMgrRestImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/rest/DelReviewMgrRestImpl.java
@@ -224,18 +224,20 @@
}
- @Override
- public List<Permission> rolePermissions(AdminRole role)
- throws SecurityException {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public List<Permission> rolePermissions(AdminRole role)
+ throws SecurityException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public List<Permission> rolePermissions(AdminRole role,
- boolean noInheritance) throws SecurityException {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public List<Permission> rolePermissions(AdminRole role,
+ boolean noInheritance) throws SecurityException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/apache/directory/fortress/core/rest/ReviewMgrRestImpl.java b/src/main/java/org/apache/directory/fortress/core/rest/ReviewMgrRestImpl.java
index 358095b..a2f2760 100755
--- a/src/main/java/org/apache/directory/fortress/core/rest/ReviewMgrRestImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/rest/ReviewMgrRestImpl.java
@@ -680,8 +680,8 @@
/**
* {@inheritDoc}
*/
- @Override
- public List<PermissionAttributeSet> rolePermissionAttributeSets(Role role, boolean noInhertiance)
+ @Override
+ public List<PermissionAttributeSet> rolePermissionAttributeSets(Role role, boolean noInhertiance)
throws SecurityException
{
VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".rolePermissionAttributeSets");
@@ -702,7 +702,7 @@
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retAttrSets;
- }
+ }
/**
* {@inheritDoc}
@@ -1134,8 +1134,8 @@
/**
* {@inheritDoc}
*/
- @Override
- public PermissionAttributeSet readPermAttributeSet( PermissionAttributeSet permAttributeSet )
+ @Override
+ public PermissionAttributeSet readPermAttributeSet( PermissionAttributeSet permAttributeSet )
throws SecurityException
{
{
@@ -1157,15 +1157,15 @@
}
return retPermSet;
}
- }
+ }
/**
* {@inheritDoc}
*/
- @Override
- public List<RoleConstraint> findRoleConstraints( User user, Permission permission, RoleConstraint.RCType rcType )
- throws SecurityException
+ @Override
+ public List<RoleConstraint> findRoleConstraints( User user, Permission permission, RoleConstraint.RCType rcType )
+ throws SecurityException
{
VUtil.assertNotNull(user, GlobalErrIds.USER_NULL, CLS_NM + ".findRoleConstraints");
VUtil.assertNotNull(user, GlobalErrIds.PERM_NULL, CLS_NM + ".findRoleConstraints");
@@ -1188,7 +1188,7 @@
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retConstraints;
- }
+ }
@Override
diff --git a/src/main/java/org/apache/directory/fortress/core/util/EncryptUtil.java b/src/main/java/org/apache/directory/fortress/core/util/EncryptUtil.java
index c44a6e6..1b79a9b 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/EncryptUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/EncryptUtil.java
@@ -41,7 +41,7 @@
{
if(sINSTANCE == null)
{
- sINSTANCE = new EncryptUtil();
+ sINSTANCE = new EncryptUtil();
}
}
}
diff --git a/src/main/java/org/apache/directory/fortress/core/util/RegExUtil.java b/src/main/java/org/apache/directory/fortress/core/util/RegExUtil.java
index 8ef432c..4739868 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/RegExUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/RegExUtil.java
@@ -52,8 +52,9 @@
{
synchronized (RegExUtil.class)
{
- if(sINSTANCE == null){
- sINSTANCE = new RegExUtil();
+ if(sINSTANCE == null)
+ {
+ sINSTANCE = new RegExUtil();
}
}
}
@@ -62,8 +63,8 @@
private void init()
{
- SAFE_TEXT_PATTERN_STRING = Config.getInstance().getProperty( GlobalIds.REG_EX_SAFE_TEXT );
-
+ SAFE_TEXT_PATTERN_STRING = Config.getInstance().getProperty( GlobalIds.REG_EX_SAFE_TEXT );
+
if ( ( SAFE_TEXT_PATTERN_STRING != null ) && ( SAFE_TEXT_PATTERN_STRING.length() != 0 ) )
{
safeTextPattern = Pattern.compile( SAFE_TEXT_PATTERN_STRING );
@@ -76,7 +77,7 @@
*/
private RegExUtil()
{
- init();
+ init();
}
/**
diff --git a/src/main/java/org/apache/directory/fortress/core/util/VUtil.java b/src/main/java/org/apache/directory/fortress/core/util/VUtil.java
index d286101..47f2fd7 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/VUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/VUtil.java
@@ -97,7 +97,7 @@
{
if(sINSTANCE == null)
{
- sINSTANCE = new VUtil();
+ sINSTANCE = new VUtil();
}
}
}
@@ -132,7 +132,7 @@
*/
private VUtil()
{
- init();
+ init();
}
/**
diff --git a/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java b/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java
index 6b38bc1..da85a4a 100644
--- a/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java
@@ -104,7 +104,7 @@
*/
private CacheMgr()
{
- init();
+ init();
}
/**
@@ -114,15 +114,15 @@
* @return reference to cache for specified object.
*/
public Cache getCache( String cacheName )
- {
+ {
Ehcache cache = mEhCacheImpl.getEhcache( cacheName );
if(cache != null)
{
- return new EhCacheImpl( cacheName, new BlockingCache(cache) );
+ return new EhCacheImpl( cacheName, new BlockingCache(cache) );
}
else
{
- return CacheFactory.createInstance( cacheName, mEhCacheImpl );
+ return CacheFactory.createInstance( cacheName, mEhCacheImpl );
}
}
diff --git a/src/main/java/org/apache/directory/fortress/core/util/cache/EhCacheImpl.java b/src/main/java/org/apache/directory/fortress/core/util/cache/EhCacheImpl.java
index d2d7d55..4d21840 100644
--- a/src/main/java/org/apache/directory/fortress/core/util/cache/EhCacheImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/cache/EhCacheImpl.java
@@ -41,7 +41,7 @@
{
private static final String CLS_NM = EhCacheImpl.class.getName();
private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
-
+
private BlockingCache cache;
private final String name;
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/AdminMgrImplTest.java b/src/test/java/org/apache/directory/fortress/core/impl/AdminMgrImplTest.java
index fc42245..5baa762 100755
--- a/src/test/java/org/apache/directory/fortress/core/impl/AdminMgrImplTest.java
+++ b/src/test/java/org/apache/directory/fortress/core/impl/AdminMgrImplTest.java
@@ -2011,145 +2011,145 @@
}
public void testAddPermissionAttributeSet() throws SecurityException
- {
- addPermissionAttributeSet( "ADD-PA-SET TPASET1", PermTestData.TPA_SET_1_NAME, PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET1));
- addPermissionAttributeSet( "ADD-PA-SET TPASET2", PermTestData.TPA_SET_2_NAME, PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET2));
+ {
+ addPermissionAttributeSet( "ADD-PA-SET TPASET1", PermTestData.TPA_SET_1_NAME, PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET1));
+ addPermissionAttributeSet( "ADD-PA-SET TPASET2", PermTestData.TPA_SET_2_NAME, PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET2));
}
public static void addPermissionAttributeSet( String msg, String name, Set<PermissionAttribute> permAttr )
{
- LogUtil.logIt(msg);
- PermissionAttributeSet paSet = new PermissionAttributeSet(name);
- paSet.setType(PermTestData.TPA_SET_TYPE);
-
- try
- {
- paSet.setAttributes(permAttr);
- //AdminMgr adminMgr = AdminMgrFactory.createInstance( TestUtils.getContext() );
+ LogUtil.logIt(msg);
+ PermissionAttributeSet paSet = new PermissionAttributeSet(name);
+ paSet.setType(PermTestData.TPA_SET_TYPE);
+
+ try
+ {
+ paSet.setAttributes(permAttr);
+ //AdminMgr adminMgr = AdminMgrFactory.createInstance( TestUtils.getContext() );
AdminMgr adminMgr = getManagedAdminMgr();
- adminMgr.addPermissionAttributeSet(paSet);
- LOG.debug( "addPermissionAttributeSet name [" + paSet.getName() + "] successful" );
- }
- catch ( SecurityException ex )
- {
- LOG.error( "addPermissionAttributeSet name [" + paSet.getName()
- + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
- fail( ex.getMessage() );
- }
+ adminMgr.addPermissionAttributeSet(paSet);
+ LOG.debug( "addPermissionAttributeSet name [" + paSet.getName() + "] successful" );
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "addPermissionAttributeSet name [" + paSet.getName()
+ + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
+ fail( ex.getMessage() );
+ }
}
public void testAddPermissionAttributeToSet() throws SecurityException
- {
- Set<PermissionAttribute> pas = PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET2_ADDITIONAL);
-
- for(PermissionAttribute pa : pas){
- addPermissionAttributeToSet( "ADD-PA-TO-SET TPASET2", PermTestData.TPA_SET_2_NAME, pa);
- }
+ {
+ Set<PermissionAttribute> pas = PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET2_ADDITIONAL);
+
+ for(PermissionAttribute pa : pas){
+ addPermissionAttributeToSet( "ADD-PA-TO-SET TPASET2", PermTestData.TPA_SET_2_NAME, pa);
+ }
}
public static void addPermissionAttributeToSet( String msg, String name, PermissionAttribute permAttr )
{
- LogUtil.logIt(msg);
- PermissionAttributeSet paSet = new PermissionAttributeSet(name);
- try
- {
- //AdminMgr adminMgr = AdminMgrFactory.createInstance( TestUtils.getContext() );
+ LogUtil.logIt(msg);
+ PermissionAttributeSet paSet = new PermissionAttributeSet(name);
+ try
+ {
+ //AdminMgr adminMgr = AdminMgrFactory.createInstance( TestUtils.getContext() );
AdminMgr adminMgr = getManagedAdminMgr();
- adminMgr.addPermissionAttributeToSet(permAttr, name);
- LOG.debug( "addPermissionAttributeToSet name [" + paSet.getName() + "] successful" );
- }
- catch ( SecurityException ex )
- {
- LOG.error( "addPermissionAttributeToSet name [" + paSet.getName()
- + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
- fail( ex.getMessage() );
- }
+ adminMgr.addPermissionAttributeToSet(permAttr, name);
+ LOG.debug( "addPermissionAttributeToSet name [" + paSet.getName() + "] successful" );
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "addPermissionAttributeToSet name [" + paSet.getName()
+ + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
+ fail( ex.getMessage() );
+ }
}
public void testDeletePermissionAttributeSets() throws SecurityException
{
- delPermAttrSet( "DEL-PA-SET TPASET1" , PermTestData.TPA_SET_1_NAME );
- delPermAttrSet( "DEL-PA-SET TPASET2" , PermTestData.TPA_SET_2_NAME );
+ delPermAttrSet( "DEL-PA-SET TPASET1" , PermTestData.TPA_SET_1_NAME );
+ delPermAttrSet( "DEL-PA-SET TPASET2" , PermTestData.TPA_SET_2_NAME );
}
public static void delPermAttrSet( String msg, String name )
{
- LogUtil.logIt(msg);
- PermissionAttributeSet paSet = new PermissionAttributeSet(name);
- try
- {
- //AdminMgr adminMgr = AdminMgrFactory.createInstance( TestUtils.getContext() );
+ LogUtil.logIt(msg);
+ PermissionAttributeSet paSet = new PermissionAttributeSet(name);
+ try
+ {
+ //AdminMgr adminMgr = AdminMgrFactory.createInstance( TestUtils.getContext() );
AdminMgr adminMgr = getManagedAdminMgr();
- adminMgr.deletePermissionAttributeSet(paSet);
- LOG.debug( "delPermAttrSet name [" + paSet.getName() + "] successful" );
- }
- catch ( SecurityException ex )
- {
- LOG.error( "delPermAttrSet name [" + paSet.getName()
- + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
- fail( ex.getMessage() );
- }
+ adminMgr.deletePermissionAttributeSet(paSet);
+ LOG.debug( "delPermAttrSet name [" + paSet.getName() + "] successful" );
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "delPermAttrSet name [" + paSet.getName()
+ + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
+ fail( ex.getMessage() );
+ }
}
public void testAddPASetToPermission()
{
- addValidPASetToPermission( "ADD-PASET-TO-POP-VALID TOB_1 TOP_1", PermTestData.TPA_SET_1_NAME, "TOB1_1", PermTestData.OPS_TOP1_UPD[0] );
- addInvalidPASetToPermission( "ADD-PASET-TO-POP-INVALID TOB_1 TOP_1", PermTestData.TPA_SET_NOT_EXIST_NAME, "TOB1_1", PermTestData.OPS_TOP1_UPD[0] );
+ addValidPASetToPermission( "ADD-PASET-TO-POP-VALID TOB_1 TOP_1", PermTestData.TPA_SET_1_NAME, "TOB1_1", PermTestData.OPS_TOP1_UPD[0] );
+ addInvalidPASetToPermission( "ADD-PASET-TO-POP-INVALID TOB_1 TOP_1", PermTestData.TPA_SET_NOT_EXIST_NAME, "TOB1_1", PermTestData.OPS_TOP1_UPD[0] );
}
public static void addInvalidPASetToPermission( String msg, String paSetName, String obj, String[] op )
{
- try{
- addPASetToPermission(msg, paSetName, obj, op);
-
- String message = "addInvalidPASetToPermission name [" + paSetName + "] was successfull, when should ahve failed.";
- LOG.error( message );
- fail( message );
- }
- catch ( SecurityException ex )
- {
- LOG.info("Caught exception adding invalid tpa set name " + paSetName);
- }
+ try{
+ addPASetToPermission(msg, paSetName, obj, op);
+
+ String message = "addInvalidPASetToPermission name [" + paSetName + "] was successfull, when should ahve failed.";
+ LOG.error( message );
+ fail( message );
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.info("Caught exception adding invalid tpa set name " + paSetName);
+ }
}
public static void addValidPASetToPermission( String msg, String paSetName, String obj, String[] op )
{
- try{
- addPASetToPermission(msg, paSetName, obj, op);
- }
- catch ( SecurityException ex )
- {
- LOG.error( "addValidPASetToPermission name [" + paSetName
- + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
- fail( ex.getMessage() );
- }
+ try{
+ addPASetToPermission(msg, paSetName, obj, op);
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "addValidPASetToPermission name [" + paSetName
+ + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
+ fail( ex.getMessage() );
+ }
}
public static void addPASetToPermission( String msg, String paSetName, String obj, String[] op ) throws SecurityException
{
- LogUtil.logIt(msg);
+ LogUtil.logIt(msg);
- //AdminMgr adminMgr = AdminMgrFactory.createInstance( TestUtils.getContext() );
+ //AdminMgr adminMgr = AdminMgrFactory.createInstance( TestUtils.getContext() );
AdminMgr adminMgr = getManagedAdminMgr();
- Permission pop = PermTestData.getOp( obj, op );
- pop.setPaSetName(paSetName);
+ Permission pop = PermTestData.getOp( obj, op );
+ pop.setPaSetName(paSetName);
- adminMgr.updatePermission(pop);
- LOG.debug( "addPASetToPermission name [" + paSetName + "] successful" );
+ adminMgr.updatePermission(pop);
+ LOG.debug( "addPASetToPermission name [" + paSetName + "] successful" );
}
public void testAddUserRoleConstraint() throws SecurityException
{
- assignValidUserRoleConstraint( "ASGN-URC-VALID TU1 TR1", UserTestData.USERS_TU1[0], RoleTestData.ROLES_TR1[1], URATestData.getRC(URATestData.URC_T1) );
-
- assignInvalidUserRoleConstraint( "ASGN-URC-INVALID TU1 TR1", UserTestData.USERS_TU1[0], RoleTestData.ROLES_TR1[1], URATestData.getRC(URATestData.URC_T1_INVALID) );
+ assignValidUserRoleConstraint( "ASGN-URC-VALID TU1 TR1", UserTestData.USERS_TU1[0], RoleTestData.ROLES_TR1[1], URATestData.getRC(URATestData.URC_T1) );
+
+ assignInvalidUserRoleConstraint( "ASGN-URC-INVALID TU1 TR1", UserTestData.USERS_TU1[0], RoleTestData.ROLES_TR1[1], URATestData.getRC(URATestData.URC_T1_INVALID) );
}
public static void assignValidUserRoleConstraint( String msg, String[] usr, String[] rle, RoleConstraint rc )
{
- try{
- assignUserRoleConstraint(msg, usr, rle, rc);
- }
+ try{
+ assignUserRoleConstraint(msg, usr, rle, rc);
+ }
catch ( SecurityException ex )
{
LOG.error(
@@ -2162,43 +2162,43 @@
public static void assignInvalidUserRoleConstraint( String msg, String[] usr, String[] rle, RoleConstraint rc )
{
- try{
- assignUserRoleConstraint(msg, usr, rle, rc);
-
- String message = "assignInvalidUserRoleConstraint name [" + rc.getKey() + "] was successfull, when should ahve failed.";
- LOG.error( message );
- fail( message );
- }
- catch ( SecurityException ex )
- {
- LOG.info("Caught exception adding invalid tpa set name " + rc.getKey());
- }
+ try{
+ assignUserRoleConstraint(msg, usr, rle, rc);
+
+ String message = "assignInvalidUserRoleConstraint name [" + rc.getKey() + "] was successfull, when should ahve failed.";
+ LOG.error( message );
+ fail( message );
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.info("Caught exception adding invalid tpa set name " + rc.getKey());
+ }
}
public static RoleConstraint assignUserRoleConstraint( String msg, String[] usr, String[] rle, RoleConstraint rc ) throws SecurityException
{
- LogUtil.logIt( msg );
+ LogUtil.logIt( msg );
- AdminMgr adminMgr = getManagedAdminMgr();
- ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
+ AdminMgr adminMgr = getManagedAdminMgr();
+ ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
- User user = UserTestData.getUser( usr );
- Role role = RoleTestData.getRole( rle );
+ User user = UserTestData.getUser( usr );
+ Role role = RoleTestData.getRole( rle );
- RoleConstraint createdRoleConstraint = adminMgr.addRoleConstraint(new UserRole(user.getUserId(), role.getName()), rc);
-
- LOG.debug("assignUserRoleConstraint user [" + user.getUserId() + "] role [" + role.getName() + "] " +
- " rcvalue [" + rc.getValue() + "]");
+ RoleConstraint createdRoleConstraint = adminMgr.addRoleConstraint(new UserRole(user.getUserId(), role.getName()), rc);
+
+ LOG.debug("assignUserRoleConstraint user [" + user.getUserId() + "] role [" + role.getName() + "] " +
+ " rcvalue [" + rc.getValue() + "]");
- // Use the returned 'createdRoleConstraint' from addRoleConstraint method call, not its argument -- 'rc'.
- // Otherwise this will fail over REST, because the 'rc' won't have its 'id' field set, which is needed for this search to yield correct results.
+ // Use the returned 'createdRoleConstraint' from addRoleConstraint method call, not its argument -- 'rc'.
+ // Otherwise this will fail over REST, because the 'rc' won't have its 'id' field set, which is needed for this search to yield correct results.
// get user with consratint filter:
- List<User> usersWithRc = reviewMgr.assignedUsers( role, createdRoleConstraint );
- assertTrue( usersWithRc.size() == 1 );
- assertEquals( user.getUserId(), usersWithRc.get( 0 ).getUserId() );
-
- return createdRoleConstraint;
+ List<User> usersWithRc = reviewMgr.assignedUsers( role, createdRoleConstraint );
+ assertTrue( usersWithRc.size() == 1 );
+ assertEquals( user.getUserId(), usersWithRc.get( 0 ).getUserId() );
+
+ return createdRoleConstraint;
}
public void testRemoveUserRoleConstraint() throws SecurityException
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/PermTestData.java b/src/test/java/org/apache/directory/fortress/core/impl/PermTestData.java
index 5be2ff2..a0ef1bf 100755
--- a/src/test/java/org/apache/directory/fortress/core/impl/PermTestData.java
+++ b/src/test/java/org/apache/directory/fortress/core/impl/PermTestData.java
@@ -3305,49 +3305,49 @@
public static final String[][] PA_TPSASET1 =
{
- {
- "TPASET1AttributeName1", /* NAME */
- "true", /* REQUIRED */
- "string", /* DATA_TYPE */
- "EQUALS", /* COMPARISON_OPERATOR */
- "literal:value" /* VALID_VALUE */
- }
+ {
+ "TPASET1AttributeName1", /* NAME */
+ "true", /* REQUIRED */
+ "string", /* DATA_TYPE */
+ "EQUALS", /* COMPARISON_OPERATOR */
+ "literal:value" /* VALID_VALUE */
+ }
};
public static final String[][] PA_TPSASET2 =
{
- {
- "TPASET2AttributeName1", /* NAME */
- "true", /* REQUIRED */
- "string", /* DATA_TYPE */
- "EQUALS", /* COMPARISON_OPERATOR */
- "literal:value" /* VALID_VALUE */
- },
- {
- "TPASET2AttributeName2", /* NAME */
- "false", /* REQUIRED */
- "int", /* DATA_TYPE */
- "EQUALS", /* COMPARISON_OPERATOR */
- "literal:value" /* VALID_VALUE */
- }
+ {
+ "TPASET2AttributeName1", /* NAME */
+ "true", /* REQUIRED */
+ "string", /* DATA_TYPE */
+ "EQUALS", /* COMPARISON_OPERATOR */
+ "literal:value" /* VALID_VALUE */
+ },
+ {
+ "TPASET2AttributeName2", /* NAME */
+ "false", /* REQUIRED */
+ "int", /* DATA_TYPE */
+ "EQUALS", /* COMPARISON_OPERATOR */
+ "literal:value" /* VALID_VALUE */
+ }
};
public static final String[][] PA_TPSASET2_ADDITIONAL =
{
- {
- "TPASET2AttributeName3", /* NAME */
- "true", /* REQUIRED */
- "string", /* DATA_TYPE */
- "EQUALS", /* COMPARISON_OPERATOR */
- "literal:value" /* VALID_VALUE */
- },
- {
- "TPASET2AttributeName4", /* NAME */
- "false", /* REQUIRED */
- "int", /* DATA_TYPE */
- "EQUALS", /* COMPARISON_OPERATOR */
- "literal:value" /* VALID_VALUE */
- }
+ {
+ "TPASET2AttributeName3", /* NAME */
+ "true", /* REQUIRED */
+ "string", /* DATA_TYPE */
+ "EQUALS", /* COMPARISON_OPERATOR */
+ "literal:value" /* VALID_VALUE */
+ },
+ {
+ "TPASET2AttributeName4", /* NAME */
+ "false", /* REQUIRED */
+ "int", /* DATA_TYPE */
+ "EQUALS", /* COMPARISON_OPERATOR */
+ "literal:value" /* VALID_VALUE */
+ }
};
public static PermissionAttribute getPA( String[] pa )
@@ -3499,15 +3499,15 @@
}
public static Set<PermissionAttribute> loadPermissionAttributes(String[][] objArray){
- Set<PermissionAttribute> permAttrs = new HashSet<PermissionAttribute>();
-
- for ( String[] obj : objArray )
+ Set<PermissionAttribute> permAttrs = new HashSet<PermissionAttribute>();
+
+ for ( String[] obj : objArray )
{
- PermissionAttribute pa = PermTestData.getPA(obj);
- permAttrs.add(pa);
+ PermissionAttribute pa = PermTestData.getPA(obj);
+ permAttrs.add(pa);
}
-
- return permAttrs;
+
+ return permAttrs;
}
}
\ No newline at end of file
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/ReviewMgrImplTest.java b/src/test/java/org/apache/directory/fortress/core/impl/ReviewMgrImplTest.java
index 1410723..3254551 100755
--- a/src/test/java/org/apache/directory/fortress/core/impl/ReviewMgrImplTest.java
+++ b/src/test/java/org/apache/directory/fortress/core/impl/ReviewMgrImplTest.java
@@ -168,11 +168,11 @@
public void testReadPermissionAttributeSets()
{
- readPermissionAttributeSet( "RD-PA-SET TPASET1", PermTestData.TPA_SET_1_NAME, PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET1) );
+ readPermissionAttributeSet( "RD-PA-SET TPASET1", PermTestData.TPA_SET_1_NAME, PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET1) );
- Set<PermissionAttribute> paSetTwoPas = PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET2);
- paSetTwoPas.addAll(PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET2_ADDITIONAL));
- readPermissionAttributeSet( "RD-PA-SET TPASET2", PermTestData.TPA_SET_2_NAME, paSetTwoPas);
+ Set<PermissionAttribute> paSetTwoPas = PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET2);
+ paSetTwoPas.addAll(PermTestData.loadPermissionAttributes(PermTestData.PA_TPSASET2_ADDITIONAL));
+ readPermissionAttributeSet( "RD-PA-SET TPASET2", PermTestData.TPA_SET_2_NAME, paSetTwoPas);
}
public static void readPermissionAttributeSet( String msg, String name, Set<PermissionAttribute> permAttributes )
@@ -188,7 +188,7 @@
assertEquals(PermTestData.TPA_SET_TYPE, entity.getType());
for(PermissionAttribute pa : permAttributes){
- assertTrue(entity.getAttributes().contains(pa));
+ assertTrue(entity.getAttributes().contains(pa));
}
LOG.debug( "readPermissionAttributeSet name [" + name + "] successful" );
@@ -204,29 +204,29 @@
public void testReadPASetFromPermission()
{
- readPASetFromPermission( "RD-PASET-FROM-POP TOB_1 TOP_1", PermTestData.TPA_SET_1_NAME, "TOB1_1", PermTestData.OPS_TOP1[0] );
+ readPASetFromPermission( "RD-PASET-FROM-POP TOB_1 TOP_1", PermTestData.TPA_SET_1_NAME, "TOB1_1", PermTestData.OPS_TOP1[0] );
}
public static void readPASetFromPermission( String msg, String paSetName, String obj, String[] op )
{
- LogUtil.logIt(msg);
- try
- {
- ReviewMgr reviewMgr = getManagedReviewMgr();
+ LogUtil.logIt(msg);
+ try
+ {
+ ReviewMgr reviewMgr = getManagedReviewMgr();
- Permission pop = PermTestData.getOp( obj, op );
+ Permission pop = PermTestData.getOp( obj, op );
- Permission entity = reviewMgr.readPermission(pop);
- assertTrue(paSetName, entity.getPaSets().contains(paSetName));
-
- LOG.debug( "readPASetFromPermission name [" + paSetName + "] successful" );
- }
- catch ( SecurityException ex )
- {
- LOG.error( "readPASetFromPermission name [" + paSetName
- + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
- fail( ex.getMessage() );
- }
+ Permission entity = reviewMgr.readPermission(pop);
+ assertTrue(paSetName, entity.getPaSets().contains(paSetName));
+
+ LOG.debug( "readPASetFromPermission name [" + paSetName + "] successful" );
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "readPASetFromPermission name [" + paSetName
+ + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
+ fail( ex.getMessage() );
+ }
}
public void testFindPermissionOps()
@@ -1616,54 +1616,54 @@
public void testReadUserRoleConstraint()
{
- readUserRoleConstraint( "RD-URC TU1 TR1", UserTestData.USERS_TU1[0], RoleTestData.ROLES_TR1[1], URATestData
+ readUserRoleConstraint( "RD-URC TU1 TR1", UserTestData.USERS_TU1[0], RoleTestData.ROLES_TR1[1], URATestData
.getRC( URATestData.URC_T1 ) );
}
public static void readUserRoleConstraint( String msg, String[] usr, String[] rle, RoleConstraint rc )
{
- LogUtil.logIt( msg );
- try
- {
- ReviewMgr reviewMgr = getManagedReviewMgr();
- User user = UserTestData.getUser( usr );
- Role role = RoleTestData.getRole( rle );
-
- List<UserRole> urs = reviewMgr.assignedRoles(user);
- boolean uraFound = false;
- boolean urcFound = false;
-
- for(UserRole ur : urs){
- if(ur.getName().equals(role.getName())){
- uraFound = true;
-
- List<RoleConstraint> rcs = ur.getRoleConstraints();
- for(RoleConstraint r : rcs){
- if(r.getKey().equals(rc.getKey())){
- urcFound = true;
- assertEquals(rc.getType(), r.getType());
- assertEquals(rc.getValue(), r.getValue());
- assertNotNull( r.getId() );
- }
- }
- }
- }
-
- if(!uraFound){
- fail("User Role Assignment Not Found");
- }
- if(!urcFound){
- fail("User Role Constraint Not Found");
- }
-
- LOG.debug( "readUserRoleConstraint value [" + rc.getValue() + "] successful" );
- }
- catch ( SecurityException ex )
- {
- LOG.error( "readUserRoleConstraint value [" + rc.getValue()
- + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
- fail( ex.getMessage() );
- }
+ LogUtil.logIt( msg );
+ try
+ {
+ ReviewMgr reviewMgr = getManagedReviewMgr();
+ User user = UserTestData.getUser( usr );
+ Role role = RoleTestData.getRole( rle );
+
+ List<UserRole> urs = reviewMgr.assignedRoles(user);
+ boolean uraFound = false;
+ boolean urcFound = false;
+
+ for(UserRole ur : urs){
+ if(ur.getName().equals(role.getName())){
+ uraFound = true;
+
+ List<RoleConstraint> rcs = ur.getRoleConstraints();
+ for(RoleConstraint r : rcs){
+ if(r.getKey().equals(rc.getKey())){
+ urcFound = true;
+ assertEquals(rc.getType(), r.getType());
+ assertEquals(rc.getValue(), r.getValue());
+ assertNotNull( r.getId() );
+ }
+ }
+ }
+ }
+
+ if(!uraFound){
+ fail("User Role Assignment Not Found");
+ }
+ if(!urcFound){
+ fail("User Role Constraint Not Found");
+ }
+
+ LOG.debug( "readUserRoleConstraint value [" + rc.getValue() + "] successful" );
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "readUserRoleConstraint value [" + rc.getValue()
+ + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
+ fail( ex.getMessage() );
+ }
}
public void testAssignedUserRoleConstraints()
@@ -1722,32 +1722,32 @@
public void testFindRoleConstraints()
{
- findRoleConstraints( "SRCH-RCS TU1 TR1", UserTestData.USERS_TU1[0][0], PermTestData.getOp("TOB1_1", PermTestData.OPS_TOP1_UPD[0]), URATestData.getRC(URATestData.URC_T1).getType() );
- findUserRoleWithConstraints( "SRCH-RCS TR1", RoleTestData.ROLES_TR1[1][0], URATestData.getRC( URATestData.URC_T1 ).getType(), URATestData.getRC( URATestData.URC_T1 ).getKey() );
- findUserRoleWithConstraints( "SRCH-RCS TR18 ABAC", RoleTestData.ROLES_ABAC_WASHERS[0][0], RoleConstraint.RCType.USER, RoleTestData.ROLE_CONSTRAINTS_TR18_ABAC[0][2] );
- findUserRoleWithConstraints( "SRCH-RCS TR18 ABAC", RoleTestData.ROLES_ABAC_TELLERS[0][0], RoleConstraint.RCType.USER, RoleTestData.ROLE_CONSTRAINTS_TR18_ABAC[0][2] );
+ findRoleConstraints( "SRCH-RCS TU1 TR1", UserTestData.USERS_TU1[0][0], PermTestData.getOp("TOB1_1", PermTestData.OPS_TOP1_UPD[0]), URATestData.getRC(URATestData.URC_T1).getType() );
+ findUserRoleWithConstraints( "SRCH-RCS TR1", RoleTestData.ROLES_TR1[1][0], URATestData.getRC( URATestData.URC_T1 ).getType(), URATestData.getRC( URATestData.URC_T1 ).getKey() );
+ findUserRoleWithConstraints( "SRCH-RCS TR18 ABAC", RoleTestData.ROLES_ABAC_WASHERS[0][0], RoleConstraint.RCType.USER, RoleTestData.ROLE_CONSTRAINTS_TR18_ABAC[0][2] );
+ findUserRoleWithConstraints( "SRCH-RCS TR18 ABAC", RoleTestData.ROLES_ABAC_TELLERS[0][0], RoleConstraint.RCType.USER, RoleTestData.ROLE_CONSTRAINTS_TR18_ABAC[0][2] );
}
public static void findUserRoleWithConstraints( String msg, String role, RoleConstraint.RCType rcType, String keyName )
{
- LogUtil.logIt(msg);
- try
- {
- ReviewMgr reviewMgr = getManagedReviewMgr();
+ LogUtil.logIt(msg);
+ try
+ {
+ ReviewMgr reviewMgr = getManagedReviewMgr();
- List<UserRole> urs = reviewMgr.assignedUsers( new Role(role), rcType, keyName);
+ List<UserRole> urs = reviewMgr.assignedUsers( new Role(role), rcType, keyName);
assertNotNull( "findUserRoleWithConstraints no results", urs );
assertTrue(urs.size() > 0);
- assertTrue(urs.get(0).getRoleConstraints().size() > 0);
+ assertTrue(urs.get(0).getRoleConstraints().size() > 0);
- LOG.debug( "findUserRoleWithConstraints paSetName [" + keyName + "] successful" );
- }
- catch ( SecurityException ex )
- {
- LOG.error( "findUserRoleWithConstraints paSetName [" + keyName
- + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
- fail( ex.getMessage() );
- }
+ LOG.debug( "findUserRoleWithConstraints paSetName [" + keyName + "] successful" );
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "findUserRoleWithConstraints paSetName [" + keyName
+ + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
+ fail( ex.getMessage() );
+ }
}
public static void findRoleConstraints( String msg, String usr, Permission permission, RoleConstraint.RCType rcType )
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/URATestData.java b/src/test/java/org/apache/directory/fortress/core/impl/URATestData.java
index b67f822..3c1dcbc 100755
--- a/src/test/java/org/apache/directory/fortress/core/impl/URATestData.java
+++ b/src/test/java/org/apache/directory/fortress/core/impl/URATestData.java
@@ -947,9 +947,9 @@
public static final String[] URC_T1 =
{
- "TPASET1", // CONSTRAINT_PASET_NM
- "FILTER", //CONSTAINT_TYPE
- "TPASET1AttributeName1=testattributevalue" //CONSTAIN_VALUE
+ "TPASET1", // CONSTRAINT_PASET_NM
+ "FILTER", //CONSTAINT_TYPE
+ "TPASET1AttributeName1=testattributevalue" //CONSTAIN_VALUE
};
public static final String[] URC_T2 =
@@ -968,9 +968,9 @@
public static final String[] URC_T1_INVALID =
{
- "TPASETNAMENOTEXIST", // CONSTRAINT_PASET_NM
- "FILTER", //CONSTAINT_TYPE
- "TPASET1AttributeName1=testattributevalue" //CONSTAIN_VALUE
+ "TPASETNAMENOTEXIST", // CONSTRAINT_PASET_NM
+ "FILTER", //CONSTAINT_TYPE
+ "TPASET1AttributeName1=testattributevalue" //CONSTAIN_VALUE
};
/**
@@ -1066,10 +1066,10 @@
public static RoleConstraint getRC( String[] rc )
{
- RoleConstraint urc = new RoleConstraint();
- urc.setKey( rc[0] );
- urc.setType( RoleConstraint.RCType.valueOf( rc[1] ) );
- urc.setValue(rc[2]);
+ RoleConstraint urc = new RoleConstraint();
+ urc.setKey( rc[0] );
+ urc.setType( RoleConstraint.RCType.valueOf( rc[1] ) );
+ urc.setValue(rc[2]);
return urc;
}
}