Name principalDn = getPrincipal( call ).getDn();
if ( name.toString().equals( "" ) )
{
String msg = "The rootDSE cannot be deleted!";
throw new LdapNoPermissionException( msg );
}
if ( name == ADMIN_DN || name.equals( ADMIN_DN ) )
{
String msg = "User " + principalDn;
msg += " does not have permission to delete the admin account.";
msg += " No one not even the admin can delete this account!";
throw new LdapNoPermissionException( msg );
}
if ( name.size() > 2 && name.startsWith( USER_BASE_DN )
&& !principalDn.equals( ADMIN_DN ) )
{
String msg = "User " + principalDn;
msg += " does not have permission to delete the user account: ";
msg += name + ". Only the admin can delete user accounts.";
throw new LdapNoPermissionException( msg );
}
if ( name.size() > 2 && name.startsWith( GROUP_BASE_DN )
&& !principalDn.equals( ADMIN_DN ) )
{
String msg = "User " + principalDn;
msg += " does not have permission to delete the group entry: ";
msg += name + ". Only the admin can delete groups.";
throw new LdapNoPermissionException( msg );
}
nextInterceptor.process( call );
}