Personal tools
You are here: Home Documentation Manuals Archetypes Developer Manual A simple AT Product The permissions module
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

2.3. The permissions module

Up one level
Setting the security permissions for your content type.

First, we import the standard useful modules:

from Products.CMFCore.permissions import setDefaultRoles
from Products.Archetypes.atapi import listTypes
from config import PROJECTNAME

In this module, we need to define the "Add" permission for the Instant Message type, and set it to the default roles:

# Add an Instant Message
ADD_CONTENT_PERMISSION = 'InstantMessage: Add InstantMessage'

# Assign default roles
setDefaultRoles(ADD_CONTENT_PERMISSION, ('Owner', 'Manager',))

The reason the variable here is UPPERCASED is that it should be treated like a constant, and this makes them easy to spot.

We recommend using the standard way of naming permissions: '<ProductName>: <Permission>'. This will group the related permissions together within the ZMI (Security tab), and allow the Administrator to recognize which permissions belong to which Product.

Note that, unless you have an advanced case which needs custom security settings, you don't need to define your own permissions for the "edit" and "view" of the content. In this simple case you will just reuse, in the modules where needed, the generic permissions defined in CMFCore.permissions: "View", "Modify portal content"...

by Kamon Ayeva last modified December 1, 2006 - 20:13
Contributors: Sisi Nutt, Alexander Limi, Martin Aspeli, Marco De Vitis, Raphael Ritz, Maik Röder, Steve McMahon
All content is copyright Plone Foundation and the individual contributors.

don't know how to do this first part of archetypes.

Posted by bobconnors at May 13, 2008 - 11:41
In this part of archetypes tutorial:


From Home → Documentation → Manuals → Archetypes Developer Manual → A simple AT Product → The permissions module
It says:

First, we import the standard useful modules:

I went to Add Script Python:
from Products.CMFCore.permissions import setDefaultRoles

and get

Error Type: ImportError
Error Value: import of "setDefaultRoles" from "Products.CMFCore.permissions" is unauthorized. You are not allowed to access 'setDefaultRoles' in this context
What do I do to get this right?

Thanks
Bob

Not supposed to do this through the ZMI

Posted by Andre Engelbrecht at May 25, 2008 - 11:21
from your description is sounds like you are trying to creat it through the ZMI, which is wrong.

This tutorial works directly from your local Filesystem you should create a folder/directory for your product, and then create all the separate files and folders as the start of the tutorial mentions.

When you are done with it, you need to put your new product folder, in your products folder of your instance home

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by