source: products/SimpleBlog/trunk/Permissions.py

Last change on this file was 1, checked in by myroslav, 14 years ago

Building directory structure

  • Property svn:eol-style set to native
File size: 805 bytes
Line 
1from Products.CMFCore.CMFCorePermissions import setDefaultRoles
2from Products.Archetypes.public import listTypes
3from Products.SimpleBlog.config import PROJECTNAME
4
5# Add Entry
6CROSS_POST_PERMISSION='SimpleBlog: Cross-post'
7
8setDefaultRoles(CROSS_POST_PERMISSION, ( 'Manager', 'Owner' ) )
9
10TYPE_ROLES = ('Manager', 'Owner')
11
12permissions = {}
13def wireAddPermissions():
14    """Creates a list of add permissions for all types in this project
15   
16    Must be called **after** all types are registered!
17    """
18    global permissions
19    blog_types = listTypes(PROJECTNAME)
20    for btype in blog_types:
21        permission = "%s: Add %s" % (PROJECTNAME, btype['portal_type'])
22        setDefaultRoles(permission, TYPE_ROLES)
23       
24        permissions[btype['portal_type']] = permission
25    return permissions
Note: See TracBrowser for help on using the repository browser.