CanCan Gem:不想预先加载能力
我的应用程序具有太多的权限和操作,因此为给定的用户会话预先加载所有这些权限和操作需要花费大量时间(400 毫秒或更多,即使数据量可以忽略不计)。假设,用户在控制器上发出“索引”方法请求,主题(模型类)是模型。我希望 CanCan 只定义单个功能,即使实际的 .YML 文件配置了所有功能。
除此之外,我不会为几乎可以做所有事情的“管理员”用户加载这些功能。
如何解决以上2个问题呢?
My app has way too many privileges and actions, so loading all of them upfront for a given user session takes a lot of time (400 ms or more, even for negligible amount of data). Say, the user makes an "index" method request on a controller and the subject (model class) is Model. I would like for CanCan to only define that single ability even though the actual .YML file has all of the abilities configured.
Along with this, I don't these abilities to be all loaded for an "admin" user who can do pretty much everything.
How can I solve the above 2 problems above?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论