简体   繁体   English

克隆权限

[英]Plone Permissions

I am creating a Plone site by help of this book using 4.3.x 我正在本书的帮助下使用4.3.x创建一个Plone网站

Professional Plone for Development 专业的克隆发展

so i have now 4 members : 所以我现在有4位成员:

  1. Manager 经理
  2. Customer 顾客
  3. Ticket Collector 售票员
  4. Staff 员工

so that I customized some permissions according to role but I am fixed at certain point and unable to understand how to set appropriate permissions because as I changed my permissions it doesn't reflect over my site there are two option are there as you can see in following code: 因此我根据角色自定义了一些权限,但是我在某个时候被固定下来,无法理解如何设置适当的权限,因为当我更改权限时,它不能反映我的网站,有两种选择,如您所见以下代码:

mp = portal.tickets.manage_permission

mp(CancelAndReinstate, ['Manager', 'Staff'], 0)

mp('Access contents information', ['Manager','staff'], 0)

mp(permissions.ListFolderContents, ['Manager',], 1)

mp(permissions.View, ['Manager','Customer' ], 1)

portal.tickets.reindexObject()

Here what does 0 and 1 do because these changes are not reflecting over my site so am unable to understand concept. 这里的0和1会做什么,因为这些更改并未反映在我的网站上,因此无法理解概念。 I want to create differ menus as per user role. 我想根据用户角色创建不同的菜单。

No idea what "portal.tickets" is for you, but it seems a site's content. 不知道什么是“ portal.tickets”适合您,但似乎是网站的内容。 If so: you are doing it in the wrong way. 如果是这样:您的操作方式有误。 You should never manually update object security configuration anywhere apart in the Plone site root. 永远不要在Plone站点根目录中的任何位置手动更新对象安全性配置。

What you probably need is a custom workflow for your "tickets" folder and for contents under this folder. 您可能需要的是针对“票证”文件夹和该文件夹下内容的自定义工作流程。

The third argument to manage_permission tells us whether this permission is also inherited from the parent folder: manage_permission的第三个参数告诉我们此权限是否也从父文件夹继承:

def manage_permission(permission_to_manage, roles=[], acquire=0):
    """Change the settings for the given permission.

    If optional arg acquire is true, then the roles for the permission
    are acquired, in addition to the ones specified, otherwise the
    permissions are restricted to only the designated roles.
    """

( AccessControl/interfaces.py ) AccessControl/interfaces.py

The most common and strait-forward way in Plone to set permissions is using Generic Setup and add rolemap.xml to your default (or upgrade) profile. Plone中最常见的设置权限的方法是使用通用设置,然后将rolemap.xml添加到默认(或升级)配置文件中。 A very good and clear documentation on this can be found at: http://docs.plone.org/develop/plone/security/custom_permissions.html 可以在以下位置找到非常好的和清晰的文档: http : //docs.plone.org/develop/plone/security/custom_permissions.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM