Search in sources :

Example 1 with ObjectFactory

use of org.apache.directory.fortress.core.model.ObjectFactory in project directory-fortress-core by apache.

the class PermDAO method unloadPALdapEntry.

private PermissionAttribute unloadPALdapEntry(Entry le, long sequence) throws LdapInvalidAttributeValueException {
    PermissionAttribute entity = new ObjectFactory().createPermissionAttribute();
    entity.setSequenceId(sequence);
    entity.setAttributeName(getAttribute(le, SchemaConstants.CN_AT));
    entity.setDn(le.getDn().getName());
    entity.setInternalId(getAttribute(le, GlobalIds.FT_IID));
    entity.setDescription(getAttribute(le, SchemaConstants.DESCRIPTION_AT));
    entity.setDataType(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DATA_TYPE));
    entity.setDefaultOperator(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_OPERATOR));
    entity.setDefaultStrategy(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_STRATEGY));
    entity.setDefaultValue(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_VALUE));
    List<String> validValues = getAttributes(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_VALID_VALUES);
    if (validValues != null) {
        for (String value : validValues) {
            entity.getValidValues().add(value);
        }
    }
    return entity;
}
Also used : ObjectFactory(org.apache.directory.fortress.core.model.ObjectFactory) PermissionAttribute(org.apache.directory.fortress.core.model.PermissionAttribute)

Example 2 with ObjectFactory

use of org.apache.directory.fortress.core.model.ObjectFactory in project directory-fortress-core by apache.

the class PermDAO method unloadPobjLdapEntry.

/**
 * @param le
 * @param sequence
 * @return
 * @throws LdapInvalidAttributeValueException
 * @throws LdapException
 */
private PermObj unloadPobjLdapEntry(Entry le, long sequence, boolean isAdmin) throws LdapInvalidAttributeValueException {
    PermObj entity = new ObjectFactory().createPermObj();
    entity.setSequenceId(sequence);
    entity.setObjName(getAttribute(le, GlobalIds.POBJ_NAME));
    entity.setOu(getAttribute(le, SchemaConstants.OU_AT));
    entity.setDn(le.getDn().getName());
    entity.setInternalId(getAttribute(le, GlobalIds.FT_IID));
    entity.setType(getAttribute(le, GlobalIds.TYPE));
    entity.setDescription(getAttribute(le, SchemaConstants.DESCRIPTION_AT));
    entity.addProperties(PropUtil.getProperties(getAttributes(le, GlobalIds.PROPS)));
    entity.setAdmin(isAdmin);
    return entity;
}
Also used : PermObj(org.apache.directory.fortress.core.model.PermObj) ObjectFactory(org.apache.directory.fortress.core.model.ObjectFactory)

Example 3 with ObjectFactory

use of org.apache.directory.fortress.core.model.ObjectFactory in project directory-fortress-core by apache.

the class PolicyDAO method unloadLdapEntry.

/**
 * @param le
 * @param sequence
 * @return
 * @throws LdapInvalidAttributeValueException
 * @throws LdapException
 */
private PwPolicy unloadLdapEntry(Entry le, long sequence) throws LdapInvalidAttributeValueException {
    PwPolicy entity = new ObjectFactory().createPswdPolicy();
    entity.setSequenceId(sequence);
    entity.setName(getAttribute(le, PW_PWD_ID));
    String val;
    val = getAttribute(le, PW_MIN_AGE);
    if (StringUtils.isNotEmpty(val)) {
        entity.setMinAge(Integer.valueOf(val));
    }
    val = getAttribute(le, PW_MAX_AGE);
    if (StringUtils.isNotEmpty(val)) {
        entity.setMaxAge(Long.valueOf(val));
    }
    val = getAttribute(le, PW_IN_HISTORY);
    if (StringUtils.isNotEmpty(val)) {
        entity.setInHistory(Short.valueOf(val));
    }
    val = getAttribute(le, PW_CHECK_QUALITY);
    if (StringUtils.isNotEmpty(val)) {
        entity.setCheckQuality(Short.valueOf(val));
    }
    val = getAttribute(le, PW_MIN_LENGTH);
    if (StringUtils.isNotEmpty(val)) {
        entity.setMinLength(Short.valueOf(val));
    }
    val = getAttribute(le, PW_EXPIRE_WARNING);
    if (StringUtils.isNotEmpty(val)) {
        entity.setExpireWarning(Long.valueOf(val));
    }
    val = getAttribute(le, PW_GRACE_LOGIN_LIMIT);
    if (StringUtils.isNotEmpty(val)) {
        entity.setGraceLoginLimit(Short.valueOf(val));
    }
    val = getAttribute(le, PW_LOCKOUT);
    if (StringUtils.isNotEmpty(val)) {
        entity.setLockout(Boolean.valueOf(val));
    }
    val = getAttribute(le, PW_LOCKOUT_DURATION);
    if (StringUtils.isNotEmpty(val)) {
        entity.setLockoutDuration(Integer.valueOf(val));
    }
    val = getAttribute(le, PW_MAX_FAILURE);
    if (StringUtils.isNotEmpty(val)) {
        entity.setMaxFailure(Short.valueOf(val));
    }
    val = getAttribute(le, PW_FAILURE_COUNT_INTERVAL);
    if (StringUtils.isNotEmpty(val)) {
        entity.setFailureCountInterval(Short.valueOf(val));
    }
    val = getAttribute(le, PW_MUST_CHANGE);
    if (StringUtils.isNotEmpty(val)) {
        // noinspection BooleanConstructorCall
        entity.setMustChange(Boolean.valueOf(val));
    }
    val = getAttribute(le, PW_ALLOW_USER_CHANGE);
    if (StringUtils.isNotEmpty(val)) {
        entity.setAllowUserChange(Boolean.valueOf(val));
    }
    val = getAttribute(le, PW_SAFE_MODIFY);
    if (StringUtils.isNotEmpty(val)) {
        entity.setSafeModify(Boolean.valueOf(val));
    }
    return entity;
}
Also used : ObjectFactory(org.apache.directory.fortress.core.model.ObjectFactory) PwPolicy(org.apache.directory.fortress.core.model.PwPolicy)

