Package javax.naming.ldap

Examples of javax.naming.ldap.LdapContext.modifyAttributes()


        // now enable the test schema
        ModificationItem[] mods = new ModificationItem[1];
        Attribute attr = new BasicAttribute( "m-disabled", "TRUE" );
        mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
        schemaRoot.modifyAttributes( "cn=" + schemaName, mods );
    }
   
   
    /**
     * A helper method which tells if a schema is disabled.
View Full Code Here


        // -------------------------------------------------------------------

        ModificationItem[] mods = new ModificationItem[] {
                new ModificationItem( DirContext.ADD_ATTRIBUTE, new BasicAttribute( "cn", "fbar" ) )
        };
        ctx.modifyAttributes( "cn=foo bar,ou=system", mods );
        Attributes reread = ( Attributes ) ctx.getAttributes( "cn=foo bar,ou=system" );
        assertTrue( reread.get( "cn" ).contains( "fbar" ) );
       
        // -------------------------------------------------------------------
        // do rename and confirm
View Full Code Here

    public void addMember(String groupDN, String memberDN) throws Exception {
        LdapContext ctxt = getWiredContext();
        BasicAttributes attrs = new BasicAttributes();
        attrs.put("member", memberDN);
        ctxt.modifyAttributes(groupDN, DirContext.ADD_ATTRIBUTE, attrs);
    }

    public void removeMember(String groupDN, String memberDN) throws Exception {
        LdapContext ctxt = getWiredContext();
        BasicAttributes attrs = new BasicAttributes();
View Full Code Here

    public void removeMember(String groupDN, String memberDN) throws Exception {
        LdapContext ctxt = getWiredContext();
        BasicAttributes attrs = new BasicAttributes();
        attrs.put("member", memberDN);
        ctxt.modifyAttributes(groupDN, DirContext.REMOVE_ATTRIBUTE, attrs);
    }

    private static String buildDn(String name, boolean isGroup) {
        StringBuilder dn = new StringBuilder();
        dn.append("cn=").append(name).append(',');
View Full Code Here

                    ctx.reconnect(null);
                } catch (javax.naming.AuthenticationException e) {
                    throw new BadCredentialsException("Authentication for password change failed.");
                }

                ctx.modifyAttributes(dn, passwordChange);

                return null;
            }
        });
    }
View Full Code Here

                    // use "throw" as we handle referrals manually
                    modCtx.addToEnvironment( Context.REFERRAL, REFERRAL_THROW );

                    // perform modification
                    modCtx.modifyAttributes( getSaveJndiName( dn ), modificationItems );
                }
                catch ( ReferralException re )
                {
                    logModifycation = false;
                    try
View Full Code Here

               if (broadcast)
               {
                  preSave(mt, false);
               }

               ctx.modifyAttributes(membershipTypeDN, mods);
               cacheHandler.put(mt.getName(), mt, CacheType.MEMBERSHIPTYPE);

               if (broadcast)
               {
                  postSave(mt, false);
View Full Code Here

               mods[0] =
                  new ModificationItem(DirContext.ADD_ATTRIBUTE, new BasicAttribute(
                     ldapAttrMapping.membershipTypeMemberValue, userDN));
               if (broadcast)
                  preSave(m, true);
               ctx.modifyAttributes(membershipDN, mods);
               if (broadcast)
                  postSave(m, true);
               cacheHandler.put(cacheHandler.getMembershipKey(m), m, CacheType.MEMBERSHIP);
               return;
View Full Code Here

                  mods[0] =
                     new ModificationItem(DirContext.REMOVE_ATTRIBUTE, new BasicAttribute(
                        ldapAttrMapping.membershipTypeMemberValue, userDN));
                  if (broadcast)
                     preSave(m, true);
                  ctx.modifyAttributes(membershipDN, mods);
                  if (broadcast)
                     postSave(m, true);
                  cacheHandler.put(cacheHandler.getMembershipKey(m), m, CacheType.MEMBERSHIP);
               }
               else
View Full Code Here

               Integer.toString(UF_NORMAL_ACCOUNT + UF_PASSWORD_EXPIRED)));
         for (int err = 0;; err++)
         {
            try
            {
               ctx.modifyAttributes(userDN, mods);
               break;
            }
            catch (NamingException e)
            {
               ctx = reloadCtx(ctx, err, e);
View Full Code Here

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.