def has_permission?(action)
      return true if Action.where(name: action).count == 0
      actions.where(name: action).count > 0
    end
def has_permission?(action)
      return true if Action.where(name: action).count == 0
      actions.where(name: action).count > 0
    end
Determines if the user has permission to a given action. If the action
 does not exist at all, it is assumed the action is publicly available.

 @param [String] action name of the action to check permission for.
 @return [true|false] true if the user has at least one role linked to it
   with permission to the given action.