// Modify the user entry to add the CONFIG_READ privilege and verify that
// the client connection reflects that.
ArrayList<Modification> mods = new ArrayList<Modification>();
mods.add(new Modification(ModificationType.ADD,
Attributes.create("ds-privilege-name", "config-read")));
ModifyOperation modifyOperation =
rootConnection.processModify(DN.decode("cn=Test User,o=test"), mods);
assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
assertTrue(testConnection.hasPrivilege(Privilege.CONFIG_READ, null));
// Take the privilege away from the user and verify that it is recognized
// immediately.
mods.clear();
mods.add(new Modification(ModificationType.DELETE,
Attributes.create("ds-privilege-name", "config-read")));
modifyOperation =
rootConnection.processModify(DN.decode("cn=Test User,o=test"), mods);
assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
assertFalse(testConnection.hasPrivilege(Privilege.CONFIG_READ, null));
DeleteOperation deleteOperation =
rootConnection.processDelete(DN.decode("cn=Test User,o=test"));