Plone Permissions

206 Views Asked by At

I am creating a Plone site by help of this book using 4.3.x

Professional Plone for Development

so i have now 4 members :

  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. I want to create differ menus as per user role.

3

There are 3 best solutions below

0
On

The third argument to manage_permission tells us whether this permission is also inherited from the parent folder:

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)

0
On

No idea what "portal.tickets" is for you, but it seems a site's content. 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.

What you probably need is a custom workflow for your "tickets" folder and for contents under this folder.

0
On

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. A very good and clear documentation on this can be found at: http://docs.plone.org/develop/plone/security/custom_permissions.html