Package javax.naming.directory

Examples of javax.naming.directory.DirContext.modifyAttributes()


      if (failer == null) {
        currMembers.add(dn);
        Attributes attrs = new BasicAttributes();
        attrs.put(currMembers);
       
        ctx.modifyAttributes(this.dn, DirContext.REPLACE_ATTRIBUTE, attrs);
        return true;
      }
 
    } catch (Exception e) {
      throw new OperationFailedException(e);


      if (result != null) {
        currMembers.remove(result);
        Attributes attrs = new BasicAttributes();
        attrs.put(currMembers);
     
        ctx.modifyAttributes(this.dn, DirContext.REPLACE_ATTRIBUTE, attrs);
       
        return true;
      }
 
    } catch (Exception e) {

   

    try {
      if (attributes != null) {
        if (name != null) {
          dirctx.modifyAttributes(name, modop, attributes);
        } else {
          dirctx.modifyAttributes(sname, modop, attributes);
        }
      } else if (modifications != null) {
        if (name != null) {

    try {
      if (attributes != null) {
        if (name != null) {
          dirctx.modifyAttributes(name, modop, attributes);
        } else {
          dirctx.modifyAttributes(sname, modop, attributes);
        }
      } else if (modifications != null) {
        if (name != null) {
          dirctx.modifyAttributes(name, modifications);
        } else {

        } else {
          dirctx.modifyAttributes(sname, modop, attributes);
        }
      } else if (modifications != null) {
        if (name != null) {
          dirctx.modifyAttributes(name, modifications);
        } else {
          dirctx.modifyAttributes(sname, modifications);
        }
      }
    } catch (NamingException e) {

        }
      } else if (modifications != null) {
        if (name != null) {
          dirctx.modifyAttributes(name, modifications);
        } else {
          dirctx.modifyAttributes(sname, modifications);
        }
      }
    } catch (NamingException e) {
      throw context.exception(e);
    }

      } else {
        userPasswordAttribute = new BasicAttribute ( ldapUserPasswordAttribute, pwd );
      }

      modificationItems [ 0 ] = new ModificationItem ( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute );
      ctx.modifyAttributes ( dn, modificationItems );
      ctx.close();
    } catch (NamingException e) {
      log.error("NamingException when trying to change password with username::" + uid, e);
      errors.insert("Cannot change the password");
    }

            {
                // Since turbineUserGroup had already been created
                // then just add the role name attribute.
                attrs = new BasicAttributes();
                attrs.put(new BasicAttribute("turbineRoleName", roleName));
                ctx.modifyAttributes(dn, DirContext.ADD_ATTRIBUTE, attrs);
            }

        }
        catch (NamingException ex)
        {

            // Connect to LDAP.
            DirContext ctx = LDAPUserManager.bindAsAdmin();

            // Remove the role.
            ctx.modifyAttributes(dn, DirContext.REMOVE_ATTRIBUTE, attrs);

        }
        catch (NamingException ex)
        {
            throw new DataBackendException("NamingException caught", ex);

            // Connect to LDAP.
            DirContext ctx = LDAPUserManager.bindAsAdmin();

            // Add the permission.
            ctx.modifyAttributes(dn, DirContext.ADD_ATTRIBUTE, attrs);

        }
        catch (NamingException ex)
        {
            throw new DataBackendException("NamingException caught", ex);

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.