In Padrino, where does access_control come from?

136 views Asked by At

The Padrino Admin Guide (http://www.padrinorb.com/guides/padrino-admin) has the object "access_control", but it is not clear to me where it is set? I can guess, but that is not good enough. We have essentially:

class Admin < Padrino::Application
  register Padrino::Admin::AccessControl

  enable :authentication
  set :login_page, "/admin/sessions/new"

  access_control.roles_for :any do |role|   #How is access_control set?
    role.protect "/"
    role.allow "/sessions"
  end
...

I am expecting that access_control is set somewhere, but where? I am guessing that this has to do with the "register" command, but have not found any help in docs yet.

thanks for any help...

1

There are 1 answers

0
rtfminc On

Well, little interest in this, but I needed an answer, so here is mine.

I have at the top register Padrino::Admin::AccessControl which also lists Authorization, Base, ProjectModule. I can see some of the methods used in the app from the docs: https://www.padrinorb.com/api/Padrino/Admin/AccessControl.html

However, nothing I could see about "access_control". I finally saw in the docs something I had missed, the line:

Defined in:padrino-admin/lib/padrino-admin/access_control.rb

AhHa! That is what I needed. Github if I need to look further.