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 01:02:09 UTC
[04/19] directory-fortress-core git commit: FC-109 - break core
package cycles
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/0c46e4de/src/main/java/org/apache/directory/fortress/core/rbac/UserAdminRole.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/UserAdminRole.java b/src/main/java/org/apache/directory/fortress/core/rbac/UserAdminRole.java
deleted file mode 100755
index e1aad22..0000000
--- a/src/main/java/org/apache/directory/fortress/core/rbac/UserAdminRole.java
+++ /dev/null
@@ -1,659 +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;
-import java.util.TreeSet;
-
-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;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.directory.fortress.core.GlobalIds;
-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;
-
-
-/**
- * The UserAdminRole entity extends the UserRole and is used to store ARBAC User to AdminRole assignment along with temporal and
- * ARBAC contraint values.
- * The contents of the UserAdminRole entity will be stored on the User entity in the 'ftARA' (AdminRole name) and 'ftARC' (Temporal and ARBAC Constraints) attributes on the 'ftUserAttrs' object class.
- * The UserAdminRole entity carries elements of {@link org.apache.directory.fortress.core.util.time.Constraint}. Any attributes of Constraint not set within this entity
- * will use same attribute from the {@link org.apache.directory.fortress.core.rbac.AdminRole} entity. Thus the UserAdminRole can override Constraint attributes from it's corresponding AdminRole if required by caller.
- * <p/>
- * <h4>UserAdminRole Schema</h4>
- * ftUserAttrs is used to store RBAC and ARBAC Role role assignments and other security attributes on User entity.
- * <pre>
- * ------------------------------------------
- * Fortress User Attributes Auxiliary Object Class
- * objectclass ( 1.3.6.1.4.1.38088.3.1
- * NAME 'ftUserAttrs'
- * DESC 'Fortress User Attribute AUX Object Class'
- * AUXILIARY
- * MUST (
- * ftId
- * )
- * MAY (
- * ftRC $
- * ftRA $
- * ftARC $
- * ftARA $
- * ftCstr $
- * ftSystem
- * )
- * )
- * ------------------------------------------
- * </pre>
- * <p/>
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-/*
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "userAdminRole", propOrder = {
- "beginInclusive",
- "beginRange",
- "endInclusive",
- "endRange",
- "osP",
- "osU",
- "roleRangeRaw"
-})
-*/
-@XmlRootElement(name = "fortUserAdminRole")
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "userAdminRole", propOrder =
- {
- "osPs",
- "osUs",
- "beginInclusive",
- "beginRange",
- "endInclusive",
- "endRange",
- "parents"
-})
-public class UserAdminRole extends UserRole implements Administrator
-{
- /** Default serialVersionUID */
- private static final long serialVersionUID = 1L;
- @XmlElement(nillable = true)
- private Set<String> osPs;
- @XmlElement(nillable = true)
- private Set<String> osUs;
- private String beginRange;
- private String endRange;
- private boolean beginInclusive;
- private boolean endInclusive;
- @XmlElement(nillable = true)
- private Set<String> parents;
-
- // Used for formatting raw data:
- private static final String P = "P";
- private static final String U = "U";
- private static final String R = "R";
- private static final String LEFT_PAREN = "(";
- private static final String RIGHT_PAREN = ")";
- private static final String LEFT_BRACKET = "[";
- private static final String RIGHT_BRACKET = "]";
-
-
- /**
- * Default constructor is used by internal Fortress classes.
- */
- public UserAdminRole()
- {
- }
-
-
- /**
- * Construct a UserRole entity given the required attributes 'userId' and 'role' name.
- *
- * @param userId maps to the 'uid' attribute on the 'inetOrgPerson' object class.
- * @param name maps to the 'ftARA' attribute on the 'ftUserAttrs' object class.
- */
- public UserAdminRole( String userId, String name )
- {
- this.userId = userId;
- this.name = name;
- }
-
-
- /**
- * Construct an ARBAC Role with required attribute 'userId' and optional temporal constraint.
- *
- * @param userId maps to the 'uid' attribute on the 'inetOrgPerson' object class.
- * @param con maps to 'ftARC' attribute in 'ftUserAttrs' object class.
- */
- public UserAdminRole( String userId, Constraint con )
- {
- this.userId = userId;
- CUtil.copy( con, this );
- }
-
-
- /**
- * This method loads UserAdminRole entity temporal and ARBAC constraint instance variables with data that was retrieved from the
- * 'ftARC' attribute on the 'ftUserAttrs' object class. This is the raw format that Fortress uses to condense the temporal and ARBAC data into
- * a compact String for efficient storage and retrieval and is not intended to be called by external programs.
- *
- * @param szRawData contains a raw formatted String that maps to 'ftARC' attribute on 'ftUserAttrs' object class
- */
- public void load( String szRawData, String contextId )
- {
- if ( ( szRawData != null ) && ( szRawData.length() > 0 ) )
- {
- String[] tokens = StringUtils.splitPreserveAllTokens( szRawData, GlobalIds.DELIMITER );
- for ( int i = 0; i < tokens.length; i++ )
- {
- if ( VUtil.isNotNullOrEmpty( tokens[i] ) )
- {
- switch ( i )
- {
- case 0:
- name = tokens[i];
- parents = RoleUtil.getParents( name.toUpperCase(), contextId );
- break;
-
- case 1:
- this.setTimeout( Integer.parseInt( tokens[i] ) );
- break;
-
- case 2:
- this.setBeginTime( tokens[i] );
- break;
-
- case 3:
- this.setEndTime( tokens[i] );
- break;
-
- case 4:
- this.setBeginDate( tokens[i] );
- break;
-
- case 5:
- this.setEndDate( tokens[i] );
- break;
-
- case 6:
- this.setBeginLockDate( tokens[i] );
- break;
-
- case 7:
- this.setEndLockDate( tokens[i] );
- break;
-
- case 8:
- this.setDayMask( tokens[i] );
- break;
-
- default:
- String szValue = tokens[i];
- int indx = szValue.indexOf( P + GlobalIds.PROP_SEP );
- if ( indx >= 0 )
- {
- String szOsP = szValue.substring( indx + 2 );
- this.setOsP( szOsP );
- }
- indx = szValue.indexOf( U + GlobalIds.PROP_SEP );
- if ( indx >= 0 )
- {
- String szOsU = szValue.substring( indx + 2 );
- this.setOsU( szOsU );
- }
- indx = szValue.indexOf( R + GlobalIds.PROP_SEP );
- if ( indx >= 0 )
- {
- String szRangeRaw = szValue.substring( indx + 2 );
- this.setRoleRangeRaw( szRangeRaw );
- }
- break;
- }
- }
- }
- }
- }
-
-
- /**
- * This method creates raw data format that represents UserAdminRole temporal and ARBAC constraints using instance variables inside entity.
- * The raw data is eventually stored in the 'ftARC' attribute on the 'ftUserAttrs' object class.
- * This is the raw format that Fortress uses to condense the temporal and ARBAC data into a compact String for efficient storage and retrieval
- * and is not intended to be called by external programs.
- *
- * @return String contains a raw formatted String that maps to 'ftARC' attribute on 'ftUserAttrs' object class
- */
- @Override
- public String getRawData()
- {
- String szRole;
- StringBuilder sb = new StringBuilder();
- sb.append( name );
- sb.append( GlobalIds.DELIMITER );
- sb.append( this.getTimeout() );
- sb.append( GlobalIds.DELIMITER );
-
- if ( this.getBeginTime() != null )
- {
- sb.append( this.getBeginTime() );
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( this.getEndTime() != null )
- {
- sb.append( this.getEndTime() );
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( this.getBeginDate() != null )
- {
- sb.append( this.getBeginDate() );
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( this.getEndDate() != null )
- {
- sb.append( this.getEndDate() );
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( this.getBeginLockDate() != null )
- {
- sb.append( this.getBeginLockDate() );
-
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( this.getEndLockDate() != null )
- {
- sb.append( this.getEndLockDate() );
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( this.getDayMask() != null )
- {
- sb.append( this.getDayMask() );
- }
-
- if ( this.getOsU() != null )
- {
- for ( String org : this.getOsU() )
- {
- sb.append( GlobalIds.DELIMITER );
- sb.append( U );
- sb.append( GlobalIds.PROP_SEP );
- sb.append( org );
- }
- }
-
- if ( this.getOsP() != null )
- {
- for ( String org : this.getOsP() )
- {
- sb.append( GlobalIds.DELIMITER );
- sb.append( P );
- sb.append( GlobalIds.PROP_SEP );
- sb.append( org );
- }
- }
- if ( VUtil.isNotNullOrEmpty( this.getRoleRangeRaw() ) )
- {
- sb.append( GlobalIds.DELIMITER );
- sb.append( R );
- sb.append( GlobalIds.PROP_SEP );
- sb.append( this.getRoleRangeRaw() );
- }
-
- szRole = sb.toString();
- return szRole;
- }
-
-
- /**
- * This method loads UserAdminRole entity Role range ARBAC constraint instance variables with data that was retrieved from the
- * 'ftARC' attribute on the 'ftUserAttrs' object class. This is the raw format that Fortress uses to condense the ARBAC data into
- * a compact String for efficient storage and retrieval and is not intended to be called by external programs.
- *
- * @param szRaw contains a raw formatted String that maps to 'ftARC' attribute on 'ftUserAttrs' object class
- */
- @Override
- public void setRoleRangeRaw( String szRaw )
- {
- if ( VUtil.isNotNullOrEmpty( szRaw ) )
- {
- int bindx = szRaw.indexOf( LEFT_PAREN );
- if ( bindx > -1 )
- {
- this.setBeginInclusive( false );
- }
- else
- {
- bindx = szRaw.indexOf( LEFT_BRACKET );
- this.setBeginInclusive( true );
- }
- int eindx = szRaw.indexOf( RIGHT_PAREN );
- if ( eindx > -1 )
- {
- this.setEndInclusive( false );
- }
- else
- {
- eindx = szRaw.indexOf( RIGHT_BRACKET );
- this.setEndInclusive( true );
- }
- int cindx = szRaw.indexOf( GlobalIds.PROP_SEP );
- if ( cindx > -1 )
- {
- String szBeginRange = szRaw.substring( bindx + 1, cindx );
- String szEndRange = szRaw.substring( cindx + 1, eindx );
- this.setBeginRange( szBeginRange );
- this.setEndRange( szEndRange );
- }
- }
- }
-
-
- /**
- * This method retrieves UserAdminRole instance variables and formats into raw data for ARBAC constraint storage for the
- * 'ftARC' attribute on the 'ftUserAttrs' object class. This is the raw format that Fortress uses to condense the ARBAC data into
- * a compact String for efficient storage and retrieval and is not intended to be called by external programs.
- *
- * @return String contains a raw formatted String that maps to 'ftARC' attribute on 'ftUserAttrs' object class
- */
- @Override
- public String getRoleRangeRaw()
- {
- String szRaw = "";
- if ( this.beginRange != null )
- {
- if ( this.isBeginInclusive() )
- szRaw += LEFT_BRACKET;
- else
- szRaw += LEFT_PAREN;
- szRaw += this.getBeginRange();
- szRaw += GlobalIds.PROP_SEP;
- szRaw += this.getEndRange();
- if ( this.isEndInclusive() )
- szRaw += RIGHT_BRACKET;
- else
- szRaw += RIGHT_PAREN;
- }
- return szRaw;
- }
-
-
- /**
- * 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 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public Set<String> getOsP()
- {
- return osPs;
- }
-
-
- /**
- * 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 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public void setOsP( Set<String> osPs )
- {
- this.osPs = osPs;
- }
-
-
- /**
- * Set a Perm OU attribute to be stored on the AdminRole entity.
- *
- * @param osP is a Perm OU that maps to 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public void setOsP( String osP )
- {
- if ( this.osPs == null )
- {
- // create Set with case insensitive comparator:
- osPs = new TreeSet<>( String.CASE_INSENSITIVE_ORDER );
- }
- osPs.add( 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 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public Set<String> getOsU()
- {
- return osUs;
- }
-
-
- /**
- * 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 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public void setOsU( Set<String> osUs )
- {
- this.osUs = osUs;
- }
-
-
- /**
- * Set a User OU attribute to be stored on the AdminRole entity.
- *
- * @param osU is a User OU that maps to 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public void setOsU( String osU )
- {
- if ( this.osUs == null )
- {
- // create Set with case insensitive comparator:
- osUs = new TreeSet<>( String.CASE_INSENSITIVE_ORDER );
- }
- osUs.add( osU );
- }
-
-
- /**
- * Return the begin Role range attribute for AdminRole entity.
- *
- * @return String that maps to 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public String getBeginRange()
- {
- return beginRange;
- }
-
-
- /**
- * Set the begin Role range attribute for AdminRole entity.
- *
- * @param beginRange maps to 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public void setBeginRange( String beginRange )
- {
- this.beginRange = beginRange;
- }
-
-
- /**
- * Return the end Role range attribute for AdminRole entity.
- *
- * @return String that maps to 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public String getEndRange()
- {
- return endRange;
- }
-
-
- /**
- * Set the end Role range attribute for AdminRole entity.
- *
- * @param endRange maps to 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public void setEndRange( String endRange )
- {
- this.endRange = endRange;
- }
-
-
- /**
- * Set the begin inclusive which specifies if role range includes or excludes the 'beginRange' attribute.
- *
- * @return String that maps to 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public boolean isBeginInclusive()
- {
- return beginInclusive;
- }
-
-
- /**
- * Get the begin inclusive which specifies if role range includes or excludes the 'beginRange' attribute.
- *
- * @param beginInclusive maps to 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public void setBeginInclusive( boolean beginInclusive )
- {
- this.beginInclusive = beginInclusive;
- }
-
-
- /**
- * Set the end inclusive which specifies if role range includes or excludes the 'endRange' attribute.
- *
- * @return String that maps to 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public boolean isEndInclusive()
- {
- return endInclusive;
- }
-
-
- /**
- * Get the end inclusive which specifies if role range includes or excludes the 'endRange' attribute.
- *
- * @param endInclusive maps to 'ftARC' attribute on 'ftUserAttrs' aux object class.
- */
- @Override
- public void setEndInclusive( boolean endInclusive )
- {
- this.endInclusive = endInclusive;
- }
-
-
- /**
- * Get the names of admin roles that are parents (direct ascendants) of this admin role.
- * @return Set of parent admin role names assigned to this admin role.
- */
- @Override
- public Set<String> getParents()
- {
- return parents;
- }
-
-
- /**
- * Set the names of parent admin roles.
- * @param parents Set of admin role names.
- */
- @Override
- public void setParents( Set<String> parents )
- {
- this.parents = parents;
- }
-
-
- /**
- * Matches the userId and admin role name from two UserAdminRole entities.
- *
- * @param thatObj contains a UserAdminRole entity.
- * @return boolean indicating both objects contain matching userId and Admin Role names.
- */
- public boolean equals( Object thatObj )
- {
- if ( this == thatObj )
- {
- return true;
- }
-
- if ( this.getName() == null )
- {
- return false;
- }
-
- if ( !( thatObj instanceof UserAdminRole ) )
- {
- return false;
- }
-
- UserAdminRole thatRole = ( UserAdminRole ) thatObj;
-
- if ( thatRole.getName() == null )
- {
- return false;
- }
-
- return ( ( thatRole.getName().equalsIgnoreCase( this.getName() ) ) && ( thatRole.getUserId()
- .equalsIgnoreCase( this.getUserId() ) ) );
- }
-
-
- @Override
- public int hashCode()
- {
- int result = osPs != null ? osPs.hashCode() : 0;
- result = 31 * result + ( osUs != null ? osUs.hashCode() : 0 );
- result = 31 * result + ( beginRange != null ? beginRange.hashCode() : 0 );
- result = 31 * result + ( endRange != null ? endRange.hashCode() : 0 );
- result = 31 * result + ( beginInclusive ? 1 : 0 );
- result = 31 * result + ( endInclusive ? 1 : 0 );
- result = 31 * result + ( parents != null ? parents.hashCode() : 0 );
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/0c46e4de/src/main/java/org/apache/directory/fortress/core/rbac/UserAudit.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/UserAudit.java b/src/main/java/org/apache/directory/fortress/core/rbac/UserAudit.java
deleted file mode 100755
index a12ba21..0000000
--- a/src/main/java/org/apache/directory/fortress/core/rbac/UserAudit.java
+++ /dev/null
@@ -1,312 +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 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;
-
-import java.util.Date;
-
-
-/**
- * This entity is used to pass search criteria into the {@link org.apache.directory.fortress.core.AuditMgr} APIs, down through the
- * {@link org.apache.directory.fortress.core.rbac.AuditP} process layer and finally into the {@link AuditDAO} data access layer. Once the data has been
- * retrieved from the directory it will be passed back to the caller using one of audit output entities.
- * <p/>
- * All audit data is returned to user using one of the following:
- * <ul>
- * <li> Authorization events: {@link org.apache.directory.fortress.core.rbac.AuthZ}
- * <li> Authentication events: {@link org.apache.directory.fortress.core.rbac.Bind}
- * <li> Modification events: {@link org.apache.directory.fortress.core.rbac.Mod}
- * </ul>
- * <p/>
- * <p/>
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-@XmlRootElement(name = "fortUserAudit")
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "userAudit", propOrder =
- {
- "name",
- "description",
- "failedOnly",
- "objName",
- "objId",
- "opName",
- "userId",
- "internalUserId",
- "beginDate",
- "endDate",
- "dn",
- "admin"
-})
-public class UserAudit extends FortEntity implements java.io.Serializable
-{
- /** Default serialVersionUID */
- private static final long serialVersionUID = 1L;
- private String name;
- private String description;
- private boolean failedOnly;
- private String objName;
- private String objId;
- private String opName;
- private String userId;
- private String internalUserId;
- @XmlElement(nillable = true)
- private Date beginDate;
- @XmlElement(nillable = true)
- private Date endDate;
- private String dn;
- private boolean admin = false;
-
-
- /**
- * Get the optional objName attribute which limits set by {@link Permission#objName}.
- * For modification search, this attr maps to {@link AuditDAO#REQMOD}. For authorization search, it will map to {@link AuditDAO#REQDN}.
- * The object name is derived from another class name which represents targets for Fortress authorizations. For example {@link AdminMgrImpl} or 'CustomerCheckOutPage'.
- *
- * @return the name of the object which maps to 'reqDn' for 'auditSearch' target, or 'reqMod' for 'auditMod' search.
- */
- public String getObjName()
- {
- return objName;
- }
-
-
- /**
- * Set the optional objName attribute which limits set by {@link Permission#objName}.
- * For modification search, this attr maps to {@link AuditDAO#REQMOD}. For authorization search, it will map to {@link AuditDAO#REQDN}.
- * The object name is derived from another class name which represents targets for Fortress authorizations. For example {@link AdminMgrImpl} or 'CustomerCheckOutPage'.
- *
- * @param objName maps to 'reqDn' for 'auditSearch' target, or 'reqMod' for 'auditMod' search.
- */
- public void setObjName( String objName )
- {
- this.objName = objName;
- }
-
-
- /**
- * The failedOnly flag will limit result set to include only authN or authZ events that have failed.
- * <p/>
- * <ul>
- * <li>{@link AuditMgrImpl#searchInvalidUsers(UserAudit)} maps to ({@link AuditDAO#REQENTRIES} == 0)
- * <li>{@link AuditMgrImpl#searchAuthZs(UserAudit)} maps to ({@link AuditDAO#REQENTRIES} == 0)
- * <li>{@link AuditMgrImpl#searchBinds(UserAudit)} maps to ({@link AuditDAO#REQRESULT} >= 1)
- * </ul>
- *
- * @return boolean if true will limit search to failed events.
- */
- public boolean isFailedOnly()
- {
- return failedOnly;
- }
-
-
- /**
- * The failedOnly flag will limit result set to include only authN or authZ events that have failed.
- * <p/>
- * <ul>
- * <li>{@link AuditMgrImpl#searchInvalidUsers(UserAudit)} maps to ({@link AuditDAO#REQENTRIES} == 0)
- * <li>{@link AuditMgrImpl#searchAuthZs(UserAudit)} maps to ({@link AuditDAO#REQENTRIES} == 0)
- * <li>{@link AuditMgrImpl#searchBinds(UserAudit)} maps to ({@link AuditDAO#REQRESULT} >= 1)
- * </ul>
- *
- * @param failedOnly if boolean true search will limit to failed only.
- */
- public void setFailedOnly( boolean failedOnly )
- {
- this.failedOnly = failedOnly;
- }
-
-
- /**
- * Get the optional opName attribute which limits {@link AuditMgrImpl#searchAdminMods(UserAudit)} by {@link AuditDAO#REQMOD}.
- * The operation name is derived from a method name of a class which represents targets for Fortress authorizations. For example 'read', 'search' or 'add'.
- *
- * @return value that maps to 'reqMod' on 'auditMod' object class.
- */
- public String getOpName()
- {
- return opName;
- }
-
-
- /**
- * Set the optional opName attribute which limits {@link AuditMgrImpl#searchAdminMods(UserAudit)} by {@link AuditDAO#REQMOD}.
- * The operation name is derived from a method name of a class which represents targets for Fortress authorizations. For example 'read', 'search' or 'add'.
- *
- * @param opName attribute maps to 'reqMod' on 'auditMod' object class.
- */
- public void setOpName( String opName )
- {
- this.opName = opName;
- }
-
-
- /**
- * Get the optional userId attribute which limits set by {@link org.apache.directory.fortress.core.rbac.User#userId}.
- * For authentication searchs, this attr maps to {@link AuditDAO#REQDN}. For authorization search, it will map to {@link AuditDAO#REQUAUTHZID}.
- * The userId for this search represents the end user.
- *
- * @return the userId which maps to 'reqDn' for authentications or 'reqAuthzID' for authorization events.
- */
- public String getUserId()
- {
- return userId;
- }
-
-
- /**
- * Set the optional userId attribute which limits set by {@link org.apache.directory.fortress.core.rbac.User#userId}.
- * For authentication searchs, this attr maps to {@link AuditDAO#REQDN}. For authorization search, it will map to {@link AuditDAO#REQUAUTHZID}.
- * The userId for this search represents the end user.
- *
- * @param userId maps to 'reqDn' for authentications or 'reqAuthzID' for authorization events.
- */
- public void setUserId( String userId )
- {
- this.userId = userId;
- }
-
-
- /**
- * Get the optional internalUserId attribute which limits set by {@link org.apache.directory.fortress.core.rbac.User#internalId}.
- * For {@link AuditMgrImpl#searchUserSessions(UserAudit)} this attr maps to {@link AuditDAO#REQMOD}.
- * The internalUserId for this search represents the end user but is stored as its internal id.
- *
- * @return the internalUserId which maps to 'reqMod' for 'auditModify' object class searches.
- */
- public String getInternalUserId()
- {
- return internalUserId;
- }
-
-
- /**
- * Set the optional internalUserId attribute which limits set by {@link org.apache.directory.fortress.core.rbac.User#internalId}.
- * For {@link AuditMgrImpl#searchUserSessions(UserAudit)} this attr maps to {@link AuditDAO#REQMOD}.
- * The internalUserId for this search represents the end user but is stored as its internal id.
- *
- * @param internalUserId maps to 'reqMod' for 'auditModify' object class searches.
- */
- public void setInternalUserId( String internalUserId )
- {
- this.internalUserId = internalUserId;
- }
-
-
- /**
- * Get the Date for search to begin. The earlier the date, the more records will be returned.
- * This attribute is mapped to 'reqStart' on slapd audit records which provides the start
- * time of the operation which is also the rDn for the node.
- *
- * @return attribute that maps to 'reqStart' in audit object classes.
- */
- public Date getBeginDate()
- {
- return beginDate;
- }
-
-
- /**
- * Set the Date for search to begin. The earlier the date, the more records will be returned.
- * This attribute is mapped to 'reqStart' on slapd audit records which provides the start
- * time of the operation which is also the rDn for the node.
- *
- * @param beginDate attribute that maps to 'reqStart' in audit object classes.
- */
- public void setBeginDate( Date beginDate )
- {
- this.beginDate = beginDate;
- }
-
-
- /**
- *
- */
- public Date getEndDate()
- {
- return endDate;
- }
-
-
- /**
- *
- * @param endDate
- */
- public void setEndDate( Date endDate )
- {
- this.endDate = endDate;
- }
-
-
- /**
- * Get the optional dn attribute can be used to constraint {@link AuditMgrImpl#searchUserSessions(UserAudit)}.
- * The dn for this search may represent any target entry in DIT that has been recently modified or deleted.
- *
- * @return the dn which maps to 'reqDn' for 'auditModify' object class searches.
- */
- public String getDn()
- {
- return dn;
- }
-
-
- /**
- * Set the optional dn attribute can be used to constraint {@link AuditMgrImpl#searchUserSessions(UserAudit)}.
- * The dn for this search may represent any target entry in DIT that has been recently modified or deleted.
- *
- * @param dn maps to 'reqDn' for 'auditModify' object class searches.
- */
- public void setDn( String dn )
- {
- this.dn = dn;
- }
-
-
- public String getObjId()
- {
- return objId;
- }
-
-
- public void setObjId( String objId )
- {
- this.objId = objId;
- }
-
-
- public boolean isAdmin()
- {
- return admin;
- }
-
-
- public void setAdmin( boolean admin )
- {
- this.admin = admin;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/0c46e4de/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 da88fd1..10e2bad 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
@@ -46,6 +46,14 @@ import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
import org.apache.directory.api.ldap.model.message.BindResponse;
import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
import org.apache.directory.api.ldap.model.message.SearchScope;
+import org.apache.directory.fortress.core.model.Address;
+import org.apache.directory.fortress.core.model.AdminRole;
+import org.apache.directory.fortress.core.model.OrgUnit;
+import org.apache.directory.fortress.core.model.Role;
+import org.apache.directory.fortress.core.model.Session;
+import org.apache.directory.fortress.core.model.User;
+import org.apache.directory.fortress.core.model.UserAdminRole;
+import org.apache.directory.fortress.core.model.UserRole;
import org.apache.directory.ldap.client.api.LdapConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -2260,9 +2268,9 @@ final class UserDAO extends ApacheDsDataProvider
/**
- * Given a User address, {@link Address}, load into ldap attribute set in preparation for ldap add.
+ * Given a User address, {@link org.apache.directory.fortress.core.model.Address}, load into ldap attribute set in preparation for ldap add.
*
- * @param address contains User address {@link Address} targeted for adding to ldap.
+ * @param address contains User address {@link org.apache.directory.fortress.core.model.Address} targeted for adding to ldap.
* @param entry collection of ldap attributes containing RBAC role assignments in raw ldap format.
* @throws org.apache.directory.api.ldap.model.exception.LdapException
*/
@@ -2447,7 +2455,7 @@ final class UserDAO extends ApacheDsDataProvider
for ( String raw : roles )
{
UserAdminRole ure = new ObjectFactory().createUserAdminRole();
- ure.load( raw, contextId );
+ ure.load( raw, contextId, new RoleUtil() );
ure.setSequenceId( sequence++ );
ure.setUserId( userId );
uRoles.add( ure );
@@ -2492,7 +2500,7 @@ final class UserDAO extends ApacheDsDataProvider
for ( String raw : roles )
{
UserRole ure = new ObjectFactory().createUserRole();
- ure.load( raw, contextId );
+ ure.load( raw, contextId, new RoleUtil() );
ure.setUserId( userId );
ure.setSequenceId( sequence++ );
uRoles.add( ure );
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/0c46e4de/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 dac9d39..27e04c8 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
@@ -24,6 +24,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import org.apache.directory.fortress.core.model.AdminRole;
+import org.apache.directory.fortress.core.model.OrgUnit;
+import org.apache.directory.fortress.core.model.PwPolicy;
+import org.apache.directory.fortress.core.model.Role;
+import org.apache.directory.fortress.core.model.Session;
+import org.apache.directory.fortress.core.model.User;
+import org.apache.directory.fortress.core.model.UserAdminRole;
+import org.apache.directory.fortress.core.model.UserRole;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,7 +50,7 @@ import org.apache.directory.fortress.core.util.time.CUtil;
* Process module for the User entity. This class performs data validations and error mapping. It is typically called
* by internal Fortress manager classes ({@link AdminMgrImpl}, {@link AccessMgrImpl},
* {@link ReviewMgrImpl}, ...) and not intended for external non-Fortress clients. This class will accept,
- * {@link org.apache.directory.fortress.core.rbac.User}, validate its contents and forward on to it's corresponding DAO class {@link org.apache.directory.fortress.core.rbac.UserDAO}.
+ * {@link org.apache.directory.fortress.core.model.User}, validate its contents and forward on to it's corresponding DAO class {@link org.apache.directory.fortress.core.rbac.UserDAO}.
* <p>
* Class will throw {@link SecurityException} to caller in the event of security policy, data constraint violation or system
* error internal to DAO object. This class will forward DAO exceptions ({@link org.apache.directory.fortress.core.FinderException},
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/0c46e4de/src/main/java/org/apache/directory/fortress/core/rbac/UserRole.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/UserRole.java b/src/main/java/org/apache/directory/fortress/core/rbac/UserRole.java
deleted file mode 100755
index e678a08..0000000
--- a/src/main/java/org/apache/directory/fortress/core/rbac/UserRole.java
+++ /dev/null
@@ -1,637 +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.io.Serializable;
-import java.util.Set;
-
-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.XmlSeeAlso;
-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.util.attr.VUtil;
-import org.apache.directory.fortress.core.util.time.CUtil;
-import org.apache.directory.fortress.core.util.time.Constraint;
-
-
-/**
- * The Fortress UserRole entity is used to store an RBAC User to Role assignment along with its temporal constraint
- * values.
- * The contents of the UserRole entity will be stored on the User entity in the 'ftRA' (Role name) and 'ftRC'
- * (Temporal Constraints) attributes on the 'ftUserAttrs' object class.
- * The UserRole entity carries elements of {@link org.apache.directory.fortress.core.util.time.Constraint}. Any attributes of
- * Constraint not set within this entity
- * will use same attribute from the {@link org.apache.directory.fortress.core.rbac.Role} entity. Thus the UserRole can override
- * Constraint attributes from it's corresponding Role if required by caller.
- * <p/>
- * <h4>UserRole Schema</h4>
- * ftUserAttrs is used to store RBAC and ARBAC Role role assignments and other security attributes on User entity.
- * <pre>
- * ------------------------------------------
- * Fortress User Attributes Auxiliary Object Class
- * objectclass ( 1.3.6.1.4.1.38088.3.1
- * NAME 'ftUserAttrs'
- * DESC 'Fortress User Attribute AUX Object Class'
- * AUXILIARY
- * MUST (
- * ftId
- * )
- * MAY (
- * ftRC $
- * ftRA $
- * ftARC $
- * ftARA $
- * ftCstr $
- * ftSystem
- * )
- * )
- * ------------------------------------------
- * </pre>
- * <p/>
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-@XmlRootElement( name = "fortUserRole" )
-@XmlAccessorType( XmlAccessType.FIELD )
-@XmlType( name = "userRole", propOrder = {"name", "userId", "parents", "beginDate", "beginLockDate", "beginTime",
- "dayMask", "endDate", "endLockDate", "endTime", "timeout"} )
-@XmlSeeAlso( {UserAdminRole.class} )
-public class UserRole extends FortEntity implements Serializable, Constraint
-{
- private static final long serialVersionUID = 1L;
-
- protected String userId;
- protected String name;
- private Integer timeout;
- private String beginTime;
- private String endTime;
- private String beginDate;
- private String endDate;
- private String beginLockDate;
- private String endLockDate;
- private String dayMask;
- @XmlElement( nillable = true )
- private Set<String> parents;
-
-
- /**
- * Default constructor is used by internal Fortress classes.
- */
- public UserRole()
- {
- }
-
-
- /**
- * Construct a UserRole entity given the required attributes 'userId' and 'role' name.
- *
- * @param userId maps to the 'uid' attribute on the 'inetOrgPerson' object class.
- * @param role maps to the 'ftRA' attribute on the 'ftUserAttrs' object class.
- */
- public UserRole( String userId, String role )
- {
- this.userId = userId;
- name = role;
-
- }
-
-
- /**
- * Construct an RBAC Role with required attribute 'userId' and optional temporal constraint.
- *
- * @param userId maps to the 'uid' attribute on the 'inetOrgPerson' object class.
- * @param con maps to 'ftRC' attribute in 'ftUserAttrs' object class.
- */
- public UserRole( String userId, Constraint con )
- {
- this.userId = userId;
- CUtil.copy( con, this );
- }
-
-
- /**
- * Construct a UserRole entity given the required attribute role' name.
- *
- * @param role maps to the 'ftRA' attribute on the 'ftUserAttrs' object class.
- */
- public UserRole( String role )
- {
- name = role;
- }
-
- /**
- * This method loads UserRole entity temporal constraint instance variables with data that was retrieved from the
- * 'ftRC' attribute on the 'ftUserAttrs' object class. This is the raw format that Fortress uses to condense the
- * temporal data into
- * a compact String for efficient storage and retrieval and is not intended to be called by external programs.
- *
- * @param szRawData contains a raw formatted String that maps to 'ftRC' attribute on 'ftUserAttrs' object class
- */
- public void load( String szRawData, String contextId )
- {
- if ( ( szRawData != null ) && ( szRawData.length() > 0 ) )
- {
- String[] tokens = StringUtils.splitPreserveAllTokens( szRawData, GlobalIds.DELIMITER );
- for ( int i = 0; i < tokens.length; i++ )
- {
- if ( VUtil.isNotNullOrEmpty( tokens[i] ) )
- {
- switch ( i )
- {
- case 0:
- name = tokens[i];
- parents = RoleUtil.getParents( name.toUpperCase(), contextId );
- break;
-
- case 1:
- timeout = Integer.parseInt( tokens[i] );
- break;
-
- case 2:
- beginTime = tokens[i];
- break;
-
- case 3:
- endTime = tokens[i];
- break;
-
- case 4:
- beginDate = tokens[i];
- break;
-
- case 5:
- endDate = tokens[i];
- break;
-
- case 6:
- beginLockDate = tokens[i];
- break;
-
- case 7:
- endLockDate = tokens[i];
- break;
-
- case 8:
- dayMask = tokens[i];
- break;
- }
- }
- }
- }
- }
-
-
- /**
- * Required on DAO classes convert Temporal attributes stored on entity to raw data object format needed for ldap
- * . For internal use only.
- *
- * @return String that maps to 'ftRA' attribute on the 'ftUserAttrs' object class.
- */
- @Override
- public String getRawData()
- {
- StringBuilder sb = new StringBuilder();
-
- sb.append( name );
- sb.append( GlobalIds.DELIMITER );
- sb.append( timeout );
- sb.append( GlobalIds.DELIMITER );
-
- if ( beginTime != null )
- {
- sb.append( beginTime );
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( endTime != null )
- {
- sb.append( endTime );
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( beginDate != null )
- {
- sb.append( beginDate );
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( endDate != null )
- {
- sb.append( endDate );
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( beginLockDate != null )
- {
- sb.append( beginLockDate );
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( endLockDate != null )
- {
- sb.append( endLockDate );
- }
-
- sb.append( GlobalIds.DELIMITER );
-
- if ( dayMask != null )
- {
- sb.append( dayMask );
- }
-
- return sb.toString();
- }
-
-
- /**
- * Return the userId that is associated with UserRole. UserId is required attribute and must be set on all
- * UserRole assignment operations.
- *
- * @return attribute maps to 'uid' in 'inetOrgPerson' object class.
- */
- public String getUserId()
- {
- return userId;
- }
-
-
- /**
- * Set the userId that is associated with UserRole. UserId is required attribute and must be set on all UserRole
- * assignment operations.
- *
- * @param userId maps to 'uid' in 'inetOrgPerson' object class.
- */
- public void setUserId( String userId )
- {
- this.userId = userId;
- }
-
-
- /**
- * Get the Role name required attribute of the UserRole object
- *
- * @param name maps to 'ftRC' and 'ftRA' attributes on 'ftUserAttrs' object class.
- */
- @Override
- public void setName( String name )
- {
- this.name = name;
- }
-
-
- /**
- * Set the Role name required attribute of the UserRole object
- *
- * @return attribute maps to 'ftRC' and 'ftRA' attributes on 'ftUserAttrs' object class.
- */
- @Override
- public String getName()
- {
- return name;
- }
-
-
- /**
- * temporal boolean flag is used by internal Fortress components.
- *
- * @return boolean indicating if temporal constraints are placed on UserRole.
- */
- @Override
- public boolean isTemporalSet()
- {
- return ( beginTime != null || endTime != null || beginDate != null || endDate != null || beginLockDate !=
- null || endLockDate != null || dayMask != null );
- }
-
-
- /**
- * Set the integer timeout that contains max time (in seconds) that entity may remain inactive.
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param timeout maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public void setTimeout( Integer timeout )
- {
- this.timeout = timeout;
- }
-
-
- /**
- * Set the begin time of day entity is allowed to be activated in system. The format is military time - HHMM,
- * i.e. 0800 (8:00 am) or 1700 (5:00 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param beginTime maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public void setBeginTime( String beginTime )
- {
- this.beginTime = beginTime;
- }
-
-
- /**
- * Set the end time of day entity is allowed to be activated in system. The format is military time - HHMM,
- * i.e. 0000 (12:00 am) or 2359 (11:59 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param endTime maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public void setEndTime( String endTime )
- {
- this.endTime = endTime;
- }
-
-
- /**
- * Set the beginDate when entity is allowed to be activated in system. The format is - YYYYMMDD,
- * i.e. 20100101 (January 1, 2001).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param beginDate maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public void setBeginDate( String beginDate )
- {
- this.beginDate = beginDate;
- }
-
-
- /**
- * Set the end date when entity is not allowed to be activated in system. The format is - YYYYMMDD,
- * i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param endDate maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public void setEndDate( String endDate )
- {
- this.endDate = endDate;
- }
-
-
- /**
- * Set the daymask that specifies what days of week entity is allowed to be activated in system. The format is
- * 1234567, i.e. 23456 (Monday, Tuesday, Wednesday, Thursday, Friday).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param dayMask maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public void setDayMask( String dayMask )
- {
- this.dayMask = dayMask;
- }
-
-
- /**
- * Set the begin lock date when entity is temporarily not allowed to be activated in system. The format is -
- * YYYYMMDD, 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param beginLockDate maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public void setBeginLockDate( String beginLockDate )
- {
- this.beginLockDate = beginLockDate;
- }
-
-
- /**
- * Set the end lock date when entity is allowed to be activated in system once again. The format is - YYYYMMDD,
- * i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param endLockDate maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public void setEndLockDate( String endLockDate )
- {
- this.endLockDate = endLockDate;
- }
-
-
- /**
- * Return the integer timeout that contains total time (in seconds) that entity may remain inactive.
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return int that maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public Integer getTimeout()
- {
- return timeout;
- }
-
-
- /**
- * Contains the begin time of day entity is allowed to be activated in system. The format is military time -
- * HHMM, i.e. 0800 (8:00 am) or 1700 (5:00 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return String that maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public String getBeginTime()
- {
- return beginTime;
- }
-
-
- /**
- * Contains the end time of day entity is allowed to be activated in system. The format is military time - HHMM,
- * i.e. 0000 (12:00 am) or 2359 (11:59 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return String that maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public String getEndTime()
- {
- return endTime;
- }
-
-
- /**
- * Contains the begin date when entity is allowed to be activated in system. The format is - YYYYMMDD,
- * i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return String that maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public String getBeginDate()
- {
- return beginDate;
- }
-
-
- /**
- * Contains the end date when entity is allowed to be activated in system. The format is - YYYYMMDD,
- * i.e. 20101231 (December 31, 2011).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return String that maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public String getEndDate()
- {
- return endDate;
- }
-
-
- /**
- * Contains the begin lock date when entity is temporarily not allowed to activated in system. The format is -
- * YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return String that maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public String getBeginLockDate()
- {
- return beginLockDate;
- }
-
-
- /**
- * Contains the end lock date when entity is allowed to be activated in system once again. The format is -
- * YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return String that maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public String getEndLockDate()
- {
- return endLockDate;
- }
-
-
- /**
- * Get the daymask that indicates what days of week entity is allowed to be activated in system. The format is 1234567, i.e. 23456 (Monday, Tuesday, Wednesday, Thursday, Friday).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return String that maps to 'ftRC', attribute on 'ftUserAttrs' object class.
- */
- @Override
- public String getDayMask()
- {
- return dayMask;
- }
-
-
- /**
- * Get the names of roles that are parents (direct ascendants) of this role.
- *
- * @return Set of parent role names assigned to this role.
- */
- public Set<String> getParents()
- {
- return parents;
- }
-
-
- /**
- * 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.
- */
- public void setParents( Set<String> parents )
- {
- this.parents = parents;
- }
-
-
- /**
- * Matches the userId and role name from two UserRole entities.
- *
- * @param thatObj contains a UserRole entity.
- * @return boolean indicating both objects contain matching userId and Role names.
- */
- public boolean equals( Object thatObj )
- {
- if ( this == thatObj )
- {
- return true;
- }
-
- if ( name == null )
- {
- return false;
- }
-
- if ( !( thatObj instanceof UserRole ) )
- {
- return false;
- }
-
- UserRole thatRole = ( UserRole ) thatObj;
-
- if ( thatRole.getName() == null )
- {
- return false;
- }
-
- return ( thatRole.getName().equalsIgnoreCase( name ) );
- }
-
- @Override
- public int hashCode()
- {
- int result = userId != null ? userId.hashCode() : 0;
- result = 31 * result + ( name != null ? name.hashCode() : 0 );
- result = 31 * result + ( timeout != null ? timeout.hashCode() : 0 );
- result = 31 * result + ( beginTime != null ? beginTime.hashCode() : 0 );
- result = 31 * result + ( endTime != null ? endTime.hashCode() : 0 );
- result = 31 * result + ( beginDate != null ? beginDate.hashCode() : 0 );
- result = 31 * result + ( endDate != null ? endDate.hashCode() : 0 );
- result = 31 * result + ( beginLockDate != null ? beginLockDate.hashCode() : 0 );
- result = 31 * result + ( endLockDate != null ? endLockDate.hashCode() : 0 );
- result = 31 * result + ( dayMask != null ? dayMask.hashCode() : 0 );
- result = 31 * result + ( parents != null ? parents.hashCode() : 0 );
- return result;
- }
-
- /**
- * Used to retrieve UserRole Role name attribute. The Fortress UserRole name maps to 'ftRA' attribute on
- * 'ftUserAttrs' object class.
- */
- @Override
- public String toString()
- {
- return name;
- }
-}
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/0c46e4de/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 7c7f69b..d7c1294 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,9 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.locks.ReadWriteLock;
+import org.apache.directory.fortress.core.model.Hier;
+import org.apache.directory.fortress.core.model.OrgUnit;
+import org.apache.directory.fortress.core.model.Relationship;
import org.jgrapht.graph.SimpleDirectedGraph;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,12 +40,12 @@ import org.apache.directory.fortress.core.util.cache.CacheMgr;
/**
- * This utility wraps {@link HierUtil} methods to provide hierarchical functionality using the {@link org.apache.directory.fortress.core.rbac.OrgUnit} data set for User type {@link org.apache.directory.fortress.core.rbac.OrgUnit.Type#USER}.
+ * This utility wraps {@link HierUtil} methods to provide hierarchical functionality using the {@link org.apache.directory.fortress.core.model.OrgUnit} data set for User type {@link org.apache.directory.fortress.core.model.OrgUnit.Type#USER}.
* The {@code cn=Hierarchies, ou=OS-U} data contains User OU pools is stored within a data cache, {@link #usoCache}, contained within this class. The parent-child edges are contained in LDAP,
- * in {@code ftParents} attribute. The ldap data is retrieved {@link OrgUnitP#getAllDescendants(org.apache.directory.fortress.core.rbac.OrgUnit)} and loaded into {@code org.jgrapht.graph.SimpleDirectedGraph}.
+ * in {@code ftParents} attribute. The ldap data is retrieved {@link OrgUnitP#getAllDescendants(org.apache.directory.fortress.core.model.OrgUnit)} and loaded into {@code org.jgrapht.graph.SimpleDirectedGraph}.
* The graph...
* <ol>
- * <li>is stored as singleton in this class with vertices of {@code String}, and edges, as {@link Relationship}s</li>
+ * <li>is stored as singleton in this class with vertices of {@code String}, and edges, as {@link org.apache.directory.fortress.core.model.Relationship}s</li>
* <li>utilizes open source library, see <a href="http://www.jgrapht.org/">JGraphT</a>.</li>
* <li>contains a general hierarchical data structure i.e. allows multiple inheritance with parents.</li>
* <li>is a simple directed graph thus does not allow cycles.</li>
@@ -65,7 +68,7 @@ public final class UsoUtil
private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
/**
- * Initialize the User OU hierarchies. This will read the {@link org.apache.directory.fortress.core.rbac.Hier} data set from ldap and load into
+ * Initialize the User OU hierarchies. This will read the {@link org.apache.directory.fortress.core.model.Hier} data set from ldap and load into
* the JGraphT simple digraph that referenced statically within this class.
*/
static
@@ -83,10 +86,10 @@ public final class UsoUtil
}
/**
- * Recursively traverse the {@link org.apache.directory.fortress.core.rbac.OrgUnit} graph and return all of the descendants of a given parent {@link org.apache.directory.fortress.core.rbac.OrgUnit#name}.
+ * Recursively traverse the {@link org.apache.directory.fortress.core.model.OrgUnit} graph and return all of the descendants of a given parent {@link org.apache.directory.fortress.core.model.OrgUnit#name}.
*
- * @param name {@link org.apache.directory.fortress.core.rbac.OrgUnit#name} on 'ftOrgUnit' object class.
- * @return Set of names of descendants {@link org.apache.directory.fortress.core.rbac.OrgUnit}s of given parent.
+ * @param name {@link org.apache.directory.fortress.core.model.OrgUnit#name} on 'ftOrgUnit' object class.
+ * @return Set of names of descendants {@link org.apache.directory.fortress.core.model.OrgUnit}s of given parent.
*/
static Set<String> getDescendants( String name, String contextId )
{
@@ -95,9 +98,9 @@ public final class UsoUtil
/**
- * Recursively traverse the {@link org.apache.directory.fortress.core.rbac.OrgUnit.Type#USER} graph and return all of the ascendants of a given child ou.
+ * Recursively traverse the {@link org.apache.directory.fortress.core.model.OrgUnit.Type#USER} graph and return all of the ascendants of a given child ou.
*
- * @param name maps to logical {@link org.apache.directory.fortress.core.rbac.OrgUnit#name} on 'ftOrgUnit' object class.
+ * @param name maps to logical {@link org.apache.directory.fortress.core.model.OrgUnit#name} on 'ftOrgUnit' object class.
* @return Set of ou names that are ascendants of given child.
*/
static Set<String> getAscendants( String name, String contextId )
@@ -107,10 +110,10 @@ public final class UsoUtil
/**
- * Traverse one level of the {@link org.apache.directory.fortress.core.rbac.OrgUnit} graph and return all of the children (direct descendants) of a given parent {@link org.apache.directory.fortress.core.rbac.OrgUnit#name}.
+ * Traverse one level of the {@link org.apache.directory.fortress.core.model.OrgUnit} graph and return all of the children (direct descendants) of a given parent {@link org.apache.directory.fortress.core.model.OrgUnit#name}.
*
- * @param name {@link org.apache.directory.fortress.core.rbac.OrgUnit#name} maps on 'ftOrgUnit' object class.
- * @return Set of names of children {@link org.apache.directory.fortress.core.rbac.OrgUnit}s of given parent.
+ * @param name {@link org.apache.directory.fortress.core.model.OrgUnit#name} maps on 'ftOrgUnit' object class.
+ * @return Set of names of children {@link org.apache.directory.fortress.core.model.OrgUnit}s of given parent.
*/
public static Set<String> getChildren( String name, String contextId )
{
@@ -119,9 +122,9 @@ public final class UsoUtil
/**
- * Traverse one level of the {@link org.apache.directory.fortress.core.rbac.OrgUnit.Type#USER} graph and return all of the parents (direct ascendants) of a given child ou.
+ * Traverse one level of the {@link org.apache.directory.fortress.core.model.OrgUnit.Type#USER} graph and return all of the parents (direct ascendants) of a given child ou.
*
- * @param name maps to logical {@link org.apache.directory.fortress.core.rbac.OrgUnit#name} on 'ftOrgUnit' object class.
+ * @param name maps to logical {@link org.apache.directory.fortress.core.model.OrgUnit#name} on 'ftOrgUnit' object class.
* @return Set of ou names that are parents of given child.
*/
static Set<String> getParents( String name, String contextId )
@@ -131,9 +134,9 @@ public final class UsoUtil
/**
- * Recursively traverse the {@link org.apache.directory.fortress.core.rbac.OrgUnit.Type#USER} graph and return number of children a given parent ou has.
+ * Recursively traverse the {@link org.apache.directory.fortress.core.model.OrgUnit.Type#USER} graph and return number of children a given parent ou has.
*
- * @param name maps to logical {@link org.apache.directory.fortress.core.rbac.OrgUnit#name} on 'ftOrgUnit' object class.
+ * @param name maps to logical {@link org.apache.directory.fortress.core.model.OrgUnit#name} on 'ftOrgUnit' object class.
* @return int value contains the number of children of a given parent ou.
*/
static int numChildren( String name, String contextId )
@@ -143,9 +146,9 @@ public final class UsoUtil
/**
- * Return Set of {@link org.apache.directory.fortress.core.rbac.OrgUnit#name}s ascendants contained within {@link org.apache.directory.fortress.core.rbac.OrgUnit.Type#USER}.
+ * Return Set of {@link org.apache.directory.fortress.core.model.OrgUnit#name}s ascendants contained within {@link org.apache.directory.fortress.core.model.OrgUnit.Type#USER}.
*
- * @param ous contains list of {@link org.apache.directory.fortress.core.rbac.OrgUnit}s.
+ * @param ous contains list of {@link org.apache.directory.fortress.core.model.OrgUnit}s.
* @return contains Set of all descendants.
*/
static Set<String> getInherited( List<OrgUnit> ous, String contextId )
@@ -183,8 +186,8 @@ public final class UsoUtil
* Method will throw {@link org.apache.directory.fortress.core.ValidationException} if rule check fails meaning caller failed validation
* attempt to add/remove hierarchical relationship failed.
*
- * @param child contains {@link org.apache.directory.fortress.core.rbac.OrgUnit#name} of child.
- * @param parent contains {@link org.apache.directory.fortress.core.rbac.OrgUnit#name} of parent.
+ * @param child contains {@link org.apache.directory.fortress.core.model.OrgUnit#name} of child.
+ * @param parent contains {@link org.apache.directory.fortress.core.model.OrgUnit#name} of parent.
* @param mustExist boolean is used to specify if relationship must be true.
* @throws org.apache.directory.fortress.core.ValidationException
* in the event it fails one of the 3 checks.
@@ -202,7 +205,7 @@ public final class UsoUtil
*
* @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
* @param relationship contains parent-child relationship targeted for addition.
- * @param op used to pass the ldap op {@link org.apache.directory.fortress.core.rbac.Hier.Op#ADD}, {@link org.apache.directory.fortress.core.rbac.Hier.Op#MOD}, {@link org.apache.directory.fortress.core.rbac.Hier.Op#REM}
+ * @param op used to pass the ldap op {@link org.apache.directory.fortress.core.model.Hier.Op#ADD}, {@link org.apache.directory.fortress.core.model.Hier.Op#MOD}, {@link org.apache.directory.fortress.core.model.Hier.Op#REM}
* @throws org.apache.directory.fortress.core.SecurityException in the event of a system error.
*/
static void updateHier( String contextId, Relationship relationship, Hier.Op op ) throws SecurityException
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/0c46e4de/src/main/java/org/apache/directory/fortress/core/rbac/Warning.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/Warning.java b/src/main/java/org/apache/directory/fortress/core/rbac/Warning.java
index 18d52b0..94123a9 100644
--- a/src/main/java/org/apache/directory/fortress/core/rbac/Warning.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/Warning.java
@@ -35,7 +35,7 @@ import java.io.Serializable;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
/**
- * This entity is stored on {@link org.apache.directory.fortress.core.rbac.Session} and is used to pass warnings
+ * This entity is stored on {@link org.apache.directory.fortress.core.model.Session} and is used to pass warnings
* that occur during role activation and password policy validation.
* <p/>
* Contains data from event that occurs during session initialization:
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/0c46e4de/src/main/java/org/apache/directory/fortress/core/rbac/package.html
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/package.html b/src/main/java/org/apache/directory/fortress/core/rbac/package.html
index 70488a4..91cfc15 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/package.html
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/package.html
@@ -33,7 +33,7 @@
<p>
The <b>org.apache.directory.fortress.core.rbac</b> package data entities may be manipulated by outside
programs but the apis contained within this package are for fortress use only.
- The entities include {@link org.apache.directory.fortress.core.rbac.User User},{@link org.apache.directory.fortress.core.rbac.Role Role}, {@link org.apache.directory.fortress.core.rbac.PermObj PermObj}, {@link org.apache.directory.fortress.core.rbac.Permission Permission}, and more.
+ The entities include {@link org.apache.directory.fortress.core.model.User User},{@link org.apache.directory.fortress.core.model.Role Role}, {@link org.apache.directory.fortress.core.model.PermObj PermObj}, {@link org.apache.directory.fortress.core.model.Permission Permission}, and more.
See the corresponding javadoc contained with this package for more info.
</p>
<h3>Fortress Manager APIs implemented in this package</h3>
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/0c46e4de/src/main/java/org/apache/directory/fortress/core/rest/AccessMgrRestImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rest/AccessMgrRestImpl.java b/src/main/java/org/apache/directory/fortress/core/rest/AccessMgrRestImpl.java
index 4f15e57..258f91a 100644
--- a/src/main/java/org/apache/directory/fortress/core/rest/AccessMgrRestImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/rest/AccessMgrRestImpl.java
@@ -24,10 +24,10 @@ import org.apache.directory.fortress.core.GlobalErrIds;
import org.apache.directory.fortress.core.SecurityException;
import org.apache.directory.fortress.core.rbac.AccessMgrImpl;
import org.apache.directory.fortress.core.rbac.Manageable;
-import org.apache.directory.fortress.core.rbac.Permission;
-import org.apache.directory.fortress.core.rbac.Session;
-import org.apache.directory.fortress.core.rbac.User;
-import org.apache.directory.fortress.core.rbac.UserRole;
+import org.apache.directory.fortress.core.model.Permission;
+import org.apache.directory.fortress.core.model.Session;
+import org.apache.directory.fortress.core.model.User;
+import org.apache.directory.fortress.core.model.UserRole;
import org.apache.directory.fortress.core.util.attr.VUtil;
import java.util.List;
@@ -115,13 +115,13 @@ public class AccessMgrRestImpl extends Manageable implements AccessMgr
* This method must be called once per user prior to calling other methods within this class.
* The successful result is {@link Session} that contains target user's RBAC {@link User#roles} and Admin role {@link User#adminRoles}.<br />
* In addition to checking user password validity it will apply configured password policy checks {@link User#pwPolicy}..<br />
- * Method may also store parms passed in for audit trail {@link org.apache.directory.fortress.core.rbac.FortEntity}.
+ * Method may also store parms passed in for audit trail {@link org.apache.directory.fortress.core.model.FortEntity}.
* <h4> This API will...</h4>
* <ul>
* <li> authenticate user password if trusted == false.
* <li> perform <a href="http://www.openldap.org/">OpenLDAP</a> <a href="http://tools.ietf.org/html/draft-behera-ldap-password-policy-10">password policy evaluation</a>.
* <li> fail for any user who is locked by OpenLDAP's policies {@link User#isLocked()}, regardless of trusted flag being set as parm on API.
- * <li> evaluate temporal {@link org.apache.directory.fortress.core.util.time.Constraint}(s) on {@link User}, {@link UserRole} and {@link org.apache.directory.fortress.core.rbac.UserAdminRole} entities.
+ * <li> evaluate temporal {@link org.apache.directory.fortress.core.util.time.Constraint}(s) on {@link User}, {@link UserRole} and {@link org.apache.directory.fortress.core.model.UserAdminRole} entities.
* <li> process selective role activations into User RBAC Session {@link User#roles}.
* <li> check Dynamic Separation of Duties {@link org.apache.directory.fortress.core.rbac.DSDChecker#validate(Session, org.apache.directory.fortress.core.util.time.Constraint, org.apache.directory.fortress.core.util.time.Time)} on {@link User#roles}.
* <li> process selective administrative role activations {@link User#adminRoles}.