use of org.apache.directory.api.ldap.model.exception.LdapNoSuchAttributeException in project directory-fortress-core by apache.
the class UserDAO method deleteResetFlag.
/**
*1 * @param user
* @throws UpdateException
*/
private void deleteResetFlag(User user) throws UpdateException {
LdapConnection ld = null;
String userDn = getDn(user.getUserId(), user.getContextId());
try {
List<Modification> mods = new ArrayList<Modification>();
mods.add(new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, OPENLDAP_PW_RESET));
ld = getAdminConnection();
modify(ld, userDn, mods, user);
} catch (LdapNoSuchAttributeException e) {
// Log, but don't throw, if reset attribute not present on account.
LOG.info("deleteResetFlag user [" + user.getUserId() + "] no such attribute:" + OPENLDAP_PW_RESET);
} catch (LdapException e) {
String warning = "deleteResetFlag userId [" + user.getUserId() + "] caught LDAPException=" + e.getMessage();
throw new UpdateException(GlobalErrIds.USER_PW_RESET_FAILED, warning, e);
} finally {
closeAdminConnection(ld);
}
}
use of org.apache.directory.api.ldap.model.exception.LdapNoSuchAttributeException in project directory-fortress-core by apache.
the class PermDAO method revoke.
/**
* @param pOp
* @param user
* @throws org.apache.directory.fortress.core.UpdateException
*
* @throws org.apache.directory.fortress.core.FinderException
*/
void revoke(Permission pOp, User user) throws UpdateException, FinderException {
LdapConnection ld = null;
String dn = getDn(pOp, pOp.getContextId());
try {
List<Modification> mods = new ArrayList<Modification>();
mods.add(new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, USERS, user.getUserId()));
ld = getAdminConnection();
modify(ld, dn, mods, pOp);
} catch (LdapNoSuchAttributeException e) {
String warning = "revoke perm object [" + pOp.getObjName() + "] operation [" + pOp.getOpName() + "] userId [" + user.getUserId() + "] assignment does not exist.";
throw new FinderException(GlobalErrIds.PERM_USER_NOT_EXIST, warning);
} catch (LdapException e) {
String error = "revoke perm object [" + pOp.getObjName() + "] operation [" + pOp.getOpName() + "] userId [" + user.getUserId() + "] caught LdapException=" + e.getMessage();
throw new UpdateException(GlobalErrIds.PERM_REVOKE_FAILED, error, e);
} finally {
closeAdminConnection(ld);
}
}
Aggregations