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/01/27 13:54:30 UTC
[03/23] directory-fortress-core git commit: FC-40 - Use the LDAP API
constants instead of GlobalIDs constants when possible
FC-40 - Use the LDAP API constants instead of GlobalIDs constants when possible
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/04f0a1a2
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/04f0a1a2
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/04f0a1a2
Branch: refs/heads/master
Commit: 04f0a1a26e14e90bd51dbd9e760a104a5f2c9dd1
Parents: dcfed51
Author: Shawn McKinney <sm...@apache.org>
Authored: Sun Dec 21 11:03:13 2014 -0600
Committer: Shawn McKinney <sm...@apache.org>
Committed: Sun Dec 21 11:03:13 2014 -0600
----------------------------------------------------------------------
.../directory/fortress/core/GlobalIds.java | 44 +-----
.../ldap/container/OrganizatiionalUnitDAO.java | 2 +-
.../fortress/core/ldap/group/GroupDAO.java | 8 +-
.../fortress/core/ldap/suffix/SuffixDAO.java | 2 +-
.../fortress/core/rbac/AdminRoleDAO.java | 8 +-
.../fortress/core/rbac/OrgUnitDAO.java | 8 +-
.../directory/fortress/core/rbac/PermDAO.java | 16 +-
.../directory/fortress/core/rbac/RoleDAO.java | 8 +-
.../directory/fortress/core/rbac/SdDAO.java | 8 +-
.../directory/fortress/core/rbac/UserDAO.java | 157 +++++++------------
.../fortress/core/example/ExampleDAO.java | 8 +-
11 files changed, 91 insertions(+), 178 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/04f0a1a2/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/GlobalIds.java b/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
index d4a02c8..32758ab 100755
--- a/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
+++ b/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
@@ -213,33 +213,13 @@ public class GlobalIds
*/
/**
- * Constant contains the organization object class name.
- */
- public final static String ORGANIZATION_CLASS = "organization";
-
- /**
- * Constant contains the ldap distinguished name attribute.
- */
- public final static String DN = "dn";
-
- /**
- * Used within search operation using the OpenLDAP proxy control.
- */
- public final static String UTF8 = "UTF-8";
-
- /**
- * Constant contains the description attribute name used within inetOrgPerson and other ldap object classes.
- */
- public final static String DESC = "description";
-
- /**
* Password policy object class structure uses cn attribute name.
*/
public final static String POLICY_NODE_TYPE = SchemaConstants.CN_AT;
/*
* *************************************************************************
- * ** OPENLDAP PW POLICY ATTRIBUTES AND CONSTANTS
+ * ** OPENLDAP ATTRIBUTES AND CONSTANTS
* ************************************************************************
*/
@@ -247,26 +227,6 @@ public class GlobalIds
public static final boolean IS_OPENLDAP = ( ( Config.getProperty( SERVER_TYPE ) != null ) && ( Config
.getProperty( SERVER_TYPE ).equalsIgnoreCase( "openldap" ) ) );
- /**
- * OpenLDAP uses this object class to store policy definitions that are processed by the pw policy overlay.
- */
- //private final static String OPENLDAP_PW_POLICY_IMPL = "password.policy";
-
- /**
- * When openldap password policy is in effect the openldap pw policy response control is interrogated subsequent to bind operations.
- */
- //private final static String OPENLDAP_SERVER = "openldap";
-
- /**
- * When set to true the pw policy control is interrogated.
- */
- //public final static boolean OPENLDAP_IS_PW_POLICY_ENABLED = (org.apache.directory.fortress.cfg.Config.getProperty(GlobalIds.OPENLDAP_PW_POLICY_IMPL) != null && (Config.getProperty(GlobalIds.OPENLDAP_PW_POLICY_IMPL)).equalsIgnoreCase(GlobalIds.OPENLDAP_SERVER));
-
- /**
- * This is control id openldap uses to communicate password messages to the ldap client subsequent to bind operations:
- */
- public final static String OPENLDAP_PW_RESPONSE_CONTROL = "1.3.6.1.4.1.42.2.27.8.5.1";
-
/*
* *************************************************************************
* ** OpenAccessMgr AUDIT
@@ -306,7 +266,7 @@ public class GlobalIds
/**
* This string literal contains a common start for most ldap search filters that fortress uses.
*/
- public final static String FILTER_PREFIX = "(&(objectclass=";
+ public final static String FILTER_PREFIX = "(&(" + SchemaConstants.OBJECT_CLASS_AT + "=";
/*
* *************************************************************************
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/04f0a1a2/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizatiionalUnitDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizatiionalUnitDAO.java b/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizatiionalUnitDAO.java
index 3af7cd5..b25699d 100644
--- a/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizatiionalUnitDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizatiionalUnitDAO.java
@@ -113,7 +113,7 @@ final class OrganizationalUnitDAO extends ApacheDsDataProvider
Entry myEntry = new DefaultEntry( nodeDn,
SchemaConstants.OBJECT_CLASS, ORGUNIT_CLASS,
SchemaConstants.OU_AT, oe.getName(),
- GlobalIds.DESC, oe.getDescription() );
+ SchemaConstants.DESCRIPTION_AT, oe.getDescription() );
ld = getAdminConnection();
add( ld, myEntry );
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/04f0a1a2/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 48eb26f..3d681a8 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
@@ -69,7 +69,7 @@ final class GroupDAO extends ApacheDsDataProvider
private static final String GROUP_PROPERTY_ATTR = "group.properties";
private static final String GROUP_PROPERTY_ATTR_IMPL = Config.getProperty( GROUP_PROPERTY_ATTR );
private static final String GROUP_OBJ_CLASS[] = {SchemaConstants.TOP_OC, GROUP_OBJECT_CLASS_IMPL};
- private static final String[] GROUP_ATRS = {SchemaConstants.CN_AT, GlobalIds.DESC, GROUP_PROTOCOL_ATTR_IMPL, GROUP_PROPERTY_ATTR_IMPL, SchemaConstants.MEMBER_AT};
+ private static final String[] GROUP_ATRS = {SchemaConstants.CN_AT, SchemaConstants.DESCRIPTION_AT, GROUP_PROTOCOL_ATTR_IMPL, GROUP_PROPERTY_ATTR_IMPL, SchemaConstants.MEMBER_AT};
/**
* Package private default constructor.
@@ -100,7 +100,7 @@ final class GroupDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( group.getDescription() ) )
{
- myEntry.add( GlobalIds.DESC, group.getDescription() );
+ myEntry.add( SchemaConstants.DESCRIPTION_AT, group.getDescription() );
}
ld = getAdminConnection();
@@ -139,7 +139,7 @@ final class GroupDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( group.getDescription() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, GlobalIds.DESC, group.getDescription() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.DESCRIPTION_AT, group.getDescription() ) );
}
if ( VUtil.isNotNullOrEmpty( group.getProtocol() ) )
@@ -471,7 +471,7 @@ final class GroupDAO extends ApacheDsDataProvider
{
Group entity = new ObjectFactory().createGroup();
entity.setName( getAttribute( le, SchemaConstants.CN_AT ) );
- entity.setDescription( getAttribute( le, GlobalIds.DESC ) );
+ entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
entity.setProtocol( getAttribute( le, GROUP_PROTOCOL_ATTR_IMPL ) );
entity.setMembers( getAttributes( le, SchemaConstants.MEMBER_AT ) );
entity.setMemberDn( true );
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/04f0a1a2/src/main/java/org/apache/directory/fortress/core/ldap/suffix/SuffixDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/suffix/SuffixDAO.java b/src/main/java/org/apache/directory/fortress/core/ldap/suffix/SuffixDAO.java
index 130eb50..3cc656f 100644
--- a/src/main/java/org/apache/directory/fortress/core/ldap/suffix/SuffixDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/suffix/SuffixDAO.java
@@ -71,7 +71,7 @@ final class SuffixDAO extends ApacheDsDataProvider
private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
private static final String[] SUFFIX_OBJ_CLASS =
{
- SchemaConstants.DC_OBJECT_OC, GlobalIds.ORGANIZATION_CLASS
+ SchemaConstants.DC_OBJECT_OC, SchemaConstants.ORGANIZATION_OC
};
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/04f0a1a2/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 4a3ec00..682343c 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
@@ -133,7 +133,7 @@ final class AdminRoleDAO extends ApacheDsDataProvider
{
GlobalIds.FT_IID,
ROLE_NM,
- GlobalIds.DESC,
+ SchemaConstants.DESCRIPTION_AT,
GlobalIds.CONSTRAINT,
ROLE_OCCUPANT,
ROLE_OSP,
@@ -168,7 +168,7 @@ final class AdminRoleDAO extends ApacheDsDataProvider
// description field is optional on this object class:
if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
{
- entry.add( GlobalIds.DESC, entity.getDescription() );
+ entry.add( SchemaConstants.DESCRIPTION_AT, entity.getDescription() );
}
// CN attribute is required for this object class:
@@ -224,7 +224,7 @@ final class AdminRoleDAO extends ApacheDsDataProvider
{
mods.add( new DefaultModification(
ModificationOperation.REPLACE_ATTRIBUTE,
- GlobalIds.DESC, entity.getDescription() ) );
+ SchemaConstants.DESCRIPTION_AT, entity.getDescription() ) );
}
if ( VUtil.isNotNullOrEmpty( entity.getOccupants() ) )
@@ -675,7 +675,7 @@ final class AdminRoleDAO extends ApacheDsDataProvider
entity.setSequenceId( sequence );
entity.setId( getAttribute( le, GlobalIds.FT_IID ) );
entity.setName( getAttribute( le, ROLE_NM ) );
- entity.setDescription( getAttribute( le, GlobalIds.DESC ) );
+ entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
entity.setOccupants( getAttributes( le, ROLE_OCCUPANT ) );
entity.setOsP( getAttributeSet( le, ROLE_OSP ) );
entity.setOsU( getAttributeSet( le, ROLE_OSU ) );
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/04f0a1a2/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 d758b99..1843448 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
@@ -113,7 +113,7 @@ final class OrgUnitDAO extends ApacheDsDataProvider
};
private static final String[] ORGUNIT_ATRS =
{
- GlobalIds.FT_IID, SchemaConstants.OU_AT, GlobalIds.DESC, GlobalIds.PARENT_NODES
+ GlobalIds.FT_IID, SchemaConstants.OU_AT, SchemaConstants.DESCRIPTION_AT, GlobalIds.PARENT_NODES
};
private static final String[] ORGUNIT_ATR =
@@ -144,7 +144,7 @@ final class OrgUnitDAO extends ApacheDsDataProvider
if ( !Strings.isEmpty( description ) )
{
- entry.add( GlobalIds.DESC, description );
+ entry.add( SchemaConstants.DESCRIPTION_AT, description );
}
// organizational name requires OU attribute:
@@ -201,7 +201,7 @@ final class OrgUnitDAO extends ApacheDsDataProvider
if ( entity.getDescription() != null && entity.getDescription().length() > 0 )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, GlobalIds.DESC, entity.getDescription() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.DESCRIPTION_AT, entity.getDescription() ) );
}
loadAttrs( entity.getParents(), mods, GlobalIds.PARENT_NODES );
@@ -695,7 +695,7 @@ final class OrgUnitDAO extends ApacheDsDataProvider
entity.setSequenceId( sequence );
entity.setId( getAttribute( le, GlobalIds.FT_IID ) );
entity.setName( getAttribute( le, SchemaConstants.OU_AT ) );
- entity.setDescription( getAttribute( le, GlobalIds.DESC ) );
+ entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
String dn = le.getDn().getName();
if ( dn.contains( getRootDn( contextId, GlobalIds.PSU_ROOT ) ) )
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/04f0a1a2/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 b5a41ab..cd55062 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
@@ -177,13 +177,13 @@ final class PermDAO extends ApacheDsDataProvider
private static final String USERS = "ftUsers";
private static final String[] PERMISSION_OP_ATRS =
{
- GlobalIds.FT_IID, PERM_NAME, GlobalIds.POBJ_NAME, GlobalIds.POP_NAME, GlobalIds.DESC, SchemaConstants.OU_AT,
+ GlobalIds.FT_IID, PERM_NAME, GlobalIds.POBJ_NAME, GlobalIds.POP_NAME, SchemaConstants.DESCRIPTION_AT, SchemaConstants.OU_AT,
GlobalIds.POBJ_ID, TYPE, ROLES, USERS, GlobalIds.PROPS
};
private static final String[] PERMISION_OBJ_ATRS =
{
- GlobalIds.FT_IID, GlobalIds.POBJ_NAME, GlobalIds.DESC, SchemaConstants.OU_AT, TYPE,
+ GlobalIds.FT_IID, GlobalIds.POBJ_NAME, SchemaConstants.DESCRIPTION_AT, SchemaConstants.OU_AT, TYPE,
GlobalIds.PROPS
};
@@ -217,7 +217,7 @@ final class PermDAO extends ApacheDsDataProvider
// description is optional:
if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
{
- entry.add( GlobalIds.DESC, entity.getDescription() );
+ entry.add( SchemaConstants.DESCRIPTION_AT, entity.getDescription() );
}
// type is optional:
@@ -278,7 +278,7 @@ final class PermDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, GlobalIds.DESC, entity.getDescription() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.DESCRIPTION_AT, entity.getDescription() ) );
}
if ( VUtil.isNotNullOrEmpty( entity.getType() ) )
@@ -377,7 +377,7 @@ final class PermDAO extends ApacheDsDataProvider
// description is optional:
if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
{
- entry.add( GlobalIds.DESC, entity.getDescription() );
+ entry.add( SchemaConstants.DESCRIPTION_AT, entity.getDescription() );
}
// the abstract name is the human readable identifier:
@@ -456,7 +456,7 @@ final class PermDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, GlobalIds.DESC, entity.getDescription() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.DESCRIPTION_AT, entity.getDescription() ) );
}
if ( VUtil.isNotNullOrEmpty( entity.getType() ) )
@@ -1008,7 +1008,7 @@ final class PermDAO extends ApacheDsDataProvider
entity.setRoles( getAttributeSet( le, ROLES ) );
entity.setUsers( getAttributeSet( le, USERS ) );
entity.setType( getAttribute( le, TYPE ) );
- entity.setDescription( getAttribute( le, GlobalIds.DESC ) );
+ entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
entity.addProperties( AttrHelper.getProperties( getAttributes( le, GlobalIds.PROPS ) ) );
entity.setAdmin( isAdmin );
@@ -1037,7 +1037,7 @@ final class PermDAO extends ApacheDsDataProvider
entity.setDn( le.getDn().getName() );
entity.setInternalId( getAttribute( le, GlobalIds.FT_IID ) );
entity.setType( getAttribute( le, TYPE ) );
- entity.setDescription( getAttribute( le, GlobalIds.DESC ) );
+ entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
entity.addProperties( AttrHelper.getProperties( getAttributes( le, GlobalIds.PROPS ) ) );
entity.setAdmin( isAdmin );
return entity;
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/04f0a1a2/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 966177a..e5ed548 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
@@ -113,7 +113,7 @@ final class RoleDAO extends ApacheDsDataProvider
private static final String[] ROLE_ATRS =
{
- GlobalIds.FT_IID, ROLE_NM, GlobalIds.DESC, GlobalIds.CONSTRAINT, ROLE_OCCUPANT, GlobalIds.PARENT_NODES
+ GlobalIds.FT_IID, ROLE_NM, SchemaConstants.DESCRIPTION_AT, GlobalIds.CONSTRAINT, ROLE_OCCUPANT, GlobalIds.PARENT_NODES
};
@@ -138,7 +138,7 @@ final class RoleDAO extends ApacheDsDataProvider
// description field is optional on this object class:
if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
{
- entry.add( GlobalIds.DESC, entity.getDescription() );
+ entry.add( SchemaConstants.DESCRIPTION_AT, entity.getDescription() );
}
// CN attribute is required for this object class:
@@ -183,7 +183,7 @@ final class RoleDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
{
mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
- GlobalIds.DESC, entity.getDescription() ) );
+ SchemaConstants.DESCRIPTION_AT, entity.getDescription() ) );
}
if ( VUtil.isNotNullOrEmpty( entity.getOccupants() ) )
@@ -639,7 +639,7 @@ final class RoleDAO extends ApacheDsDataProvider
entity.setSequenceId( sequence );
entity.setId( getAttribute( le, GlobalIds.FT_IID ) );
entity.setName( getAttribute( le, ROLE_NM ) );
- entity.setDescription( getAttribute( le, GlobalIds.DESC ) );
+ entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
entity.setOccupants( getAttributes( le, ROLE_OCCUPANT ) );
//entity.setParents(RoleUtil.getParents(entity.getName().toUpperCase(), contextId));
entity.setChildren( RoleUtil.getChildren( entity.getName().toUpperCase(), contextId ) );
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/04f0a1a2/src/main/java/org/apache/directory/fortress/core/rbac/SdDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/SdDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/SdDAO.java
index 89f2674..734d582 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/SdDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/SdDAO.java
@@ -135,7 +135,7 @@ final class SdDAO extends ApacheDsDataProvider
private static final String[] SD_SET_ATRS =
{
- GlobalIds.FT_IID, SD_SET_NM, GlobalIds.DESC, ROLES, SD_SET_CARDINALITY
+ GlobalIds.FT_IID, SD_SET_NM, SchemaConstants.DESCRIPTION_AT, ROLES, SD_SET_CARDINALITY
};
@@ -166,7 +166,7 @@ final class SdDAO extends ApacheDsDataProvider
// description field is optional on this object class:
if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
{
- entry.add( GlobalIds.DESC, entity.getDescription() );
+ entry.add( SchemaConstants.DESCRIPTION_AT, entity.getDescription() );
}
// CN attribute is required for this object class:
@@ -218,7 +218,7 @@ final class SdDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, GlobalIds.DESC, entity.getDescription() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.DESCRIPTION_AT, entity.getDescription() ) );
}
if ( entity.getCardinality() != null )
@@ -611,7 +611,7 @@ final class SdDAO extends ApacheDsDataProvider
entity.setSequenceId( sequence );
entity.setId( getAttribute( le, GlobalIds.FT_IID ) );
entity.setName( getAttribute( le, SD_SET_NM ) );
- entity.setDescription( getAttribute( le, GlobalIds.DESC ) );
+ entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
entity.setMembers( getAttributeSet( le, ROLES ) );
String szCard = getAttribute( le, SD_SET_CARDINALITY );
entity.setCardinality( new Integer( szCard ) );
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/04f0a1a2/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 ad415c0..b7458ec 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
@@ -137,7 +137,6 @@ final class UserDAO extends ApacheDsDataProvider
{
private static final String CLS_NM = UserDAO.class.getName();
private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
- private static PwPolicyControl pwControlx;
/*
* *************************************************************************
@@ -145,7 +144,6 @@ final class UserDAO extends ApacheDsDataProvider
* ************************************************************************
*/
private static final String USERS_AUX_OBJECT_CLASS_NAME = "ftUserAttrs";
- private static final String ORGANIZATIONAL_PERSON_OBJECT_CLASS_NAME = "organizationalPerson";
private static final String USER_OBJECT_CLASS = "user.objectclass";
private static final String USERS_EXTENSIBLE_OBJECT = "extensibleObject";
//private static final String POSIX_ACCOUNT_OBJECT_CLASS_NAME = "posixAccount";
@@ -163,46 +161,9 @@ final class UserDAO extends ApacheDsDataProvider
};
private static final String objectClassImpl = Config.getProperty( USER_OBJECT_CLASS );
- private static final String SN = "sn";
- private static final String PW = "userpassword";
private static final String SYSTEM_USER = "ftSystem";
/**
- * Constant contains the locale attribute name used within organizationalPerson ldap object classes.
- */
- private static final String L = "l";
-
- /**
- * Constant contains the postal address attribute name used within organizationalPerson ldap object classes.
- */
- private static final String POSTAL_ADDRESS = "postalAddress";
-
- /**
- * Constant contains the state attribute name used within organizationalPerson ldap object classes.
- */
- private static final String STATE = "st";
-
- /**
- * Constant contains the postal code attribute name used within organizationalPerson ldap object classes.
- */
- private static final String POSTAL_CODE = "postalCode";
-
- /**
- * Constant contains the post office box attribute name used within organizationalPerson ldap object classes.
- */
- private static final String POST_OFFICE_BOX = "postOfficeBox";
-
- /**
- * Constant contains the country attribute name used within organizationalPerson ldap object classes.
- */
- private static final String COUNTRY = "c";
-
- /**
- * Constant contains the attribute name used within inetorgperson ldap object classes.
- */
- private static final String PHYSICAL_DELIVERY_OFFICE_NAME = "physicalDeliveryOfficeName";
-
- /**
* Constant contains the attribute name used within inetorgperson ldap object classes.
*/
private static final String DEPARTMENT_NUMBER = "departmentNumber";
@@ -218,21 +179,13 @@ final class UserDAO extends ApacheDsDataProvider
private static final String MOBILE = "mobile";
/**
- * Constant contains the telephone attribute values used within organizationalPerson ldap object classes.
- */
- private static final String TELEPHONE_NUMBER = "telephoneNumber";
-
- /**
* Constant contains the attribute name for jpeg images to be stored within inetorgperson ldap object classes.
*/
private static final String JPEGPHOTO = "jpegPhoto";
/**
- * Constant contains the email attribute values used within iNetOrgPerson ldap object classes.
+ * Constant contains the employeeType attribute within iNetOrgPerson ldap object classes.
*/
- private static final String MAIL = "mail";
- private static final String DISPLAY_NAME = "displayName";
- private static final String TITLE = "title";
private static final String EMPLOYEE_TYPE = "employeeType";
// RFC2307bis:
@@ -261,11 +214,11 @@ final class UserDAO extends ApacheDsDataProvider
private static final String[] AUTHN_ATRS =
{
GlobalIds.FT_IID,
- SchemaConstants.UID_AT, PW,
- GlobalIds.DESC,
+ SchemaConstants.UID_AT, SchemaConstants.USER_PASSWORD_AT,
+ SchemaConstants.DESCRIPTION_AT,
SchemaConstants.OU_AT,
SchemaConstants.CN_AT,
- SN,
+ SchemaConstants.SN_AT,
GlobalIds.CONSTRAINT,
GlobalIds.IS_OPENLDAP ? OPENLDAP_PW_RESET : null,
GlobalIds.IS_OPENLDAP ? OPENLDAP_PW_LOCKED_TIME : null,
@@ -276,11 +229,11 @@ final class UserDAO extends ApacheDsDataProvider
private static final String[] DEFAULT_ATRS =
{
GlobalIds.FT_IID,
- SchemaConstants.UID_AT, PW,
- GlobalIds.DESC,
+ SchemaConstants.UID_AT, SchemaConstants.USER_PASSWORD_AT,
+ SchemaConstants.DESCRIPTION_AT,
SchemaConstants.OU_AT,
SchemaConstants.CN_AT,
- SN,
+ SchemaConstants.SN_AT,
GlobalIds.USER_ROLE_DATA,
GlobalIds.CONSTRAINT,
GlobalIds.USER_ROLE_ASSIGN,
@@ -290,19 +243,19 @@ final class UserDAO extends ApacheDsDataProvider
GlobalIds.PROPS,
GlobalIds.USER_ADMINROLE_ASSIGN,
GlobalIds.USER_ADMINROLE_DATA,
- POSTAL_ADDRESS,
- L,
- POSTAL_CODE,
- POST_OFFICE_BOX,
- STATE,
- PHYSICAL_DELIVERY_OFFICE_NAME,
+ SchemaConstants.POSTAL_ADDRESS_AT,
+ SchemaConstants.L_AT,
+ SchemaConstants.POSTALCODE_AT,
+ SchemaConstants.POSTOFFICEBOX_AT,
+ SchemaConstants.ST_AT,
+ SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT,
DEPARTMENT_NUMBER,
ROOM_NUMBER,
- TELEPHONE_NUMBER,
+ SchemaConstants.TELEPHONE_NUMBER_AT,
MOBILE,
- MAIL,
+ SchemaConstants.MAIL_AT,
EMPLOYEE_TYPE,
- TITLE,
+ SchemaConstants.TITLE_AT,
SYSTEM_USER,
JPEGPHOTO,
@@ -363,18 +316,18 @@ final class UserDAO extends ApacheDsDataProvider
entity.setSn( entity.getUserId() );
}
- myEntry.add( SN, entity.getSn() );
+ myEntry.add( SchemaConstants.SN_AT, entity.getSn() );
// guard against npe
- myEntry.add( PW,
+ myEntry.add( SchemaConstants.USER_PASSWORD_AT,
VUtil.isNotNullOrEmpty( entity.getPassword() ) ? new String( entity.getPassword() ) : new String(
new char[]
{} ) );
- myEntry.add( DISPLAY_NAME, entity.getCn() );
+ myEntry.add( SchemaConstants.DISPLAY_NAME_AT, entity.getCn() );
if ( VUtil.isNotNullOrEmpty( entity.getTitle() ) )
{
- myEntry.add( TITLE, entity.getTitle() );
+ myEntry.add( SchemaConstants.TITLE_AT, entity.getTitle() );
}
if ( VUtil.isNotNullOrEmpty( entity.getEmployeeType() ) )
@@ -412,9 +365,9 @@ final class UserDAO extends ApacheDsDataProvider
// These are multi-valued attributes, use the util function to load.
// These items are optional. The utility function will return quietly if item list is empty:
- loadAttrs( entity.getPhones(), myEntry, TELEPHONE_NUMBER );
+ loadAttrs( entity.getPhones(), myEntry, SchemaConstants.TELEPHONE_NUMBER_AT );
loadAttrs( entity.getMobiles(), myEntry, MOBILE );
- loadAttrs( entity.getEmails(), myEntry, MAIL );
+ loadAttrs( entity.getEmails(), myEntry, SchemaConstants.MAIL_AT );
// The following attributes are optional:
if ( VUtil.isNotNullOrEmpty( entity.isSystem() ) )
@@ -436,7 +389,7 @@ final class UserDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
{
- myEntry.add( GlobalIds.DESC, entity.getDescription() );
+ myEntry.add( SchemaConstants.DESCRIPTION_AT, entity.getDescription() );
}
// props are optional as well:
@@ -496,7 +449,7 @@ final class UserDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( entity.getSn() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, SN, entity.getSn() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.SN_AT, entity.getSn() ) );
}
if ( VUtil.isNotNullOrEmpty( entity.getOu() ) )
@@ -508,13 +461,13 @@ final class UserDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( entity.getPassword() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, PW, new String( entity.getPassword() ) ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.USER_PASSWORD_AT, new String( entity.getPassword() ) ) );
}
if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, GlobalIds.DESC, entity.getDescription() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.DESCRIPTION_AT, entity.getDescription() ) );
}
if ( VUtil.isNotNullOrEmpty( entity.getEmployeeType() ) )
@@ -526,7 +479,7 @@ final class UserDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( entity.getTitle() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, TITLE, entity.getTitle() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.TITLE_AT, entity.getTitle() ) );
}
if ( GlobalIds.IS_OPENLDAP && VUtil.isNotNullOrEmpty( entity.getPwPolicy() ) )
@@ -564,9 +517,9 @@ final class UserDAO extends ApacheDsDataProvider
loadAddress( entity.getAddress(), mods );
// These are multi-valued attributes, use the util function to load:
- loadAttrs( entity.getPhones(), mods, TELEPHONE_NUMBER );
+ loadAttrs( entity.getPhones(), mods, SchemaConstants.TELEPHONE_NUMBER_AT );
loadAttrs( entity.getMobiles(), mods, MOBILE );
- loadAttrs( entity.getEmails(), mods, MAIL );
+ loadAttrs( entity.getEmails(), mods, SchemaConstants.MAIL_AT );
if ( VUtil.isNotNullOrEmpty( entity.getJpegPhoto() ) )
{
@@ -1577,7 +1530,7 @@ final class UserDAO extends ApacheDsDataProvider
mods = new ArrayList<Modification>();
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, PW, new String( newPassword ) ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.USER_PASSWORD_AT, new String( newPassword ) ) );
modify( ld, userDn, mods );
@@ -1636,7 +1589,7 @@ final class UserDAO extends ApacheDsDataProvider
List<Modification> mods = new ArrayList<Modification>();
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, PW, new String( user.getPassword() ) ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.USER_PASSWORD_AT, new String( user.getPassword() ) ) );
mods.add( new DefaultModification(
ModificationOperation.REPLACE_ATTRIBUTE, OPENLDAP_PW_RESET, "TRUE" ) );
@@ -1942,22 +1895,22 @@ final class UserDAO extends ApacheDsDataProvider
User entity = new ObjectFactory().createUser();
entity.setSequenceId( sequence );
entity.setInternalId( getAttribute( entry, GlobalIds.FT_IID ) );
- entity.setDescription( getAttribute( entry, GlobalIds.DESC ) );
+ entity.setDescription( getAttribute( entry, SchemaConstants.DESCRIPTION_AT ) );
entity.setUserId( getAttribute( entry, SchemaConstants.UID_AT ) );
entity.setCn( getAttribute( entry, SchemaConstants.CN_AT ) );
entity.setName( entity.getCn() );
- entity.setSn( getAttribute( entry, SN ) );
+ entity.setSn( getAttribute( entry, SchemaConstants.SN_AT ) );
entity.setOu( getAttribute( entry, SchemaConstants.OU_AT ) );
entity.setDn( entry.getDn().getName() );
- entity.setTitle( getAttribute( entry, TITLE ) );
+ entity.setTitle( getAttribute( entry, SchemaConstants.TITLE_AT ) );
entity.setEmployeeType( getAttribute( entry, EMPLOYEE_TYPE ) );
unloadTemporal( entry, entity );
entity.setRoles( unloadUserRoles( entry, entity.getUserId(), contextId ) );
entity.setAdminRoles( unloadUserAdminRoles( entry, entity.getUserId(), contextId ) );
entity.setAddress( unloadAddress( entry ) );
- entity.setPhones( getAttributes( entry, TELEPHONE_NUMBER ) );
+ entity.setPhones( getAttributes( entry, SchemaConstants.TELEPHONE_NUMBER_AT ) );
entity.setMobiles( getAttributes( entry, MOBILE ) );
- entity.setEmails( getAttributes( entry, MAIL ) );
+ entity.setEmails( getAttributes( entry, SchemaConstants.MAIL_AT ) );
String szBoolean = getAttribute( entry, SYSTEM_USER );
if ( szBoolean != null )
{
@@ -2181,13 +2134,13 @@ final class UserDAO extends ApacheDsDataProvider
{
for ( String val : address.getAddresses() )
{
- entry.add( POSTAL_ADDRESS, val );
+ entry.add( SchemaConstants.POSTAL_ADDRESS_AT, val );
}
}
if ( VUtil.isNotNullOrEmpty( address.getCity() ) )
{
- entry.add( L, address.getCity() );
+ entry.add( SchemaConstants.L_AT, address.getCity() );
}
//if(VUtil.isNotNullOrEmpty(address.getCountry()))
@@ -2197,22 +2150,22 @@ final class UserDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( address.getPostalCode() ) )
{
- entry.add( POSTAL_CODE, address.getPostalCode() );
+ entry.add( SchemaConstants.POSTALCODE_AT, address.getPostalCode() );
}
if ( VUtil.isNotNullOrEmpty( address.getPostOfficeBox() ) )
{
- entry.add( POST_OFFICE_BOX, address.getPostOfficeBox() );
+ entry.add( SchemaConstants.POSTOFFICEBOX_AT, address.getPostOfficeBox() );
}
if ( VUtil.isNotNullOrEmpty( address.getState() ) )
{
- entry.add( STATE, address.getState() );
+ entry.add( SchemaConstants.ST_AT, address.getState() );
}
if ( VUtil.isNotNullOrEmpty( address.getBuilding() ) )
{
- entry.add( PHYSICAL_DELIVERY_OFFICE_NAME, address.getBuilding() );
+ entry.add( SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT, address.getBuilding() );
}
if ( VUtil.isNotNullOrEmpty( address.getDepartmentNumber() ) )
@@ -2241,43 +2194,43 @@ final class UserDAO extends ApacheDsDataProvider
if ( VUtil.isNotNullOrEmpty( address.getAddresses() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, POSTAL_ADDRESS ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.POSTAL_ADDRESS_AT ) );
for ( String val : address.getAddresses() )
{
mods.add( new DefaultModification(
- ModificationOperation.ADD_ATTRIBUTE, POSTAL_ADDRESS, val ) );
+ ModificationOperation.ADD_ATTRIBUTE, SchemaConstants.POSTAL_ADDRESS_AT, val ) );
}
}
if ( VUtil.isNotNullOrEmpty( address.getCity() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, L, address.getCity() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.L_AT, address.getCity() ) );
}
if ( VUtil.isNotNullOrEmpty( address.getPostalCode() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, POSTAL_CODE, address.getPostalCode() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.POSTALCODE_AT, address.getPostalCode() ) );
}
if ( VUtil.isNotNullOrEmpty( address.getPostOfficeBox() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, POST_OFFICE_BOX, address.getPostOfficeBox() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.POSTOFFICEBOX_AT, address.getPostOfficeBox() ) );
}
if ( VUtil.isNotNullOrEmpty( address.getState() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, STATE, address.getState() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.ST_AT, address.getState() ) );
}
if ( VUtil.isNotNullOrEmpty( address.getBuilding() ) )
{
mods.add( new DefaultModification(
- ModificationOperation.REPLACE_ATTRIBUTE, PHYSICAL_DELIVERY_OFFICE_NAME, address.getBuilding() ) );
+ ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT, address.getBuilding() ) );
}
if ( VUtil.isNotNullOrEmpty( address.getDepartmentNumber() ) )
@@ -2306,7 +2259,7 @@ final class UserDAO extends ApacheDsDataProvider
private Address unloadAddress( Entry entry ) throws LdapInvalidAttributeValueException
{
Address addr = new ObjectFactory().createAddress();
- List<String> pAddrs = getAttributes( entry, POSTAL_ADDRESS );
+ List<String> pAddrs = getAttributes( entry, SchemaConstants.POSTAL_ADDRESS_AT );
if ( pAddrs != null )
{
@@ -2316,11 +2269,11 @@ final class UserDAO extends ApacheDsDataProvider
}
}
- addr.setCity( getAttribute( entry, L ) );
- addr.setState( getAttribute( entry, STATE ) );
- addr.setPostalCode( getAttribute( entry, POSTAL_CODE ) );
- addr.setPostOfficeBox( getAttribute( entry, POST_OFFICE_BOX ) );
- addr.setBuilding( getAttribute( entry, PHYSICAL_DELIVERY_OFFICE_NAME ) );
+ addr.setCity( getAttribute( entry, SchemaConstants.L_AT ) );
+ addr.setState( getAttribute( entry, SchemaConstants.ST_AT ) );
+ addr.setPostalCode( getAttribute( entry, SchemaConstants.POSTALCODE_AT ) );
+ addr.setPostOfficeBox( getAttribute( entry, SchemaConstants.POSTOFFICEBOX_AT ) );
+ addr.setBuilding( getAttribute( entry, SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT ) );
addr.setDepartmentNumber( getAttribute( entry, DEPARTMENT_NUMBER ) );
addr.setRoomNumber( getAttribute( entry, ROOM_NUMBER ) );
// todo: add support for country attribute
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/04f0a1a2/src/test/java/org/apache/directory/fortress/core/example/ExampleDAO.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/example/ExampleDAO.java b/src/test/java/org/apache/directory/fortress/core/example/ExampleDAO.java
index 8f2967b..4f39377 100755
--- a/src/test/java/org/apache/directory/fortress/core/example/ExampleDAO.java
+++ b/src/test/java/org/apache/directory/fortress/core/example/ExampleDAO.java
@@ -53,7 +53,7 @@ public class ExampleDAO extends ApacheDsDataProvider
private static final String CLS_NM = ExampleDAO.class.getName();
private static final org.slf4j.Logger LOG = LoggerFactory.getLogger( CLS_NM );
protected final static String[] EXAMPLE_ATRS = {
- GlobalIds.FT_IID, EIds.EXAMPLE_NM, GlobalIds.DESC, GlobalIds.CONSTRAINT
+ GlobalIds.FT_IID, EIds.EXAMPLE_NM, SchemaConstants.DESCRIPTION_AT, GlobalIds.CONSTRAINT
};
/**
@@ -103,7 +103,7 @@ public class ExampleDAO extends ApacheDsDataProvider
entry.add( EIds.EXAMPLE_NM, entity.getName() );
if (entity.getDescription() != null && entity.getDescription().length() > 0)
- entry.add( GlobalIds.DESC, entity.getDescription() );
+ entry.add( SchemaConstants.DESCRIPTION_AT, entity.getDescription() );
// organizational name requires CN attribute:
entry.add( SchemaConstants.CN_AT, entity.getName() );
@@ -148,7 +148,7 @@ public class ExampleDAO extends ApacheDsDataProvider
List<Modification> mods = new ArrayList<Modification>();
if (entity.getDescription() != null && entity.getDescription().length() > 0)
{
- mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, GlobalIds.DESC, entity.getDescription() ) );
+ mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.DESCRIPTION_AT, entity.getDescription() ) );
}
@@ -314,7 +314,7 @@ public class ExampleDAO extends ApacheDsDataProvider
Example entity = new Example();
entity.setId( getAttribute( le, GlobalIds.FT_IID ) );
entity.setName(getAttribute(le, EIds.EXAMPLE_NM));
- entity.setDescription(getAttribute(le, GlobalIds.DESC));
+ entity.setDescription(getAttribute(le, SchemaConstants.DESCRIPTION_AT));
unloadTemporal(le, entity);
return entity;
}