directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cp...@apache.org
Subject [16/43] directory-fortress-core git commit: started change to ftAttributeSet
Date Thu, 06 Oct 2016 17:49:33 GMT
started change to ftAttributeSet


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/b6f3fef8
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/b6f3fef8
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/b6f3fef8

Branch: refs/heads/master
Commit: b6f3fef8b212e49664f2ee66ddd7fdfd8956e61c
Parents: d5a5d5a
Author: clp207 <clp207@psu.edu>
Authored: Thu Jan 28 17:25:37 2016 -0500
Committer: clp207 <clp207@psu.edu>
Committed: Wed Mar 30 15:44:22 2016 -0400

----------------------------------------------------------------------
 .../directory/fortress/core/AdminMgr.java       |   6 +-
 .../directory/fortress/core/GlobalIds.java      |  14 ++-
 .../fortress/core/impl/AdminMgrImpl.java        |  16 +--
 .../directory/fortress/core/impl/PermDAO.java   | 113 ++++++++++++------
 .../directory/fortress/core/impl/PermP.java     |   6 +-
 .../fortress/core/impl/ReviewMgrImpl.java       |   3 +-
 .../directory/fortress/core/impl/UserP.java     |   2 +-
 .../fortress/core/model/Permission.java         |  44 +++----
 .../core/model/PermissionAttribute.java         |  55 ---------
 .../core/model/PermissionAttributeSet.java      | 117 +++++++++++++++++++
 .../fortress/core/rest/AdminMgrRestImpl.java    |  16 +--
 11 files changed, 245 insertions(+), 147 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6f3fef8/src/main/java/org/apache/directory/fortress/core/AdminMgr.java
----------------------------------------------------------------------
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 4131d2b..30a77b4 100755
--- a/src/main/java/org/apache/directory/fortress/core/AdminMgr.java
+++ b/src/main/java/org/apache/directory/fortress/core/AdminMgr.java
@@ -22,7 +22,7 @@ package org.apache.directory.fortress.core;
 
 import org.apache.directory.fortress.core.model.PermObj;
 import org.apache.directory.fortress.core.model.Permission;
-import org.apache.directory.fortress.core.model.PermissionAttribute;
+import org.apache.directory.fortress.core.model.PermissionAttributeSet;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.RoleConstraint;
 import org.apache.directory.fortress.core.model.SDSet;
@@ -521,9 +521,9 @@ public interface AdminMgr extends Manageable
 
     
     //TODO: fill the documentation in
-    PermissionAttribute addPermissionAttribute( PermissionAttribute permAttribute )
+    PermissionAttributeSet addPermissionAttributeSet( PermissionAttributeSet permAttributeSet
)
     	throws SecurityException;
-
+    
     /**
      * This method will update permission operation pre-existing in target directory under

      * {@code ou=Permissions,ou=RBAC,dc=yourHostName,dc=com} container in directory information
tree.

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6f3fef8/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/GlobalIds.java b/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
index 4ca88fe..c6a0a66 100755
--- a/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
+++ b/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
@@ -345,8 +345,8 @@ public final class GlobalIds
     /**
      * Attribute name for storing Fortress permission object names.
      */
-    public static final String POBJ_NAME = "ftObjNm";
-
+    public static final String POBJ_NAME = "ftObjNm";    
+    
     /**
      * Attribute name for storing Fortress permission object id.
      */
@@ -533,4 +533,14 @@ public final class GlobalIds
      * The ftPA field contains attributes and associated metadata for permissions.
      */
     public static final String FT_PERMISSION_ATTRIBUTE = "ftPA";
+    
+    /**
+     * The ftPASet field contains the name of the ftPermissionAttributeSet for a permission
+     */
+    public static final String FT_PERMISSION_ATTRIBUTE_SET = "ftPASet";
+    
+    /**
+     * Attribute name for storing Fortress permission attribute set object names.
+     */
+    public static final String PERMISSION_ATTRIBUTE_SET_NAME = "ftAttributeSet";
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6f3fef8/src/main/java/org/apache/directory/fortress/core/impl/AdminMgrImpl.java
----------------------------------------------------------------------
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 ab4aea9..61f090d 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
@@ -34,7 +34,7 @@ import org.apache.directory.fortress.core.model.ConstraintUtil;
 import org.apache.directory.fortress.core.model.Hier;
 import org.apache.directory.fortress.core.model.PermObj;
 import org.apache.directory.fortress.core.model.Permission;