Example 4 with ObjectFactory

use of org.apache.directory.fortress.core.model.ObjectFactory in project directory-fortress-core by apache.

the class OrgUnitDAO method unloadDescendants.

/**
 * @param le
 * @param sequence
 * @param contextId
 * @return
 * @throws LdapInvalidAttributeValueException
 * @throws LdapException
 */
private Graphable unloadDescendants(Entry le, long sequence, String contextId) throws LdapInvalidAttributeValueException {
    OrgUnit entity = new ObjectFactory().createOrgUnit();
    entity.setSequenceId(sequence);
    entity.setName(getAttribute(le, SchemaConstants.OU_AT));
    entity.setParents(getAttributeSet(le, GlobalIds.PARENT_NODES));
    return entity;
}
Also used : OrgUnit(org.apache.directory.fortress.core.model.OrgUnit) ObjectFactory(org.apache.directory.fortress.core.model.ObjectFactory)

Example 5 with ObjectFactory

use of org.apache.directory.fortress.core.model.ObjectFactory in project directory-fortress-core by apache.

the class OrgUnitDAO method getEntityFromLdapEntry.

/**
 * @param le
 * @param sequence
 * @param contextId
 * @return
 * @throws LdapInvalidAttributeValueException
 * @throws LdapException
 */
private OrgUnit getEntityFromLdapEntry(Entry le, long sequence, String contextId) throws LdapInvalidAttributeValueException {
    OrgUnit entity = new ObjectFactory().createOrgUnit();
    entity.setSequenceId(sequence);
    entity.setId(getAttribute(le, GlobalIds.FT_IID));
    entity.setName(getAttribute(le, SchemaConstants.OU_AT));
    entity.setDescription(getAttribute(le, SchemaConstants.DESCRIPTION_AT));
    String dn = le.getDn().getName();
    if (dn.contains(getRootDn(contextId, GlobalIds.PSU_ROOT))) {
        entity.setType(OrgUnit.Type.PERM);
        // entity.setParents(PsoUtil.getParents(entity.getName().toUpperCase(), contextId));
        entity.setChildren(PsoUtil.getInstance().getChildren(entity.getName().toUpperCase(), contextId));
    } else if (dn.contains(getRootDn(contextId, GlobalIds.OSU_ROOT))) {
        entity.setType(OrgUnit.Type.USER);
        // entity.setParents(UsoUtil.getParents(entity.getName().toUpperCase(), contextId));
        entity.setChildren(UsoUtil.getInstance().getChildren(entity.getName().toUpperCase(), contextId));
    }
    entity.setParents(getAttributeSet(le, GlobalIds.PARENT_NODES));
    return entity;
}
Also used : OrgUnit(org.apache.directory.fortress.core.model.OrgUnit) ObjectFactory(org.apache.directory.fortress.core.model.ObjectFactory)

Aggregations

ObjectFactory (org.apache.directory.fortress.core.model.ObjectFactory)25 Role (org.apache.directory.fortress.core.model.Role)3 UserRole (org.apache.directory.fortress.core.model.UserRole)3 ArrayList (java.util.ArrayList)2 AdminRole (org.apache.directory.fortress.core.model.AdminRole)2 Constraint (org.apache.directory.fortress.core.model.Constraint)2 OrgUnit (org.apache.directory.fortress.core.model.OrgUnit)2 SDSet (org.apache.directory.fortress.core.model.SDSet)2 Session (org.apache.directory.fortress.core.model.Session)2 User (org.apache.directory.fortress.core.model.User)2 HashMap (java.util.HashMap)1 PasswordPolicy (org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicy)1 LdapAuthenticationException (org.apache.directory.api.ldap.model.exception.LdapAuthenticationException)1 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)1 BindResponse (org.apache.directory.api.ldap.model.message.BindResponse)1 FinderException (org.apache.directory.fortress.core.FinderException)1 PasswordException (org.apache.directory.fortress.core.PasswordException)1 SecurityException (org.apache.directory.fortress.core.SecurityException)1 ValidationException (org.apache.directory.fortress.core.ValidationException)1 Address (org.apache.directory.fortress.core.model.Address)1