Skip to content

Authorization

Mattia Roccoberton edited this page Jun 4, 2023 · 1 revision

Authorization is provided setting the option authorization_class to a class that inherits from the Authorization and that overrides the allowed? class method:

authorization_class: Admin::Perms

While the Perms class could be like this:

module Admin
  class Perms < TinyAdmin::Plugins::Authorization
    class << self
      def allowed?(user, action, param = nil)
        return false if action == :page && param == 'stats'

        true
      end
    end
  end
end
Clone this wiki locally