-import org.apache.directory.fortress.core.model.PermissionAttribute;
+import org.apache.directory.fortress.core.model.PermissionAttributeSet;
 import org.apache.directory.fortress.core.model.Relationship;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.RoleConstraint;
@@ -399,14 +399,16 @@ public final class AdminMgrImpl extends Manageable implements AdminMgr,
Serializ
      * {@inheritDoc}
      */
     @Override
-    public PermissionAttribute addPermissionAttribute( PermissionAttribute permAttribute
) throws SecurityException
+    public PermissionAttributeSet addPermissionAttributeSet( PermissionAttributeSet permAttributeSet
) throws SecurityException
     {
-        String methodName = "addPermissionAttribute";
-        assertContext( CLS_NM, methodName, permAttribute, GlobalErrIds.PERM_OPERATION_NULL
);
-        setEntitySession( CLS_NM, methodName, permAttribute );
-        return permP.add( permAttribute );
+        String methodName = "addPermissionAttributeSet";         
+        //TODO: add better global err ids
+        assertContext( CLS_NM, methodName, permAttributeSet, GlobalErrIds.PERM_OPERATION_NULL
);
+        //TODO: set entity session...
+        //setEntitySession( CLS_NM, methodName, permAttribute );
+        return permP.add( permAttributeSet );
     }    
-
+    
     /**
      * {@inheritDoc}
      */

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6f3fef8/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 67ed958..e4d334c 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
@@ -22,7 +22,6 @@ package org.apache.directory.fortress.core.impl;
 
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -56,6 +55,7 @@ import org.apache.directory.fortress.core.model.OrgUnit;
 import org.apache.directory.fortress.core.model.PermObj;
 import org.apache.directory.fortress.core.model.Permission;
 import org.apache.directory.fortress.core.model.PermissionAttribute;
+import org.apache.directory.fortress.core.model.PermissionAttributeSet;
 import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.Session;
@@ -162,7 +162,8 @@ final class PermDAO extends ApacheDsDataProvider
     private static final String TYPE = "ftType";
     private static final String PERM_OBJ_OBJECT_CLASS_NAME = "ftObject";
     private static final String PERM_OP_OBJECT_CLASS_NAME = "ftOperation";
