Vanilla authlogic/cantango setup, test with ahardcoded roles_list
测试期间<回归代码>[:用户]代码>。 测试许可。 yml file:
roles:
user:
can:
manage:
- User
根据第一项要求,<代码>用户_can? (:manage,user)我期望什么。 然而,在随后的要求下,它不再属实,我的许可也随之消失。
The Duh :/current_user
and current_user_session
vars change on each request; not sure if that s because I m in dev environment and something s being reloaded, but it sketches me out a little bit.
在<代码>Application Controller中实施,以示例。
如果我装上ole子:
pry(main)> u = User.first
=> #<User id: 2, email: "ohai@wtf.com", [...]
pry(main)> a = CanTango::Ability.new u
=> [lots of stuff, available on request]
pry(main)> a.can?(:manage, User.new)
=> true
pry(main)> a.can?(:manage, User.new)
=> true
I试图在运河中转道(如果是正当的)。 rb per cantango sdocs [...]>
任何背心/倾斜/点/点/源/docs?