| | |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.AuthenticationInfo; |
| | | import org.opends.server.types.ByteStringFactory; |
| | | import org.opends.server.types.Control; |
| | |
| | | "uid: pwreset.target", |
| | | "userPassword: password"); |
| | | |
| | | TestCaseUtils.applyModifications( |
| | | TestCaseUtils.applyModifications(false, |
| | | "dn: o=test", |
| | | "changetype: modify", |
| | | "add: aci", |
| | |
| | | InternalClientConnection rootConnection = |
| | | InternalClientConnection.getRootConnection(); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | new Attribute("ds-privilege-name", "jmx-read"))); |
| | | mods.add(new Modification(ModificationType.ADD, Attributes.create( |
| | | "ds-privilege-name", "jmx-read"))); |
| | | ModifyOperation modifyOperation = |
| | | rootConnection.processModify(DN.decode(user), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | // remove JMX_READ privilege |
| | | mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | new Attribute("ds-privilege-name", "jmx-read"))); |
| | | Attributes.create("ds-privilege-name", "jmx-read"))); |
| | | modifyOperation = |
| | | rootConnection.processModify(DN.decode(user), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | new Attribute("ds-cfg-size-limit", "2000"))); |
| | | Attributes.create("ds-cfg-size-limit", "2000"))); |
| | | |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode("cn=config"), mods); |
| | |
| | | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | new Attribute("ds-cfg-size-limit", "1000"))); |
| | | Attributes.create("ds-cfg-size-limit", "1000"))); |
| | | |
| | | modifyOperation = conn.processModify(DN.decode("cn=config"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | new Attribute("attributetypes", attrDefinition))); |
| | | Attributes.create("attributetypes", attrDefinition))); |
| | | |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode("cn=schema"), mods); |
| | |
| | | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | new Attribute("attributetypes", attrDefinition))); |
| | | Attributes.create("attributetypes", attrDefinition))); |
| | | |
| | | modifyOperation = conn.processModify(DN.decode("cn=schema"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | // Try to modify the entry to add a description. |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(1); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | new Attribute("description", "foo"))); |
| | | Attributes.create("description", "foo"))); |
| | | |
| | | ModifyOperationBasis modifyOperation = new ModifyOperationBasis(conn, |
| | | conn.nextOperationID(), conn.nextMessageID(), controls, e.getDN(), |
| | |
| | | // Try to modify the entry to add a description. |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(1); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | new Attribute("description", "foo"))); |
| | | Attributes.create("description", "foo"))); |
| | | |
| | | ModifyOperationBasis modifyOperation = |
| | | new ModifyOperationBasis(conn, |
| | |
| | | // the client connection reflects that. |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | new Attribute("ds-privilege-name", "jmx-read"))); |
| | | Attributes.create("ds-privilege-name", "jmx-read"))); |
| | | ModifyOperation modifyOperation = |
| | | rootConnection.processModify(DN.decode("cn=Test User,o=test"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | // immediately. |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | new Attribute("ds-privilege-name", "jmx-read"))); |
| | | Attributes.create("ds-privilege-name", "jmx-read"))); |
| | | modifyOperation = |
| | | rootConnection.processModify(DN.decode("cn=Test User,o=test"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | new Attribute("ds-cfg-default-root-privilege-name", |
| | | Attributes.create("ds-cfg-default-root-privilege-name", |
| | | "proxied-auth"))); |
| | | ModifyOperation modifyOperation = |
| | | internalRootConn.processModify(DN.decode("cn=Root DNs,cn=config"), |
| | |
| | | // Update the set of root privileges to revoke proxied auth. |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | new Attribute("ds-cfg-default-root-privilege-name", |
| | | Attributes.create("ds-cfg-default-root-privilege-name", |
| | | "proxied-auth"))); |
| | | modifyOperation = |
| | | internalRootConn.processModify(DN.decode("cn=Root DNs,cn=config"), |