-
+    private static final String PERMISSION_ATTRIBUTE_OBJECT_CLASS_NAME = "ftAttributeSet";
+    
     private static final String PERM_OBJ_OBJ_CLASS[] =
         {
             SchemaConstants.TOP_OC,
@@ -184,7 +185,7 @@ final class PermDAO extends ApacheDsDataProvider
     private static final String PERM_NAME = "ftPermName";
     private static final String ROLES = "ftRoles";
     private static final String USERS = "ftUsers";
-    private static final String PERMISSION_ATTRIBUTE = "ftPA";
+    private static final String PERMISSION_ATTRIBUTE_SET = "ftPASet";
     private static final String[] PERMISSION_OP_ATRS =
         {
             GlobalIds.FT_IID,
@@ -198,7 +199,7 @@ final class PermDAO extends ApacheDsDataProvider
             ROLES,
             USERS,
             GlobalIds.PROPS,
-            PERMISSION_ATTRIBUTE
+            PERMISSION_ATTRIBUTE_SET
     };
 
     private static final String[] PERMISION_OBJ_ATRS =
@@ -416,6 +417,11 @@ final class PermDAO extends ApacheDsDataProvider
             {
                 entry.add( TYPE, entity.getType() );
             }
+            
+            if ( StringUtils.isNotEmpty( entity.getPaSetName() ) )
+            {
+                entry.add( PERMISSION_ATTRIBUTE_SET, entity.getPaSetName() );
+            }
 
             // These are multi-valued attributes, use the util function to load:
             // These items are optional as well.  The utility function will return quietly
if no items are loaded into collection:
@@ -450,33 +456,72 @@ final class PermDAO extends ApacheDsDataProvider
 
     
     //TODO: add documentation
-    PermissionAttribute createPermissionAttribute( PermissionAttribute entity ) throws CreateException
+    PermissionAttributeSet createPermissionAttributeSet( PermissionAttributeSet entity )
throws CreateException
     {
         LdapConnection ld = null;
-        String dn = getDn( new Permission(entity.getObjName(), entity.getOpName()) , entity.getContextId()
);
+        String dn = getDn( entity , entity.getContextId() );
 
         try
         {
-            List<Modification> mods = new ArrayList<Modification>();
-            mods.add( new DefaultModification(
-                ModificationOperation.ADD_ATTRIBUTE, PERMISSION_ATTRIBUTE, entity.toFtPAString())
);
+            Entry entry = new DefaultEntry( dn );
+
+            entry.add( SchemaConstants.OBJECT_CLASS_AT, PERMISSION_ATTRIBUTE_OBJECT_CLASS_NAME
);
+
+            // this will generate a new random, unique id on this entity:
+            entity.setInternalId();
+
+            // create the internal id:
+            entry.add( GlobalIds.FT_IID, entity.getInternalId() );
+
+            // description is optional:
+            if ( StringUtils.isNotEmpty( entity.getDescription() ) )
+            {
+                entry.add( SchemaConstants.DESCRIPTION_AT, entity.getDescription() );
+            }
+
+            // organizational name requires CN attribute:
+            entry.add( SchemaConstants.CN_AT, entity.getName() );
+                    
+            // now add the new entry to directory:
             ld = getAdminConnection();
-            modify( ld, dn, mods, entity );
-            
-            //TODO: make sure not adding same attribute twice...
+            add( ld, entry, entity );
+            entity.setDn( dn );
         }
         catch ( LdapException e )
         {
-            String error = "create perm attribute [" + entity.getObjName() + "] operation
["
-                + entity.getOpName() + "] name [" + entity.getAttributeName() + "] caught
LdapException="
-                + e.getMessage();
-            throw new CreateException( GlobalErrIds.PERM_ATTR_ADD_FAILED, error, e );
+            String error = "createPermissionAttributeSet name [" + entity.getName() + "]
caught LdapException=" + e.getMessage();
+            throw new CreateException( GlobalErrIds.PERM_ADD_FAILED, error, e );
         }
         finally
         {
             closeAdminConnection( ld );
         }
         
+        
+        //add each ftPA
+        for(PermissionAttribute pa : entity.getAttributes()){        
+	        try
+	        {
+	            List<Modification> mods = new ArrayList<Modification>();
+	            mods.add( new DefaultModification(
+	                ModificationOperation.ADD_ATTRIBUTE, GlobalIds.FT_PERMISSION_ATTRIBUTE,
pa.toFtPAString()) );
+	            ld = getAdminConnection();
+	            modify( ld, dn, mods, entity );
+	            
+	            //TODO: make sure not adding same attribute twice...???
+	        }
+	        catch ( LdapException e )
+	        {
+	            String error = "create perm attribute [" + pa.getAttributeName() + "] caught
LdapException="
+	                + e.getMessage();
+	            throw new CreateException( GlobalErrIds.PERM_ATTR_ADD_FAILED, error, e );
+	        }
+	        finally
+	        {
+	            closeAdminConnection( ld );
+	        }
+        }
+        
         //TODO: need to do anything to returned entity?
         return entity;
     }
@@ -516,6 +561,13 @@ final class PermDAO extends ApacheDsDataProvider
                 mods.add( new DefaultModification(
                     ModificationOperation.REPLACE_ATTRIBUTE, TYPE, entity.getType() ) );
             }
+            
+            if ( StringUtils.isNotEmpty( entity.getPaSetName() ) )
+            {
+
+                mods.add( new DefaultModification(
+                    ModificationOperation.REPLACE_ATTRIBUTE, PERMISSION_ATTRIBUTE_SET, entity.getPaSetName()
) );
+            }
 
             // These are multi-valued attributes, use the util function to load:
             loadAttrs( entity.getRoles(), mods, ROLES );
@@ -1061,7 +1113,7 @@ final class PermDAO extends ApacheDsDataProvider
         entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
         entity.addProperties( PropUtil.getProperties( getAttributes( le, GlobalIds.PROPS
) ) );        
         entity.setAdmin( isAdmin );
-        entity.setAttributes( unloadPermissionAttributes(le) );
+        entity.setPaSetName( getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_SET ) );
 
         if ( le != null )
         {
@@ -1093,26 +1145,6 @@ final class PermDAO extends ApacheDsDataProvider
         entity.setAdmin( isAdmin );
         return entity;
     }
