You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2015/06/02 16:06:02 UTC
directory-fortress-core git commit: FC-109 - move AttrHelper to rbac,
move graphable to model
Repository: directory-fortress-core
Updated Branches:
refs/heads/1.0-RC41 55a182d06 -> 3d7e32c58
FC-109 - move AttrHelper to rbac, move graphable to model
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/3d7e32c5
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/3d7e32c5
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/3d7e32c5
Branch: refs/heads/1.0-RC41
Commit: 3d7e32c581de927cc9978507aac4b6f6f2882c8e
Parents: 55a182d
Author: Shawn McKinney <sm...@apache.org>
Authored: Tue Jun 2 09:06:11 2015 -0500
Committer: Shawn McKinney <sm...@apache.org>
Committed: Tue Jun 2 09:06:11 2015 -0500
----------------------------------------------------------------------
.../directory/fortress/core/ant/UserAnt.java | 2 +-
.../directory/fortress/core/cfg/ConfigDAO.java | 2 +-
.../fortress/core/ldap/group/Group.java | 2 +-
.../fortress/core/ldap/group/GroupDAO.java | 2 +-
.../fortress/core/model/AdminRole.java | 1 -
.../fortress/core/model/Administrator.java | 165 ++++++++++++
.../fortress/core/model/Graphable.java | 88 +++++++
.../directory/fortress/core/model/OrgUnit.java | 2 -
.../directory/fortress/core/model/Role.java | 1 -
.../fortress/core/model/UserAdminRole.java | 1 -
.../fortress/core/rbac/AdminRoleDAO.java | 1 +
.../fortress/core/rbac/AdminRoleP.java | 1 +
.../fortress/core/rbac/AdminRoleUtil.java | 1 +
.../fortress/core/rbac/Administrator.java | 165 ------------
.../fortress/core/rbac/AttrHelper.java | 264 +++++++++++++++++++
.../directory/fortress/core/rbac/AuditDAO.java | 1 -
.../fortress/core/rbac/DelAdminMgrImpl.java | 1 -
.../directory/fortress/core/rbac/Graphable.java | 88 -------
.../directory/fortress/core/rbac/HierUtil.java | 1 +
.../fortress/core/rbac/OrgUnitDAO.java | 1 +
.../directory/fortress/core/rbac/OrgUnitP.java | 1 +
.../directory/fortress/core/rbac/PermDAO.java | 1 -
.../directory/fortress/core/rbac/PsoUtil.java | 1 +
.../directory/fortress/core/rbac/RoleDAO.java | 1 +
.../directory/fortress/core/rbac/RoleP.java | 1 +
.../directory/fortress/core/rbac/RoleUtil.java | 1 +
.../directory/fortress/core/rbac/UserDAO.java | 1 -
.../directory/fortress/core/rbac/UserP.java | 1 -
.../directory/fortress/core/rbac/UsoUtil.java | 1 +
.../fortress/core/util/attr/AttrHelper.java | 263 ------------------
.../fortress/core/AuditMgrConsole.java | 2 +-
31 files changed, 533 insertions(+), 531 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java b/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
index 0b7811f..1d0e33a 100755
--- a/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
+++ b/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
@@ -24,7 +24,7 @@ import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.directory.fortress.core.model.User;
-import org.apache.directory.fortress.core.util.attr.AttrHelper;
+import org.apache.directory.fortress.core.rbac.AttrHelper;
import org.apache.directory.fortress.core.util.attr.VUtil;
import java.io.File;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/cfg/ConfigDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/cfg/ConfigDAO.java b/src/main/java/org/apache/directory/fortress/core/cfg/ConfigDAO.java
index 1323c04..9ca23f2 100755
--- a/src/main/java/org/apache/directory/fortress/core/cfg/ConfigDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/cfg/ConfigDAO.java
@@ -41,7 +41,7 @@ import org.apache.directory.fortress.core.GlobalErrIds;
import org.apache.directory.fortress.core.GlobalIds;
import org.apache.directory.fortress.core.RemoveException;
import org.apache.directory.fortress.core.UpdateException;
-import org.apache.directory.fortress.core.util.attr.AttrHelper;
+import org.apache.directory.fortress.core.rbac.AttrHelper;
import org.apache.directory.fortress.core.util.attr.VUtil;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/ldap/group/Group.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/group/Group.java b/src/main/java/org/apache/directory/fortress/core/ldap/group/Group.java
index 2884cad..ee541ca 100755
--- a/src/main/java/org/apache/directory/fortress/core/ldap/group/Group.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/group/Group.java
@@ -22,7 +22,7 @@ package org.apache.directory.fortress.core.ldap.group;
import org.apache.directory.fortress.core.model.FortEntity;
import org.apache.directory.fortress.core.model.Props;
-import org.apache.directory.fortress.core.util.attr.AttrHelper;
+import org.apache.directory.fortress.core.rbac.AttrHelper;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupDAO.java b/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupDAO.java
index 9b4d5fd..c1305f6 100755
--- a/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupDAO.java
@@ -40,7 +40,7 @@ import org.apache.directory.fortress.core.UpdateException;
import org.apache.directory.fortress.core.cfg.Config;
import org.apache.directory.fortress.core.ldap.ApacheDsDataProvider;
import org.apache.directory.fortress.core.model.User;
-import org.apache.directory.fortress.core.util.attr.AttrHelper;
+import org.apache.directory.fortress.core.rbac.AttrHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.directory.fortress.core.CreateException;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/model/AdminRole.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/AdminRole.java b/src/main/java/org/apache/directory/fortress/core/model/AdminRole.java
index 3b77e72..44f7fdf 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/AdminRole.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/AdminRole.java
@@ -28,7 +28,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import org.apache.directory.fortress.core.rbac.Administrator;
import org.apache.directory.fortress.core.util.attr.VUtil;
import org.apache.directory.fortress.core.util.time.CUtil;
import org.apache.directory.fortress.core.util.time.Constraint;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/model/Administrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/Administrator.java b/src/main/java/org/apache/directory/fortress/core/model/Administrator.java
new file mode 100755
index 0000000..6bba8b8
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/core/model/Administrator.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.core.model;
+
+
+import java.util.Set;
+
+
+/**
+ * This interface is used by Fortress admin role processing. It prescribes the APIs that are necessary for an Administrative
+ * Role entity to fullfill the ARBAC functionality.
+ * <p/>
+
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface Administrator
+{
+
+ /**
+ * Get a collection of optional Perm OU attributes that were stored on the AdminRole entity.
+ *
+ * @return List of type String containing Perm OU. This maps to 'ftOSP' attribute on 'ftPools' aux object class.
+ */
+ Set<String> getOsP();
+
+
+ /**
+ * Set a collection of optional Perm OU attributes to be stored on the AdminRole entity.
+ *
+ * @param osPs is a List of type String containing Perm OU. This maps to 'ftOSP' attribute on 'ftPools' aux object class.
+ */
+ void setOsP( Set<String> osPs );
+
+
+ /**
+ * Set a Perm OU attribute to be stored on the AdminRole entity.
+ *
+ * @param osP is a Perm OU that maps to 'ftOSP' attribute on 'ftPools' aux object class.
+ */
+ void setOsP( String osP );
+
+
+ /**
+ * Get a collection of optional User OU attributes that were stored on the AdminRole entity.
+ *
+ * @return List of type String containing User OU. This maps to 'ftOSU' attribute on 'ftPools' aux object class.
+ */
+ Set<String> getOsU();
+
+
+ /**
+ * Set a collection of optional User OU attributes to be stored on the AdminRole entity.
+ *
+ * @param osUs is a List of type String containing User OU. This maps to 'ftOSU' attribute on 'ftPools' aux object class.
+ */
+ void setOsU( Set<String> osUs );
+
+
+ /**
+ * Set a User OU attribute to be stored on the AdminRole entity.
+ *
+ * @param osU is a User OU that maps to 'ftOSU' attribute on 'ftPools' aux object class.
+ */
+ void setOsU( String osU );
+
+
+ /**
+ * Load the role range attributes given a raw format. This method is used internal to Fortress and is not intended
+ * to be used by external callers.
+ *
+ * @param szRaw maps to 'ftRange' attribute on 'ftPools' aux object class.
+ */
+ void setRoleRangeRaw( String szRaw );
+
+
+ /**
+ * Get the raw format for role range using current AdminRole entity attributes. This method is used internal to Fortress and is not intended
+ * to be used by external callers.
+ *
+ * @return String maps to 'ftRange' attribute on 'ftPools' aux object class.
+ */
+ String getRoleRangeRaw();
+
+
+ /**
+ * Return the begin Role range attribute for AdminRole entity.
+ *
+ * @return String that maps to 'ftRange' attribute on 'ftPools' aux object class.
+ */
+ String getBeginRange();
+
+
+ /**
+ * Set the begin Role range attribute for AdminRole entity.
+ *
+ * @param beginRange maps to 'ftRange' attribute on 'ftPools' aux object class.
+ */
+ void setBeginRange( String beginRange );
+
+
+ /**
+ * Return the end Role range attribute for AdminRole entity.
+ *
+ * @return String that maps to 'ftRange' attribute on 'ftPools' aux object class.
+ */
+ String getEndRange();
+
+
+ /**
+ * Set the end Role range attribute for AdminRole entity.
+ *
+ * @param endRange maps to 'ftRange' attribute on 'ftPools' aux object class.
+ */
+ void setEndRange( String endRange );
+
+
+ /**
+ * Set the begin inclusive which specifies if role range includes or excludes the 'beginRange' attribute.
+ *
+ * @return String that maps to 'ftRange' attribute on 'ftPools' aux object class.
+ */
+ boolean isBeginInclusive();
+
+
+ /**
+ * Get the begin inclusive which specifies if role range includes or excludes the 'beginRange' attribute.
+ *
+ * @param beginInclusive maps to 'ftRange' attribute on 'ftPools' aux object class.
+ */
+ void setBeginInclusive( boolean beginInclusive );
+
+
+ /**
+ * Set the end inclusive which specifies if role range includes or excludes the 'endRange' attribute.
+ *
+ * @return String that maps to 'ftRange' attribute on 'ftPools' aux object class.
+ */
+ boolean isEndInclusive();
+
+
+ /**
+ * Get the end inclusive which specifies if role range includes or excludes the 'endRange' attribute.
+ *
+ * @param endInclusive maps to 'ftRange' attribute on 'ftPools' aux object class.
+ */
+ void setEndInclusive( boolean endInclusive );
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/model/Graphable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/Graphable.java b/src/main/java/org/apache/directory/fortress/core/model/Graphable.java
new file mode 100644
index 0000000..36d8748
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/core/model/Graphable.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.core.model;
+
+
+import java.util.Set;
+
+
+/**
+ * The Fortress Graphable interface prescribes attributes that are used to maintain implementor within a simple directed graph.
+ * {@link org.apache.directory.fortress.core.model.Role}, {@link org.apache.directory.fortress.core.model.AdminRole}, {@link org.apache.directory.fortress.core.model.OrgUnit} entities.
+ * <p/>
+ * <h4>Manageable Schema</h4>
+ * The entity maps to Fortress LDAP attributetype ( 1.3.6.1.4.1.1.38088.1.28
+ * NAME 'ftParents'
+ * DESC 'Fortress Parent Nodes'
+ * EQUALITY caseIgnoreMatch
+ * SUBSTR caseIgnoreSubstringsMatch
+ * SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
+ * <p/>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface Graphable
+{
+ /**
+ * Get the names of roles that are parents (direct ascendants) of this role.
+ *
+ * @return Set of parent role names assigned to this role.
+ */
+ Set<String> getParents();
+
+
+ /**
+ * Set the names of roles names that are parents (direct ascendants) of this role.
+ *
+ * @param parents contains the Set of parent role names assigned to this role.
+ */
+ void setParents( Set<String> parents );
+
+
+ /**
+ * Set the occupant attribute with the contents of the User dn.
+ *
+ * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
+ */
+ void setParent( String parent );
+
+
+ /**
+ * Set the occupant attribute with the contents of the User dn.
+ *
+ * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
+ */
+ void delParent( String parent );
+
+
+ /**
+ * Get the name required attribute of the node.
+ *
+ * @return attribute maps to attribute on 'organizationalUnit' object class.
+ */
+ String getName();
+
+
+ /**
+ * Sets the required name attribute on the node.
+ *
+ */
+ void setName( String name );
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/model/OrgUnit.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/OrgUnit.java b/src/main/java/org/apache/directory/fortress/core/model/OrgUnit.java
index cfd21a9..a235f2e 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/OrgUnit.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/OrgUnit.java
@@ -20,8 +20,6 @@
package org.apache.directory.fortress.core.model;
-import org.apache.directory.fortress.core.rbac.Graphable;
-
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/model/Role.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/Role.java b/src/main/java/org/apache/directory/fortress/core/model/Role.java
index fba3152..cff1b9a 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/Role.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/Role.java
@@ -33,7 +33,6 @@ import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
-import org.apache.directory.fortress.core.rbac.Graphable;
import org.apache.directory.fortress.core.util.time.CUtil;
import org.apache.directory.fortress.core.util.time.Constraint;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/model/UserAdminRole.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/UserAdminRole.java b/src/main/java/org/apache/directory/fortress/core/model/UserAdminRole.java
index 3cb255b..be41629 100755
--- a/src/main/java/org/apache/directory/fortress/core/model/UserAdminRole.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/UserAdminRole.java
@@ -31,7 +31,6 @@ import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang.StringUtils;
import org.apache.directory.fortress.core.GlobalIds;
-import org.apache.directory.fortress.core.rbac.Administrator;
import org.apache.directory.fortress.core.util.attr.VUtil;
import org.apache.directory.fortress.core.util.time.CUtil;
import org.apache.directory.fortress.core.util.time.Constraint;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleDAO.java
index 7d33980..334c118 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleDAO.java
@@ -44,6 +44,7 @@ import org.apache.directory.fortress.core.RemoveException;
import org.apache.directory.fortress.core.UpdateException;
import org.apache.directory.fortress.core.ldap.ApacheDsDataProvider;
import org.apache.directory.fortress.core.model.AdminRole;
+import org.apache.directory.fortress.core.model.Graphable;
import org.apache.directory.fortress.core.model.Role;
import org.apache.directory.fortress.core.util.attr.VUtil;
import org.apache.directory.fortress.core.util.time.CUtil;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleP.java b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleP.java
index e1da272..ba4fc82 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleP.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleP.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Set;
import org.apache.directory.fortress.core.model.AdminRole;
+import org.apache.directory.fortress.core.model.Graphable;
import org.apache.directory.fortress.core.model.OrgUnit;
import org.apache.directory.fortress.core.model.UserAdminRole;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleUtil.java b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleUtil.java
index d806557..fc3adcb 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleUtil.java
@@ -26,6 +26,7 @@ import java.util.TreeSet;
import java.util.concurrent.locks.ReadWriteLock;
import org.apache.directory.fortress.core.model.AdminRole;
+import org.apache.directory.fortress.core.model.Graphable;
import org.apache.directory.fortress.core.model.Hier;
import org.apache.directory.fortress.core.model.Relationship;
import org.apache.directory.fortress.core.model.UserAdminRole;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/Administrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/Administrator.java b/src/main/java/org/apache/directory/fortress/core/rbac/Administrator.java
deleted file mode 100755
index 557dff3..0000000
--- a/src/main/java/org/apache/directory/fortress/core/rbac/Administrator.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.fortress.core.rbac;
-
-
-import java.util.Set;
-
-
-/**
- * This interface is used by Fortress admin role processing. It prescribes the APIs that are necessary for an Administrative
- * Role entity to fullfill the ARBAC functionality.
- * <p/>
-
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public interface Administrator
-{
-
- /**
- * Get a collection of optional Perm OU attributes that were stored on the AdminRole entity.
- *
- * @return List of type String containing Perm OU. This maps to 'ftOSP' attribute on 'ftPools' aux object class.
- */
- Set<String> getOsP();
-
-
- /**
- * Set a collection of optional Perm OU attributes to be stored on the AdminRole entity.
- *
- * @param osPs is a List of type String containing Perm OU. This maps to 'ftOSP' attribute on 'ftPools' aux object class.
- */
- void setOsP( Set<String> osPs );
-
-
- /**
- * Set a Perm OU attribute to be stored on the AdminRole entity.
- *
- * @param osP is a Perm OU that maps to 'ftOSP' attribute on 'ftPools' aux object class.
- */
- void setOsP( String osP );
-
-
- /**
- * Get a collection of optional User OU attributes that were stored on the AdminRole entity.
- *
- * @return List of type String containing User OU. This maps to 'ftOSU' attribute on 'ftPools' aux object class.
- */
- Set<String> getOsU();
-
-
- /**
- * Set a collection of optional User OU attributes to be stored on the AdminRole entity.
- *
- * @param osUs is a List of type String containing User OU. This maps to 'ftOSU' attribute on 'ftPools' aux object class.
- */
- void setOsU( Set<String> osUs );
-
-
- /**
- * Set a User OU attribute to be stored on the AdminRole entity.
- *
- * @param osU is a User OU that maps to 'ftOSU' attribute on 'ftPools' aux object class.
- */
- void setOsU( String osU );
-
-
- /**
- * Load the role range attributes given a raw format. This method is used internal to Fortress and is not intended
- * to be used by external callers.
- *
- * @param szRaw maps to 'ftRange' attribute on 'ftPools' aux object class.
- */
- void setRoleRangeRaw( String szRaw );
-
-
- /**
- * Get the raw format for role range using current AdminRole entity attributes. This method is used internal to Fortress and is not intended
- * to be used by external callers.
- *
- * @return String maps to 'ftRange' attribute on 'ftPools' aux object class.
- */
- String getRoleRangeRaw();
-
-
- /**
- * Return the begin Role range attribute for AdminRole entity.
- *
- * @return String that maps to 'ftRange' attribute on 'ftPools' aux object class.
- */
- String getBeginRange();
-
-
- /**
- * Set the begin Role range attribute for AdminRole entity.
- *
- * @param beginRange maps to 'ftRange' attribute on 'ftPools' aux object class.
- */
- void setBeginRange( String beginRange );
-
-
- /**
- * Return the end Role range attribute for AdminRole entity.
- *
- * @return String that maps to 'ftRange' attribute on 'ftPools' aux object class.
- */
- String getEndRange();
-
-
- /**
- * Set the end Role range attribute for AdminRole entity.
- *
- * @param endRange maps to 'ftRange' attribute on 'ftPools' aux object class.
- */
- void setEndRange( String endRange );
-
-
- /**
- * Set the begin inclusive which specifies if role range includes or excludes the 'beginRange' attribute.
- *
- * @return String that maps to 'ftRange' attribute on 'ftPools' aux object class.
- */
- boolean isBeginInclusive();
-
-
- /**
- * Get the begin inclusive which specifies if role range includes or excludes the 'beginRange' attribute.
- *
- * @param beginInclusive maps to 'ftRange' attribute on 'ftPools' aux object class.
- */
- void setBeginInclusive( boolean beginInclusive );
-
-
- /**
- * Set the end inclusive which specifies if role range includes or excludes the 'endRange' attribute.
- *
- * @return String that maps to 'ftRange' attribute on 'ftPools' aux object class.
- */
- boolean isEndInclusive();
-
-
- /**
- * Get the end inclusive which specifies if role range includes or excludes the 'endRange' attribute.
- *
- * @param endInclusive maps to 'ftRange' attribute on 'ftPools' aux object class.
- */
- void setEndInclusive( boolean endInclusive );
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/AttrHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/AttrHelper.java b/src/main/java/org/apache/directory/fortress/core/rbac/AttrHelper.java
new file mode 100755
index 0000000..8b08944
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/AttrHelper.java
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.fortress.core.rbac;
+
+import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.name.Rdn;
+import org.apache.directory.api.util.DateUtils;
+import org.apache.directory.fortress.core.GlobalIds;
+import org.apache.directory.fortress.core.model.Administrator;
+import org.apache.directory.fortress.core.model.AuthZ;
+import org.apache.directory.fortress.core.model.Permission;
+import org.apache.directory.fortress.core.util.attr.VUtil;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Properties;
+
+/**
+ * Class contains static utilities for various conversions of ldap data to application entity and back. These methods are called by the
+ * Fortress DAO's, i.e. {@link org.apache.directory.fortress.core.rbac.UserDAO}.
+ * These are low-level data utilities and no validations are performed. These apis should not be called by outside programs.
+ * <p/>
+ * This class is thread safe.
+ * <p/>
+
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public final class AttrHelper
+{
+
+ /**
+ * Private constructor
+ *
+ */
+ private AttrHelper()
+ {
+ }
+
+ /**
+ * Perform copy on ARBAC attributes. This is used during assignment of {@link org.apache.directory.fortress.core.model.AdminRole} to {@link org.apache.directory.fortress.core.model.User}.
+ * This method does not perform input validations.
+ *
+ * @param srcR contains source attributes to copy.
+ * @param trgR contains the target reference.
+ */
+ public static void copyAdminAttrs(Administrator srcR, Administrator trgR)
+ {
+ trgR.setBeginInclusive(srcR.isBeginInclusive());
+ trgR.setEndInclusive(srcR.isEndInclusive());
+ trgR.setBeginRange(srcR.getBeginRange());
+ trgR.setEndRange(srcR.getEndRange());
+ // copy the user and perm pools:
+ trgR.setOsP(srcR.getOsP());
+ trgR.setOsU(srcR.getOsU());
+ }
+
+ /**
+ * Convert from a {@link java.util.List} of properties stored as name:value pairs to
+ * a {@link java.util.Properties}.
+ *
+ * @param propList contains a list of name-value pairs separated by a ':'.
+ * @return reference to a Properties collection.
+ */
+ public static Properties getProperties(List<String> propList)
+ {
+ return getProperties(propList, GlobalIds.PROP_SEP );
+ }
+
+ /**
+ * Convert from a {@link java.util.List} of properties stored as name:value pairs to
+ * a {@link java.util.Properties}.
+ *
+ * @param propList contains a list of name-value pairs separated by a ':'.
+ * @param separator contains char to be used to separate key and value.
+ * @return reference to a Properties collection.
+ */
+ public static Properties getProperties( List<String> propList, char separator )
+ {
+ Properties props = null;
+ if (propList != null && propList.size() > 0)
+ {
+ props = new Properties();
+ propList.size();
+ for (String raw : propList)
+ {
+ int indx = raw.indexOf(separator);
+ if (indx >= 1)
+ {
+ props.setProperty(raw.substring(0, indx), raw.substring(indx + 1));
+ }
+ }
+ }
+ return props;
+ }
+
+ /**
+ * Convert from a comma delimited list of name-value pairs separated by a ':'. Return the pros as {@link java.util.Properties}.
+ *
+ * @param inputString contains comma delimited list of properties.
+ * @return java collection class containing props.
+ */
+ public static Properties getProperties( String inputString )
+ {
+ return getProperties( inputString, GlobalIds.PROP_SEP );
+ }
+
+ /**
+ * Convert from a comma delimited list of name-value pairs separated by a ':'. Return the pros as {@link java.util.Properties}.
+ *
+ * @param inputString contains comma delimited list of properties.
+ * @param separator contains char to be used to separate key and value.
+ * @return java collection class containing props.
+ */
+ public static Properties getProperties( String inputString, char separator )
+ {
+ return getProperties( inputString, separator, GlobalIds.DELIMITER );
+ }
+
+ /**
+ * Convert from a comma delimited list of name-value pairs separated by a ':'. Return the pros as {@link java.util.Properties}.
+ *
+ * @param inputString contains comma delimited list of properties.
+ * @param separator contains char to be used to separate key and value.
+ * @param delimiter contains a single char specifying delimiter between properties.
+ * @return java collection class containing props.
+ */
+ public static Properties getProperties( String inputString, char separator, String delimiter )
+ {
+ Properties props = new Properties();
+ if (inputString != null && inputString.length() > 0)
+ {
+ StringTokenizer maxTkn = new StringTokenizer(inputString, delimiter);
+ if (maxTkn.countTokens() > 0)
+ {
+ while (maxTkn.hasMoreTokens())
+ {
+ String val = maxTkn.nextToken();
+ int indx = val.indexOf(separator);
+ if (indx >= 1)
+ {
+ String name = val.substring(0, indx).trim();
+ String value = val.substring(indx + 1).trim();
+ props.setProperty(name, value);
+ }
+ }
+ }
+ }
+ return props;
+ }
+
+ /**
+ * Parse a raw slapd access log format data string for userId.
+ *
+ * @param inputString raw slapd access log data.
+ * @return string containing userId.
+ */
+ public static String getAuthZId(String inputString)
+ {
+ //reqAuthzID <uid=fttu3user4,ou=people,dc=jts,dc=com>
+ String userId = null;
+ if (inputString != null && inputString.length() > 0)
+ {
+ StringTokenizer maxTkn = new StringTokenizer(inputString, ",");
+ if (maxTkn.countTokens() > 0)
+ {
+ String val = maxTkn.nextToken();
+ int indx = val.indexOf('=');
+ if (indx >= 1)
+ {
+ userId = val.substring(indx + 1);
+ }
+ }
+ }
+ return userId;
+ }
+
+
+ /**
+ * Break the authZ eqDn attribute into 1. permission object name, 2. op name and 3. object id (optional).
+ *
+ * @param authZ contains the raw dn format from openldap slapo access log data
+ * @return Permisison containing objName, opName and optionally the objId populated from the raw data.
+ */
+ public static Permission getAuthZPerm(AuthZ authZ) throws LdapInvalidDnException
+ {
+ // This will be returned to the caller:
+ Permission pOp = new Permission();
+ // Break dn into rdns for leaf and parent. Use the 'type' field in rdn.
+ // The objId value is optional. If present it will be part of the parent's relative distinguished name..
+ // Here the sample reqDN=ftOpNm=TOP2_2+ftObjId=002,ftObjNm=TOB2_1,ou=Permissions,ou=RBAC,dc=example,dc=com
+ // Will be mapped to objName=TOB2_1, opName=TOP2_2, objId=002, in the returned permission object.
+ Dn dn = new Dn( authZ.getReqDN() );
+ if(dn != null && dn.getRdns() != null && VUtil.isNotNullOrEmpty( dn.getRdns() ) )
+ {
+ for( Rdn rdn : dn.getRdns() )
+ {
+ // The rdn type attribute will be mapped to objName, opName and objId fields.
+ switch ( rdn.getType() )
+ {
+ case GlobalIds.POP_NAME:
+ pOp.setOpName( rdn.getType() );
+ break;
+ case GlobalIds.POBJ_NAME:
+ pOp.setObjName( rdn.getType() );
+ break;
+ case GlobalIds.POBJ_ID:
+ pOp.setObjId( rdn.getType() );
+ break;
+ }
+ }
+ }
+ return pOp;
+ }
+
+
+ /**
+ * Convert from raw ldap generalized time format to {@link java.util.Date}.
+ * to decode the string.
+ *
+ * @param inputString containing raw ldap generalized time formatted string.
+ * @return converted to {@link java.util.Date}.
+ */
+ public static Date decodeGeneralizedTime(String inputString) throws ParseException
+ {
+ Date aDate = null;
+ aDate = DateUtils.getDate( inputString );
+ return aDate;
+ }
+
+
+ /**
+ * Convert from java date {@link java.util.Date} format to raw ldap generalized time format.
+ * to encode the string.
+ *
+ * @param date reference to standard java date.
+ * @return converted to standardized ldap generalized time format.
+ */
+ public static String encodeGeneralizedTime(Date date)
+ {
+ String szTime = null;
+ szTime = DateUtils.getGeneralizedTime( date );
+ return szTime;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/AuditDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/AuditDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/AuditDAO.java
index 3c97b46..9632330 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/AuditDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/AuditDAO.java
@@ -41,7 +41,6 @@ import org.apache.directory.fortress.core.GlobalIds;
import org.apache.directory.fortress.core.ObjectFactory;
import org.apache.directory.fortress.core.cfg.Config;
import org.apache.directory.fortress.core.ldap.ApacheDsDataProvider;
-import org.apache.directory.fortress.core.util.attr.AttrHelper;
import org.apache.directory.fortress.core.util.attr.VUtil;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/DelAdminMgrImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/DelAdminMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/rbac/DelAdminMgrImpl.java
index ff6033d..993f71b 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/DelAdminMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/DelAdminMgrImpl.java
@@ -33,7 +33,6 @@ import org.apache.directory.fortress.core.model.Relationship;
import org.apache.directory.fortress.core.model.User;
import org.apache.directory.fortress.core.model.UserAdminRole;
import org.apache.directory.fortress.core.util.time.CUtil;
-import org.apache.directory.fortress.core.util.attr.AttrHelper;
import org.apache.directory.fortress.core.util.attr.VUtil;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/Graphable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/Graphable.java b/src/main/java/org/apache/directory/fortress/core/rbac/Graphable.java
deleted file mode 100644
index 5009a33..0000000
--- a/src/main/java/org/apache/directory/fortress/core/rbac/Graphable.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.fortress.core.rbac;
-
-
-import java.util.Set;
-
-
-/**
- * The Fortress Graphable interface prescribes attributes that are used to maintain implementor within a simple directed graph.
- * {@link org.apache.directory.fortress.core.model.Role}, {@link org.apache.directory.fortress.core.model.AdminRole}, {@link org.apache.directory.fortress.core.model.OrgUnit} entities.
- * <p/>
- * <h4>Manageable Schema</h4>
- * The entity maps to Fortress LDAP attributetype ( 1.3.6.1.4.1.1.38088.1.28
- * NAME 'ftParents'
- * DESC 'Fortress Parent Nodes'
- * EQUALITY caseIgnoreMatch
- * SUBSTR caseIgnoreSubstringsMatch
- * SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
- * <p/>
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public interface Graphable
-{
- /**
- * Get the names of roles that are parents (direct ascendants) of this role.
- *
- * @return Set of parent role names assigned to this role.
- */
- Set<String> getParents();
-
-
- /**
- * Set the names of roles names that are parents (direct ascendants) of this role.
- *
- * @param parents contains the Set of parent role names assigned to this role.
- */
- void setParents( Set<String> parents );
-
-
- /**
- * Set the occupant attribute with the contents of the User dn.
- *
- * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
- */
- void setParent( String parent );
-
-
- /**
- * Set the occupant attribute with the contents of the User dn.
- *
- * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
- */
- void delParent( String parent );
-
-
- /**
- * Get the name required attribute of the node.
- *
- * @return attribute maps to attribute on 'organizationalUnit' object class.
- */
- String getName();
-
-
- /**
- * Sets the required name attribute on the node.
- *
- */
- void setName( String name );
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/HierUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/HierUtil.java b/src/main/java/org/apache/directory/fortress/core/rbac/HierUtil.java
index 12657ef..8b8e9bd 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/HierUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/HierUtil.java
@@ -29,6 +29,7 @@ import java.util.TreeSet;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import org.apache.directory.fortress.core.model.Graphable;
import org.apache.directory.fortress.core.model.Hier;
import org.apache.directory.fortress.core.model.Relationship;
import org.jgrapht.graph.SimpleDirectedGraph;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
index c2f4ea7..7dc8a93 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
@@ -40,6 +40,7 @@ import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.util.Strings;
+import org.apache.directory.fortress.core.model.Graphable;
import org.apache.directory.fortress.core.model.OrgUnit;
import org.apache.directory.ldap.client.api.LdapConnection;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitP.java b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitP.java
index 7ebf2c8..4734328 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitP.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitP.java
@@ -25,6 +25,7 @@ import java.util.Set;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import org.apache.directory.fortress.core.model.Graphable;
import org.apache.directory.fortress.core.model.OrgUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/PermDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/PermDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/PermDAO.java
index 2452a1d..1e881ad 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/PermDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/PermDAO.java
@@ -56,7 +56,6 @@ import org.apache.directory.fortress.core.ObjectFactory;
import org.apache.directory.fortress.core.RemoveException;
import org.apache.directory.fortress.core.UpdateException;
import org.apache.directory.fortress.core.ldap.ApacheDsDataProvider;
-import org.apache.directory.fortress.core.util.attr.AttrHelper;
import org.apache.directory.fortress.core.util.attr.VUtil;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/PsoUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/PsoUtil.java b/src/main/java/org/apache/directory/fortress/core/rbac/PsoUtil.java
index fa37fbb..93fe49f 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/PsoUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/PsoUtil.java
@@ -25,6 +25,7 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.locks.ReadWriteLock;
+import org.apache.directory.fortress.core.model.Graphable;
import org.apache.directory.fortress.core.model.Hier;
import org.apache.directory.fortress.core.model.OrgUnit;
import org.apache.directory.fortress.core.model.Relationship;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/RoleDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/RoleDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/RoleDAO.java
index ad82428..9a33f48 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/RoleDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/RoleDAO.java
@@ -35,6 +35,7 @@ import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
import org.apache.directory.api.ldap.model.message.SearchScope;
+import org.apache.directory.fortress.core.model.Graphable;
import org.apache.directory.ldap.client.api.LdapConnection;
import org.apache.directory.fortress.core.CreateException;
import org.apache.directory.fortress.core.FinderException;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/RoleP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/RoleP.java b/src/main/java/org/apache/directory/fortress/core/rbac/RoleP.java
index a13780e..ebe8fd3 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/RoleP.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/RoleP.java
@@ -27,6 +27,7 @@ import org.apache.directory.fortress.core.GlobalErrIds;
import org.apache.directory.fortress.core.GlobalIds;
import org.apache.directory.fortress.core.SecurityException;
import org.apache.directory.fortress.core.ValidationException;
+import org.apache.directory.fortress.core.model.Graphable;
import org.apache.directory.fortress.core.model.Role;
import org.apache.directory.fortress.core.model.UserRole;
import org.apache.directory.fortress.core.util.attr.VUtil;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/RoleUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/RoleUtil.java b/src/main/java/org/apache/directory/fortress/core/rbac/RoleUtil.java
index 03ae1ae..3ba0b06 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/RoleUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/RoleUtil.java
@@ -25,6 +25,7 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.locks.ReadWriteLock;
+import org.apache.directory.fortress.core.model.Graphable;
import org.apache.directory.fortress.core.model.Hier;
import org.apache.directory.fortress.core.model.ParentUtil;
import org.apache.directory.fortress.core.model.Relationship;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/UserDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/UserDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/UserDAO.java
index ad87145..d9197f5 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/UserDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/UserDAO.java
@@ -70,7 +70,6 @@ import org.apache.directory.fortress.core.SecurityException;
import org.apache.directory.fortress.core.UpdateException;
import org.apache.directory.fortress.core.cfg.Config;
import org.apache.directory.fortress.core.ldap.ApacheDsDataProvider;
-import org.apache.directory.fortress.core.util.attr.AttrHelper;
import org.apache.directory.fortress.core.util.attr.VUtil;
import org.apache.directory.fortress.core.util.time.CUtil;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/UserP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/UserP.java b/src/main/java/org/apache/directory/fortress/core/rbac/UserP.java
index 27e04c8..5fd9790 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/UserP.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/UserP.java
@@ -41,7 +41,6 @@ import org.apache.directory.fortress.core.ObjectFactory;
import org.apache.directory.fortress.core.PasswordException;
import org.apache.directory.fortress.core.SecurityException;
import org.apache.directory.fortress.core.ValidationException;
-import org.apache.directory.fortress.core.util.attr.AttrHelper;
import org.apache.directory.fortress.core.util.attr.VUtil;
import org.apache.directory.fortress.core.util.time.CUtil;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/rbac/UsoUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/UsoUtil.java b/src/main/java/org/apache/directory/fortress/core/rbac/UsoUtil.java
index d7c1294..4419751 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/UsoUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/UsoUtil.java
@@ -25,6 +25,7 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.locks.ReadWriteLock;
+import org.apache.directory.fortress.core.model.Graphable;
import org.apache.directory.fortress.core.model.Hier;
import org.apache.directory.fortress.core.model.OrgUnit;
import org.apache.directory.fortress.core.model.Relationship;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/main/java/org/apache/directory/fortress/core/util/attr/AttrHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/attr/AttrHelper.java b/src/main/java/org/apache/directory/fortress/core/util/attr/AttrHelper.java
deleted file mode 100755
index 17bd489..0000000
--- a/src/main/java/org/apache/directory/fortress/core/util/attr/AttrHelper.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.fortress.core.util.attr;
-
-import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
-import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.api.ldap.model.name.Rdn;
-import org.apache.directory.api.util.DateUtils;
-import org.apache.directory.fortress.core.GlobalIds;
-import org.apache.directory.fortress.core.rbac.Administrator;
-import org.apache.directory.fortress.core.model.AuthZ;
-import org.apache.directory.fortress.core.model.Permission;
-
-import java.text.ParseException;
-import java.util.Date;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.Properties;
-
-/**
- * Class contains static utilities for various conversions of ldap data to application entity and back. These methods are called by the
- * Fortress DAO's, i.e. {@link org.apache.directory.fortress.core.rbac.UserDAO}.
- * These are low-level data utilities and no validations are performed. These apis should not be called by outside programs.
- * <p/>
- * This class is thread safe.
- * <p/>
-
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public final class AttrHelper
-{
-
- /**
- * Private constructor
- *
- */
- private AttrHelper()
- {
- }
-
- /**
- * Perform copy on ARBAC attributes. This is used during assignment of {@link org.apache.directory.fortress.core.model.AdminRole} to {@link org.apache.directory.fortress.core.model.User}.
- * This method does not perform input validations.
- *
- * @param srcR contains source attributes to copy.
- * @param trgR contains the target reference.
- */
- public static void copyAdminAttrs(Administrator srcR, Administrator trgR)
- {
- trgR.setBeginInclusive(srcR.isBeginInclusive());
- trgR.setEndInclusive(srcR.isEndInclusive());
- trgR.setBeginRange(srcR.getBeginRange());
- trgR.setEndRange(srcR.getEndRange());
- // copy the user and perm pools:
- trgR.setOsP(srcR.getOsP());
- trgR.setOsU(srcR.getOsU());
- }
-
- /**
- * Convert from a {@link java.util.List} of properties stored as name:value pairs to
- * a {@link java.util.Properties}.
- *
- * @param propList contains a list of name-value pairs separated by a ':'.
- * @return reference to a Properties collection.
- */
- public static Properties getProperties(List<String> propList)
- {
- return getProperties(propList, GlobalIds.PROP_SEP );
- }
-
- /**
- * Convert from a {@link java.util.List} of properties stored as name:value pairs to
- * a {@link java.util.Properties}.
- *
- * @param propList contains a list of name-value pairs separated by a ':'.
- * @param separator contains char to be used to separate key and value.
- * @return reference to a Properties collection.
- */
- public static Properties getProperties( List<String> propList, char separator )
- {
- Properties props = null;
- if (propList != null && propList.size() > 0)
- {
- props = new Properties();
- propList.size();
- for (String raw : propList)
- {
- int indx = raw.indexOf(separator);
- if (indx >= 1)
- {
- props.setProperty(raw.substring(0, indx), raw.substring(indx + 1));
- }
- }
- }
- return props;
- }
-
- /**
- * Convert from a comma delimited list of name-value pairs separated by a ':'. Return the pros as {@link java.util.Properties}.
- *
- * @param inputString contains comma delimited list of properties.
- * @return java collection class containing props.
- */
- public static Properties getProperties( String inputString )
- {
- return getProperties( inputString, GlobalIds.PROP_SEP );
- }
-
- /**
- * Convert from a comma delimited list of name-value pairs separated by a ':'. Return the pros as {@link java.util.Properties}.
- *
- * @param inputString contains comma delimited list of properties.
- * @param separator contains char to be used to separate key and value.
- * @return java collection class containing props.
- */
- public static Properties getProperties( String inputString, char separator )
- {
- return getProperties( inputString, separator, GlobalIds.DELIMITER );
- }
-
- /**
- * Convert from a comma delimited list of name-value pairs separated by a ':'. Return the pros as {@link java.util.Properties}.
- *
- * @param inputString contains comma delimited list of properties.
- * @param separator contains char to be used to separate key and value.
- * @param delimiter contains a single char specifying delimiter between properties.
- * @return java collection class containing props.
- */
- public static Properties getProperties( String inputString, char separator, String delimiter )
- {
- Properties props = new Properties();
- if (inputString != null && inputString.length() > 0)
- {
- StringTokenizer maxTkn = new StringTokenizer(inputString, delimiter);
- if (maxTkn.countTokens() > 0)
- {
- while (maxTkn.hasMoreTokens())
- {
- String val = maxTkn.nextToken();
- int indx = val.indexOf(separator);
- if (indx >= 1)
- {
- String name = val.substring(0, indx).trim();
- String value = val.substring(indx + 1).trim();
- props.setProperty(name, value);
- }
- }
- }
- }
- return props;
- }
-
- /**
- * Parse a raw slapd access log format data string for userId.
- *
- * @param inputString raw slapd access log data.
- * @return string containing userId.
- */
- public static String getAuthZId(String inputString)
- {
- //reqAuthzID <uid=fttu3user4,ou=people,dc=jts,dc=com>
- String userId = null;
- if (inputString != null && inputString.length() > 0)
- {
- StringTokenizer maxTkn = new StringTokenizer(inputString, ",");
- if (maxTkn.countTokens() > 0)
- {
- String val = maxTkn.nextToken();
- int indx = val.indexOf('=');
- if (indx >= 1)
- {
- userId = val.substring(indx + 1);
- }
- }
- }
- return userId;
- }
-
-
- /**
- * Break the authZ eqDn attribute into 1. permission object name, 2. op name and 3. object id (optional).
- *
- * @param authZ contains the raw dn format from openldap slapo access log data
- * @return Permisison containing objName, opName and optionally the objId populated from the raw data.
- */
- public static Permission getAuthZPerm(AuthZ authZ) throws LdapInvalidDnException
- {
- // This will be returned to the caller:
- Permission pOp = new Permission();
- // Break dn into rdns for leaf and parent. Use the 'type' field in rdn.
- // The objId value is optional. If present it will be part of the parent's relative distinguished name..
- // Here the sample reqDN=ftOpNm=TOP2_2+ftObjId=002,ftObjNm=TOB2_1,ou=Permissions,ou=RBAC,dc=example,dc=com
- // Will be mapped to objName=TOB2_1, opName=TOP2_2, objId=002, in the returned permission object.
- Dn dn = new Dn( authZ.getReqDN() );
- if(dn != null && dn.getRdns() != null && VUtil.isNotNullOrEmpty( dn.getRdns() ) )
- {
- for( Rdn rdn : dn.getRdns() )
- {
- // The rdn type attribute will be mapped to objName, opName and objId fields.
- switch ( rdn.getType() )
- {
- case GlobalIds.POP_NAME:
- pOp.setOpName( rdn.getType() );
- break;
- case GlobalIds.POBJ_NAME:
- pOp.setObjName( rdn.getType() );
- break;
- case GlobalIds.POBJ_ID:
- pOp.setObjId( rdn.getType() );
- break;
- }
- }
- }
- return pOp;
- }
-
-
- /**
- * Convert from raw ldap generalized time format to {@link java.util.Date}.
- * to decode the string.
- *
- * @param inputString containing raw ldap generalized time formatted string.
- * @return converted to {@link java.util.Date}.
- */
- public static Date decodeGeneralizedTime(String inputString) throws ParseException
- {
- Date aDate = null;
- aDate = DateUtils.getDate( inputString );
- return aDate;
- }
-
-
- /**
- * Convert from java date {@link java.util.Date} format to raw ldap generalized time format.
- * to encode the string.
- *
- * @param date reference to standard java date.
- * @return converted to standardized ldap generalized time format.
- */
- public static String encodeGeneralizedTime(Date date)
- {
- String szTime = null;
- szTime = DateUtils.getGeneralizedTime( date );
- return szTime;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d7e32c5/src/test/java/org/apache/directory/fortress/core/AuditMgrConsole.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/AuditMgrConsole.java b/src/test/java/org/apache/directory/fortress/core/AuditMgrConsole.java
index 1b4ee42..0e2cc18 100755
--- a/src/test/java/org/apache/directory/fortress/core/AuditMgrConsole.java
+++ b/src/test/java/org/apache/directory/fortress/core/AuditMgrConsole.java
@@ -26,7 +26,7 @@ import org.apache.directory.fortress.core.model.Mod;
import org.apache.directory.fortress.core.rbac.TestUtils;
import org.apache.directory.fortress.core.model.UserAudit;
import org.apache.directory.fortress.core.model.Permission;
-import org.apache.directory.fortress.core.util.attr.AttrHelper;
+import org.apache.directory.fortress.core.rbac.AttrHelper;
import org.apache.directory.fortress.core.util.attr.VUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;