generators/app/templates/server/api/user(auth)/user.model.js
function preRemove(next) {
  // jshint validthis: true
  if (auth.roles.isRoot(this.role)) {
    return next(new MongooseError.ValidationError(auth.roles.getMaxRole() + ' role cannot be deleted'));
  }

  return next();
}
function preRemove(next) {
  // jshint validthis: true
  if (auth.roles.isRoot(this.role)) {
    return next(new MongooseError.ValidationError(auth.roles.getMaxRole() + ' role cannot be deleted'));
  }

  return next();
}
function preRemove ( next ) { // jshint validthis: true if ( auth . roles . isRoot ( this . role ) ) { return next ( new MongooseError . ValidationError ( auth . roles . getMaxRole ( ) + ' role cannot be deleted' ) ) ; } return next ( ) ; }
Pre remove hook for the User model.
Validates that the root user cannot be deleted.

@api private
@param {Function} next - The mongoose middleware callback
@returns {*} If an error occurs the passed callback with an Error as its argument is called
Pre remove hook for the User model . Validates that the root user cannot be deleted .