-
-    private Set<PermissionAttribute> unloadPermissionAttributes( Entry entry )
-    {
-        Set<PermissionAttribute> permAttributes = null;
-        List<String> ftPAs = getAttributes( entry, GlobalIds.FT_PERMISSION_ATTRIBUTE
);
-
-        if ( ftPAs != null )
-        {
-        	permAttributes = new HashSet<PermissionAttribute>();
-
-            for ( String raw : ftPAs )
-            {
-                PermissionAttribute permAttribute = new ObjectFactory().createPermissionAttribute();
-                permAttribute.load( raw );
-                permAttributes.add( permAttribute );
-            }
-        }
-
-        return permAttributes;
-    }
     
     /**
      * @param permission
@@ -1728,6 +1760,13 @@ final class PermDAO extends ApacheDsDataProvider
     {
         return GlobalIds.POBJ_NAME + "=" + pObj.getObjName() + "," + getRootDn( pObj.isAdmin(),
contextId );
     }
+    
+
+    private String getDn( PermissionAttributeSet paSet, String contextId )
+    {
+    	//TODO: what ou to put this?
+        return SchemaConstants.CN_AT + "=" + paSet.getName() + "," + getRootDn( contextId,
GlobalIds.SD_ROOT );
+    }
 
 
     private String getRootDn( boolean isAdmin, String contextId )

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6f3fef8/src/main/java/org/apache/directory/fortress/core/impl/PermP.java
----------------------------------------------------------------------
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 c1738c7..585323e 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
@@ -33,7 +33,7 @@ import org.apache.directory.fortress.core.model.AdminRole;
 import org.apache.directory.fortress.core.model.OrgUnit;
 import org.apache.directory.fortress.core.model.PermObj;
 import org.apache.directory.fortress.core.model.Permission;
-import org.apache.directory.fortress.core.model.PermissionAttribute;
+import org.apache.directory.fortress.core.model.PermissionAttributeSet;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.Session;
 import org.apache.directory.fortress.core.model.User;
@@ -369,10 +369,10 @@ final class PermP
     }
     
     //TODO: add documentation
-    PermissionAttribute add( PermissionAttribute entity ) throws SecurityException
+    PermissionAttributeSet add( PermissionAttributeSet entity ) throws SecurityException
     {
         //TODO: add validation
-        return pDao.createPermissionAttribute( entity );
+        return pDao.createPermissionAttributeSet( entity );
     }
 
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6f3fef8/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 12190c7..463572c 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
@@ -416,7 +416,8 @@ public class ReviewMgrImpl extends Manageable implements ReviewMgr, Serializable
     	
     	List<Permission> permissions = this.rolePermissions(role, noInhertiance);
     	for(Permission perm : permissions){
-    		permAttributes.addAll(perm.getAttributes());
+    		//TODO: need to get ftPA entries now...
+    		//permAttributes.addAll(perm.getAttributes());
     	}
     	
     	return permAttributes;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6f3fef8/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
----------------------------------------------------------------------
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 940ca63..dfe7b3c 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
@@ -639,7 +639,7 @@ final class UserP
     //TODO: add documentation
     void assign( UserRole uRole, RoleConstraint roleConstraint ) throws SecurityException
     {
-    	//TODO: validate?
+    	//TODO: validate role constraint points to actual ftAttributeSet?
     	
     	uDao.assign( uRole, roleConstraint );
     }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6f3fef8/src/main/java/org/apache/directory/fortress/core/model/Permission.java
----------------------------------------------------------------------
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 4974627..e96ba0d 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
@@ -22,7 +22,6 @@ package org.apache.directory.fortress.core.model;
 
 import java.io.Serializable;
 import java.util.Enumeration;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
@@ -258,7 +257,8 @@ import org.apache.commons.lang.StringUtils;
         "roles",
         "props",
         "dn",
-        "admin"
+        "admin",
+        "paSetName"
 })
 public class Permission extends FortEntity implements Serializable
 {
@@ -280,9 +280,8 @@ public class Permission extends FortEntity implements Serializable
     @XmlElement(nillable = true)
     private Set<String> roles;
     @XmlElement(nillable = true)
-    private Set<String> users;
-    @XmlElement(nillable = true)
-    private Set<PermissionAttribute> attributes;
+    private Set<String> users;    
+    private String paSetName;
 
     /**
      * This constructor is commonly used to create Permission that is a target for authorization
API.
@@ -676,34 +675,9 @@ public class Permission extends FortEntity implements Serializable
         this.props = value;
     }
 
-    /**
-     * Return the collection of optional Attributes that have been loaded into this entity.
 This is stored as a multi-occurring
-     * attribute of ftPA entries on the 'ftOperation' object class.
-     *
-     * @return Set containing the roles which maps to 'ftRoles' attribute in 'ftOperation'
object class.
-     */
-    public Set<PermissionAttribute> getAttributes()
-    {
-    	if(this.attributes == null){
-    		attributes = new HashSet<PermissionAttribute>();
-    	}
-    	
-        return this.attributes;
-    }
 
 
     /**
-     * Set the collection of optional Attributes that have been loaded into this entity.
 This is stored as a multi-occurring
-     * attribute of ftPAs on the 'ftOperation' object class.
-     *
-     * @param attributes maps to 'ftPA' attribute in 'ftOperation' object class.
-     */
-    public void setAttributes( Set<PermissionAttribute> attributes )
-    {
-        this.attributes = attributes;
-    }
-
-    /**
      * Add name/value pair to list of properties associated with Permission.  These values
are not constrained by Fortress.
      * Properties are optional.
      *
@@ -855,4 +829,14 @@ public class Permission extends FortEntity implements Serializable
             ", objId='" + objId + '\'' +
             '}';
     }
+
+
+	public String getPaSetName() {
+		return paSetName;
+	}
+
+
+	public void setPaSetName(String paSetName) {
+		this.paSetName = paSetName;
+	}
 }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6f3fef8/src/main/java/org/apache/directory/fortress/core/model/PermissionAttribute.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/PermissionAttribute.java
b/src/main/java/org/apache/directory/fortress/core/model/PermissionAttribute.java
index a69d92f..453a784 100644
--- a/src/main/java/org/apache/directory/fortress/core/model/PermissionAttribute.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/PermissionAttribute.java
@@ -37,8 +37,6 @@ public class PermissionAttribute extends FortEntity implements Serializable
{
     private static final String VALID_VALUES_PARAM_NAME = "validValues";
     private static final String DEFAULT_VALUE_PARAM_NAME = "defaultValue";
     
-    private String opName;
-    private String objName;
     private String attributeName;
     private Boolean required;
     private ComparisonOperator operator;
@@ -48,12 +46,6 @@ public class PermissionAttribute extends FortEntity implements Serializable
{
     private List<String> validValues;
     private String defaultValue;
     
-    public PermissionAttribute(String objName, String opName )
-    {
-        this.objName = objName;
-        this.opName = opName;
-    }
-    
     public PermissionAttribute(){
     	
     }
@@ -114,18 +106,6 @@ public class PermissionAttribute extends FortEntity implements Serializable
{
 	public void setDefaultValue(String defaultValue) {
 		this.defaultValue = defaultValue;
 	}
-	public String getOpName() {
-		return opName;
-	}
-	public void setOpName(String opName) {
-		this.opName = opName;
-	}
-	public String getObjName() {
-		return objName;
-	}
-	public void setObjName(String objName) {
-		this.objName = objName;
-	}
 	public String getAttributeName() {
 		return attributeName;
 	}
@@ -172,39 +152,4 @@ public class PermissionAttribute extends FortEntity implements Serializable
{
         }
     }
     
-    /**
-     * Matches the objName, opName and attributeName from two Permission entities.
-     *
-     * @param o contains a PermissionAttribute entity.
-     * @return boolean indicating both PermissionAttributes contain matching objName, opName,
and attributeName attributes.
-     */
-    @Override
-    public boolean equals(Object o)
-    {
-        if ( this == o )
-        {
-            return true;
-        }
-        if ( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        PermissionAttribute that = ( PermissionAttribute ) o;
-        
-        if ( objName != null ? !objName.equalsIgnoreCase( that.objName ) : that.objName !=
null )
-        {
-            return false;
-        }
-        if ( opName != null ? !opName.equalsIgnoreCase( that.opName ) : that.opName != null
)
-        {
-            return false;
-        }
-        if ( attributeName != null ? !attributeName.equalsIgnoreCase( that.attributeName
) : that.attributeName != null )
-        {
-            return false;
-        }
-
-        return true;
-    }
 }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6f3fef8/src/main/java/org/apache/directory/fortress/core/model/PermissionAttributeSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/PermissionAttributeSet.java
