ModifyRequest modifyRequest = new ModifyRequestImpl();
modifyRequest.setName( dn );
modifyRequest.replace( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
ModifyResponse modResp = connection.modify( modifyRequest );
assertEquals( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS, modResp.getLdapResult().getResultCode() );
modifyRequest = new ModifyRequestImpl();
modifyRequest.setName( dn );
modifyRequest.replace( SchemaConstants.ENTRY_CSN_AT, new CsnFactory( 0 ).newInstance().toString() );
// admin can modify the entryCsn
modResp = connection.modify( modifyRequest );
assertEquals( ResultCodeEnum.SUCCESS, modResp.getLdapResult().getResultCode() );
LdapNetworkConnection nonAdminConnection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
Dn bindDn = new Dn( "uid=billyd,ou=users,ou=system" );
nonAdminConnection.bind( bindDn.getName(), "secret" );
// non-admin user cannot modify entryCSN
modResp = nonAdminConnection.modify( modifyRequest );
assertEquals( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS, modResp.getLdapResult().getResultCode() );
nonAdminConnection.close();
}