WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
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