b/src/main/java/org/apache/directory/fortress/core/model/PermissionAttributeSet.java
new file mode 100644
index 0000000..46fb95a
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/core/model/PermissionAttributeSet.java
@@ -0,0 +1,117 @@
+package org.apache.directory.fortress.core.model;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "ftPermissionAttributeSet")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "permission", propOrder =
+    {
+        "name",
+        "attributes",
+        "internalId",
+        "description"
+})
+public class PermissionAttributeSet extends FortEntity {
+
+	private String name;
+	@XmlElement(nillable = true)
+	private Set<PermissionAttribute> attributes;
+    private String internalId;
+    private String description;
+    private String dn;
+	
+	public PermissionAttributeSet(){
+		
+	}
+	
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}	
+	
+    /**
+     * Return the collection of optional Attributes that have been loaded into this entity.
 This is stored as a multi-occurring
+     * attribute of ftPA entries on the 'ftAttributeSet' object class.
+     *
+     * @return Set containing the roles which maps to 'ftRoles' attribute in 'ftOperation'
object class.
+     */
+    public Set<PermissionAttribute> getAttributes()
+    {
+    	if(this.attributes == null){
+    		attributes = new HashSet<PermissionAttribute>();
+    	}
+    	
+        return this.attributes;
+    }
+
+
+    /**
+     * Set the collection of optional Attributes that have been loaded into this entity.
 This is stored as a multi-occurring
+     * attribute of ftPAs on the 'ftOperation' object class.
+     *
+     * @param attributes maps to 'ftPA' attribute in 'ftOperation' object class.
+     */
+    public void setAttributes( Set<PermissionAttribute> attributes )
+    {
+        this.attributes = attributes;
+    }
+
+	public String getInternalId() {
+		return internalId;
+	}
+
+	public void setInternalId() {
+        UUID uuid = UUID.randomUUID();
+        this.internalId = uuid.toString();
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public String getDn() {
+		return dn;
+	}
+
+	public void setDn(String dn) {
+		this.dn = dn;
+	}
+    
+    /*
+    private Set<PermissionAttribute> unloadPermissionAttributes( Entry entry )
+    {
+        Set<PermissionAttribute> permAttributes = null;
+        List<String> ftPAs = getAttributes( entry, GlobalIds.FT_PERMISSION_ATTRIBUTE
);
+
+        if ( ftPAs != null )
+        {
+        	permAttributes = new HashSet<PermissionAttribute>();
+
+            for ( String raw : ftPAs )
+            {
+                PermissionAttribute permAttribute = new ObjectFactory().createPermissionAttribute();
+                permAttribute.load( raw );
+                permAttributes.add( permAttribute );
+            }
+        }
+
+        return permAttributes;
+    }
+    */
+
+}

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6f3fef8/src/main/java/org/apache/directory/fortress/core/rest/AdminMgrRestImpl.java
----------------------------------------------------------------------
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 c3e61ac..eaa25be 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
@@ -29,7 +29,7 @@ import org.apache.directory.fortress.core.model.FortResponse;
 import org.apache.directory.fortress.core.model.PermGrant;
 import org.apache.directory.fortress.core.model.PermObj;
 import org.apache.directory.fortress.core.model.Permission;
