Pyramid 和 FormAlchemy 管理界面
我有一个使用正规化学管理界面的金字塔项目。我添加了基本的 ACL 身份验证,即使我已通过身份验证,pyramid_formalchemy 插件也始终会拒绝。
关于如何只允许经过身份验证的用户使用 Pyramid_formalchemy 管理界面有什么想法吗?
授权策略添加如下:
authn_policy = AuthTktAuthenticationPolicy('MYhiddenSECRET', callback=groupfinder) authz_policy = ACLAuthorizationPolicy() config = Configurator( settings=settings, root_factory='package.auth.RootFactory', authentication_policy=authn_policy, authorization_policy=authz_policy ) # pyramid_formalchemy's configuration config.include('pyramid_formalchemy') config.include('fa.jquery') config.formalchemy_admin('admin', package='package', view='fa.jquery.pyramid.ModelView')
I have a pyramid project using the formalchemy admin interface. I added the basic ACL authentication and the pyramid_formalchemy plugin always denys even though I am authenticated.
Any thoughts on how only allow authenticated users to use the pyramid_formalchemy admin interface?
The authorization policy was add like this:
authn_policy = AuthTktAuthenticationPolicy('MYhiddenSECRET', callback=groupfinder) authz_policy = ACLAuthorizationPolicy() config = Configurator( settings=settings, root_factory='package.auth.RootFactory', authentication_policy=authn_policy, authorization_policy=authz_policy ) # pyramid_formalchemy's configuration config.include('pyramid_formalchemy') config.include('fa.jquery') config.formalchemy_admin('admin', package='package', view='fa.jquery.pyramid.ModelView')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
pyramid_formalchemy
使用权限“查看”、“编辑”、“删除”、“新建”
来确定谁可以做什么。__acl__
从 SQLAlchemy 模型对象向下传播。因此,您需要在每个模型对象上放置一个__acl__
,以允许您所需的组访问这些权限。例如,来自pyramid_formalchemy
pyramidapp
示例项目:当然,如果您不提供
__acl__
那么它将在资源树,直到到达工厂
。默认情况下,pyramid_formalchemy
定义了自己的工厂pyramid_formalchemy.resources.Models
,但是您可以对其进行子类化并为其提供__acl__
作为全局变量对于您的所有型号:pyramid_formalchemy
uses the permissions'view', 'edit', 'delete', 'new'
to determine who can do what. The__acl__
is propagated down from your SQLAlchemy model object. Thus, you need to put an__acl__
on each of your model objects allowing your desired groups access to those permissions. For example, from thepyramid_formalchemy
pyramidapp
example project:Of course, if you do not supply an
__acl__
then it will look in the lineage of the resource tree until it hits thefactory
. By default,pyramid_formalchemy
defines its own factorypyramid_formalchemy.resources.Models
, however you can subclass this and provide an__acl__
to it, as a global for all of your models: