def valid_user? #:doc:
      if require_admin_for_request?
        authorize! true
      elsif require_anon_for_request?
        if logged_in?
          flash[:warning] = 'The specified action cannot be performed while logged in.'
          redirect_to incline.user_path(current_user)
        end
      elsif allow_anon_for_request?
        true
      else
        action = Incline::ActionSecurity.valid_items[self.class.controller_path, params[:action]]
        if action && action.groups.count > 0
          authorize! action.groups.pluck(:name)
        else
          authorize!
        end
      end
    end
def valid_user? #:doc:
      if require_admin_for_request?
        authorize! true
      elsif require_anon_for_request?
        if logged_in?
          flash[:warning] = 'The specified action cannot be performed while logged in.'
          redirect_to incline.user_path(current_user)
        end
      elsif allow_anon_for_request?
        true
      else
        action = Incline::ActionSecurity.valid_items[self.class.controller_path, params[:action]]
        if action && action.groups.count > 0
          authorize! action.groups.pluck(:name)
        else
          authorize!
        end
      end
    end
Validates that the current user is authorized for the current request.

 This method is called for every action except the :api action.
 For the :api action, this method will not be called until the actual requested action is performed.

 One of four scenarios are possible:
 1.  If the +require_admin+ method applies to the current action, then a system administrator must be logged in.
     1.  If a nobody is logged in, then the user will be redirected to the login url.
     2.  If a system administrator is logged in, then access is granted.
     3.  Non-system administrators will be redirected to the root url.
 2.  If the +require_anon+ method applies to the current action, then a user cannot be logged in.
     1.  If a user is logged in, a warning message is set and the user is redirected to their account.
     2.  If no user is logged in, then access is granted.
 3.  If the +allow_anon+ method applies to the current action, then access is granted.
 4.  The action doesn't require a system administrator, but does require a valid user to be logged in.
     1.  If nobody is logged in, then the user will be redirected to the login url.
     2.  If a system administrator is logged in, then access is granted.
     3.  If the action doesn't have any required permissions, then access is granted to any logged in user.
     4.  If the action has required permissions and the logged in user shares at least one, then access is granted.
     5.  Users without at least one required permission are redirected to the root url.

 Two of the scenarios are configured at design time. If you use +require_admin+ or +allow_anon+,
 they cannot be changed at runtime.  The idea is that anything that allows anonymous access will always allow
 anonymous access during runtime and anything that requires admin access will always require admin access during
 runtime.

 The third scenario is what would be used by most actions.  Using the +admin+ controller, which requires admin
 access, you can customize the permissions required for each available route.  Using the +users+ controller,
 admins can assign permissions to other users.