-import org.apache.directory.fortress.core.model.PermissionAttribute;
+import org.apache.directory.fortress.core.model.PermissionAttributeSet;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.RoleConstraint;
 import org.apache.directory.fortress.core.model.RoleRelationship;
@@ -1244,25 +1244,25 @@ public final class AdminMgrRestImpl extends Manageable implements
AdminMgr
 
 
 	@Override
-	public PermissionAttribute addPermissionAttribute(
-			PermissionAttribute permAttribute) throws SecurityException {
+	public RoleConstraint addRoleConstraint(UserRole uRole,
+			RoleConstraint roleConstraint) throws SecurityException {
 		// TODO Auto-generated method stub
 		return null;
 	}
 
 
 	@Override
-	public RoleConstraint addRoleConstraint(UserRole uRole,
+	public void removeRoleConstraint(UserRole uRole,
 			RoleConstraint roleConstraint) throws SecurityException {
 		// TODO Auto-generated method stub
-		return null;
+		
 	}
 
 
 	@Override
-	public void removeRoleConstraint(UserRole uRole,
-			RoleConstraint roleConstraint) throws SecurityException {
+	public PermissionAttributeSet addPermissionAttributeSet(
+			PermissionAttributeSet permAttributeSet) throws SecurityException {
 		// TODO Auto-generated method stub
-		
+		return null;
 	}
 }
\ No newline at end of file


Mime
View raw message