directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cp...@apache.org
Subject [40/43] directory-fortress-core git commit: fixed more indentation
Date Thu, 06 Oct 2016 17:49:57 GMT
fixed more indentation


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/0a6a44da
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/0a6a44da
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/0a6a44da

Branch: refs/heads/master
Commit: 0a6a44dabea74d5168081fb80618dd5dd7d0d5b7
Parents: 887530a
Author: clp207 <clp207@psu.edu>
Authored: Thu Sep 15 13:42:17 2016 -0400
Committer: clp207 <clp207@psu.edu>
Committed: Thu Sep 15 13:42:17 2016 -0400

----------------------------------------------------------------------
 .../directory/fortress/core/impl/PermDAO.java   | 216 +++++++++----------
 .../fortress/core/impl/ReviewMgrImpl.java       |  37 +---
 2 files changed, 118 insertions(+), 135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/0a6a44da/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
----------------------------------------------------------------------
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 5788c61..b8ea568 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
@@ -1127,87 +1127,87 @@ final class PermDAO extends LdapDataProvider
     }
     
     PermissionAttributeSet getPermAttributeSet( PermissionAttributeSet permAttributeSet )
-    		throws FinderException
+        throws FinderException
     {
-    	PermissionAttributeSet entity = null;
-    	LdapConnection ld = null;
-    	String dn = getDn(permAttributeSet, permAttributeSet.getContextId());
-
-    	try
-    	{
-    		ld = getAdminConnection();
-    		Entry findEntry = read( ld, dn, PERMISION_ATTRIBUTE_SET_ATRS );
-    		if ( findEntry == null )
-    		{
-    			String warning = "getPermAttributeSet no entry found dn [" + dn + "]";
-    			throw new FinderException( GlobalErrIds.PERM_ATTRIBUTE_SET_NOT_FOUND, warning );
-    		}
-    		entity = unloadPASetLdapEntry( findEntry, 0 );
-    		
-    		//find permission attributes for this set
-    		entity.setAttributes(this.findPermissionAttributes(entity));
-    	}
-    	catch ( LdapNoSuchObjectException e )
-    	{
-    		String warning = "getPermAttributeSet COULD NOT FIND ENTRY for dn [" + dn + "]";
-    		throw new FinderException( GlobalErrIds.PERM_ATTRIBUTE_SET_NOT_FOUND, warning );
-    	}
-    	catch ( LdapException e )
-    	{
-    		String error = "getPermAttributeSet dn [" + dn + "] caught LdapException=" + e.getMessage();
-    		throw new FinderException( GlobalErrIds.PERM_ATTRIBUTE_SET_NOT_FOUND, error, e );
-    	}
-    	finally
-    	{
-    		closeAdminConnection( ld );
-    	}
-
-    	return entity;
+        PermissionAttributeSet entity = null;
+        LdapConnection ld = null;
+        String dn = getDn(permAttributeSet, permAttributeSet.getContextId());
+
+        try
+        {
+            ld = getAdminConnection();
+            Entry findEntry = read( ld, dn, PERMISION_ATTRIBUTE_SET_ATRS );
+            if ( findEntry == null )
+            {
+                String warning = "getPermAttributeSet no entry found dn [" + dn + "]";
+                throw new FinderException( GlobalErrIds.PERM_ATTRIBUTE_SET_NOT_FOUND, warning
);
+            }
+            entity = unloadPASetLdapEntry( findEntry, 0 );
+
+            //find permission attributes for this set
+            entity.setAttributes(this.findPermissionAttributes(entity));
+        }
+        catch ( LdapNoSuchObjectException e )
+        {
+            String warning = "getPermAttributeSet COULD NOT FIND ENTRY for dn [" + dn + "]";
+            throw new FinderException( GlobalErrIds.PERM_ATTRIBUTE_SET_NOT_FOUND, warning
);
+        }
+        catch ( LdapException e )
+        {
+            String error = "getPermAttributeSet dn [" + dn + "] caught LdapException=" +
e.getMessage();
+            throw new FinderException( GlobalErrIds.PERM_ATTRIBUTE_SET_NOT_FOUND, error,
e );
+        }
+        finally
+        {
+            closeAdminConnection( ld );
+        }
+
+        return entity;
     }
 
     Set<PermissionAttribute> findPermissionAttributes( PermissionAttributeSet paSet
)
-    		throws FinderException
+        throws FinderException
     {
-    	Set<PermissionAttribute> paList = new HashSet<PermissionAttribute>();
-    	LdapConnection ld = null;
-    	String permRoot = getRootDn( paSet.getContextId() );
-
-    	try
-    	{
-    		String paSetVal = encodeSafeText( paSet.getName(), GlobalIds.PERM_LEN );
-    		StringBuilder filterbuf = new StringBuilder();
-    		filterbuf.append( GlobalIds.FILTER_PREFIX );
-    		filterbuf.append( PERMISSION_ATTRIBUTE_OBJECT_CLASS_NAME );
-    		filterbuf.append( ")(" );
-    		filterbuf.append( GlobalIds.FT_PERMISSION_ATTRIBUTE_SET );
-    		filterbuf.append( "=" );
-    		filterbuf.append( paSetVal );
-    		filterbuf.append(  "))" );
-    		ld = getAdminConnection();
-    		SearchCursor searchResults = search( ld, permRoot,
-    				SearchScope.SUBTREE, filterbuf.toString(), PERMISION_ATTRIBUTE_ATRS, false, GlobalIds.BATCH_SIZE
);
-    		long sequence = 0;
-
-    		while ( searchResults.next() )
-    		{
-    			paList.add( unloadPALdapEntry( searchResults.getEntry(), sequence++ ) );
-    		}
-    	}
-    	catch ( LdapException e )
-    	{
-    		String error = "findPermissionAttributes caught LdapException=" + e.getMessage();
-    		throw new FinderException( GlobalErrIds.PERM_SEARCH_FAILED, error, e );
-    	}
-    	catch ( CursorException e )
-    	{
-    		String error = "findPermissionAttributes caught CursorException=" + e.getMessage();
-    		throw new FinderException( GlobalErrIds.PERM_SEARCH_FAILED, error, e );
-    	}
-    	finally
-    	{
-    		closeAdminConnection( ld );
-    	}
-    	return paList;
+        Set<PermissionAttribute> paList = new HashSet<PermissionAttribute>();
+        LdapConnection ld = null;
+        String permRoot = getRootDn( paSet.getContextId() );
+
+        try
+        {
+            String paSetVal = encodeSafeText( paSet.getName(), GlobalIds.PERM_LEN );
+            StringBuilder filterbuf = new StringBuilder();
+            filterbuf.append( GlobalIds.FILTER_PREFIX );
+            filterbuf.append( PERMISSION_ATTRIBUTE_OBJECT_CLASS_NAME );
+            filterbuf.append( ")(" );
+            filterbuf.append( GlobalIds.FT_PERMISSION_ATTRIBUTE_SET );
+            filterbuf.append( "=" );
+            filterbuf.append( paSetVal );
+            filterbuf.append(  "))" );
+            ld = getAdminConnection();
+            SearchCursor searchResults = search( ld, permRoot,
+                SearchScope.SUBTREE, filterbuf.toString(), PERMISION_ATTRIBUTE_ATRS, false,
GlobalIds.BATCH_SIZE );
+            long sequence = 0;
+
+            while ( searchResults.next() )
+            {
+                paList.add( unloadPALdapEntry( searchResults.getEntry(), sequence++ ) );
+            }
+        }
+        catch ( LdapException e )
+        {
+            String error = "findPermissionAttributes caught LdapException=" + e.getMessage();
+            throw new FinderException( GlobalErrIds.PERM_SEARCH_FAILED, error, e );
+        }
+        catch ( CursorException e )
+        {
+            String error = "findPermissionAttributes caught CursorException=" + e.getMessage();
+            throw new FinderException( GlobalErrIds.PERM_SEARCH_FAILED, error, e );
+        }
+        finally
+        {
+            closeAdminConnection( ld );
+        }
+        return paList;
     }
 
     /**
@@ -1452,42 +1452,42 @@ final class PermDAO extends LdapDataProvider
     }
     
     private PermissionAttributeSet unloadPASetLdapEntry( Entry le, long sequence )
-    		throws LdapInvalidAttributeValueException
+        throws LdapInvalidAttributeValueException
     {
-    	PermissionAttributeSet entity = new ObjectFactory().createPermAttributeSet();
-    	entity.setSequenceId( sequence );
-    	entity.setName( getAttribute( le, SchemaConstants.CN_AT ) );
-    	entity.setDn( le.getDn().getName() );
-    	entity.setInternalId( getAttribute( le, GlobalIds.FT_IID ) );
-    	entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
-    	entity.setType( getAttribute( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_SET_TYPE ) );  
 	    	
-    	
-    	return entity;
+        PermissionAttributeSet entity = new ObjectFactory().createPermAttributeSet();
+        entity.setSequenceId( sequence );
+        entity.setName( getAttribute( le, SchemaConstants.CN_AT ) );
+        entity.setDn( le.getDn().getName() );
+        entity.setInternalId( getAttribute( le, GlobalIds.FT_IID ) );
+        entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
+        entity.setType( getAttribute( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_SET_TYPE ) );
   	    	
+
+        return entity;
     }
-    
+
     private PermissionAttribute unloadPALdapEntry( Entry le, long sequence )
-    		throws LdapInvalidAttributeValueException
+        throws LdapInvalidAttributeValueException
     {
-    	PermissionAttribute entity = new ObjectFactory().createPermissionAttribute();
-    	entity.setSequenceId( sequence );
-    	entity.setAttributeName( getAttribute( le, SchemaConstants.CN_AT ) );
-    	entity.setDn( le.getDn().getName() );
-    	entity.setInternalId( getAttribute( le, GlobalIds.FT_IID ) );
-    	entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
-    	entity.setDataType( getAttribute( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DATA_TYPE )
);
-    	entity.setDefaultOperator( getAttribute( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_OPERATOR
) );
-    	entity.setDefaultStrategy( getAttribute( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_STRATEGY
) );
-    	entity.setDefaultValue( getAttribute( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_VALUE
) );
-    	
-    	List<String> validValues = getAttributes( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_VALID_VALUES
);
-    	
-    	if(validValues != null){
-    		for(String value : validValues){
-    			entity.getValidValues().add(value);
-    		}
-    	}
-    	
-    	return entity;
+        PermissionAttribute entity = new ObjectFactory().createPermissionAttribute();
+        entity.setSequenceId( sequence );
+        entity.setAttributeName( getAttribute( le, SchemaConstants.CN_AT ) );
+        entity.setDn( le.getDn().getName() );
+        entity.setInternalId( getAttribute( le, GlobalIds.FT_IID ) );
+        entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
+        entity.setDataType( getAttribute( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DATA_TYPE
) );
+        entity.setDefaultOperator( getAttribute( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_OPERATOR
) );
+        entity.setDefaultStrategy( getAttribute( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_STRATEGY
) );
+        entity.setDefaultValue( getAttribute( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_VALUE
) );
+
+        List<String> validValues = getAttributes( le, GlobalIds.FT_PERMISSION_ATTRIBUTE_VALID_VALUES
);
+
+        if(validValues != null){
+            for(String value : validValues){
+                entity.getValidValues().add(value);
+            }
+        }
+
+        return entity;
     }
     
     /**

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/0a6a44da/src/main/java/org/apache/directory/fortress/core/impl/ReviewMgrImpl.java
----------------------------------------------------------------------
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 fa10de8..4aae5b8 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
@@ -430,13 +430,13 @@ public class ReviewMgrImpl extends Manageable implements ReviewMgr,
Serializable
      */
     @Override
     public List<PermissionAttributeSet> rolePermissionAttributeSets( Role role, boolean
noInhertiance )    
-    	throws SecurityException
+        throws SecurityException
     {
-    	Map<String, PermissionAttributeSet> permAttributeSets = new HashMap<String,
PermissionAttributeSet>();
-    	
-    	//look through all permissions in the role
-    	List<Permission> permissions = this.rolePermissions(role, noInhertiance);
-    	for(Permission perm : permissions){
+        Map<String, PermissionAttributeSet> permAttributeSets = new HashMap<String,
PermissionAttributeSet>();
+
+        //look through all permissions in the role
+        List<Permission> permissions = this.rolePermissions(role, noInhertiance);
+        for(Permission perm : permissions){
             if( CollectionUtils.isNotEmpty(perm.getPaSets() )){
                 for(String paSetName : perm.getPaSets()){	
                     if(!permAttributeSets.containsKey(paSetName)){
@@ -446,7 +446,7 @@ public class ReviewMgrImpl extends Manageable implements ReviewMgr, Serializable
                 }
             }
         }
-    	
+
         return new ArrayList<PermissionAttributeSet>(permAttributeSets.values());
     }
 
@@ -725,29 +725,12 @@ public class ReviewMgrImpl extends Manageable implements ReviewMgr,
Serializable
     public List<RoleConstraint> findRoleConstraints(User user, Permission permission,
RoleConstraintType rcType) throws SecurityException {
         String methodName = "findRoleConstraints";
         checkAccess(CLS_NM, methodName);        
-    	//find roles this permission is authorized for
+        //find roles this permission is authorized for
         Permission pe = permP.read(permission);
         Set<String> authorizedRoles = authorizeRoles(pe.getRoles());
-        
+
         //find role constraints for the user and the permission's pa set
-    	return userP.findRoleConstraints(authorizedRoles, user, rcType, pe.getPaSets());   
            
+        return userP.findRoleConstraints(authorizedRoles, user, rcType, pe.getPaSets());
               
     }
-    
-    
-    /**
-     * {@inheritDoc}
-     */
-    /*
-    @Override
-    public List<UserRole> assignedRoles(User user)
-        throws SecurityException
-    {
-        String methodName = "assignedRoles";
-        assertContext(CLS_NM, methodName, user, GlobalErrIds.USER_NULL);
-        checkAccess(CLS_NM, methodName);
-        User ue = userP.read(user, true);
-        return ue.getRoles();
-    } 
-    */
 
 }
\ No newline at end of file


Mime
View raw message