if ( dn.isEmpty() )
{
String msg = "The rootDSE cannot be moved or renamed!";
LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
if ( dn.getNormName().equals( ADMIN_GROUP_DN.getNormName() ) )
{
String msg = "The Administrators group cannot be moved or renamed!";
LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
if ( isTheAdministrator( dn ) )
{
String msg = "User '" + principalDn.getUpName();
msg += "' does not have permission to move or rename the admin";
msg += " account. No one not even the admin can move or";
msg += " rename " + dn.getUpName() + "!";
LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
if ( dn.size() > 2 && dn.startsWith( USER_BASE_DN ) && !isAnAdministrator( principalDn ) )
{
String msg = "User '" + principalDn.getUpName();
msg += "' does not have permission to move or rename the user";
msg += " account: " + dn.getUpName() + ". Only the admin can move or";
msg += " rename user accounts.";
LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
if ( dn.size() > 2 && dn.startsWith( GROUP_BASE_DN ) && !isAnAdministrator( principalDn ) )
{
String msg = "User " + principalDn.getUpName();
msg += " does not have permission to move or rename the group entry ";
msg += dn.getUpName() + ".\nGroups can only be moved or renamed by the admin.";
throw new LdapNoPermissionException( msg );
}
}