Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(21)  |  Call(14)  |  Derive(0)  |  Import(7)

        def addPermission(perm, default_roles=('Manager', )):
    if perm in _registeredPermissions:
        return

    entry = ((perm, (), default_roles), )
    global _ac_permissions
    _ac_permissions = _ac_permissions + entry
    _registeredPermissions[perm] = 1
    mangled = pname(perm) # get mangled permission name
    if not hasattr(ApplicationDefaultPermissions, mangled):
        setattr(ApplicationDefaultPermissions, mangled, default_roles)
        


src/a/c/AccessControl-3.0.8/src/AccessControl/security.py   AccessControl(Download)
from AccessControl.SecurityInfo import ClassSecurityInfo
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.Permission import addPermission
 
CheckerPublicId = 'zope.Public'
        zope2_permission = str(self.title)
        if self.roles:
            addPermission(zope2_permission, default_roles=tuple(self.roles))
        elif self.id == CheckerPrivateId:
            addPermission(zope2_permission, default_roles=())
        else:
            addPermission(zope2_permission)

src/c/o/contentratings-1.1/contentratings/permissions.py   contentratings(Download)
try:
    # Set some default roles for zope2
    from AccessControl.Permission import addPermission
except ImportError:
    pass
else:
    addPermission(EditorRate, default_roles=('Manager', 'Reviewer'))
    addPermission(ViewEditorialRating, default_roles=('Anonymous', 'Authenticated',))
    addPermission(UserRate, default_roles=('Anonymous', 'Authenticated',))
    addPermission(ViewUserRating, default_roles=('Anonymous','Authenticated',))

src/p/r/Products.PluggableAuthService-1.10.0/Products/PluggableAuthService/permissions.py   Products.PluggableAuthService(Download)
addPermission = None
try:
    from AccessControl.Permission import addPermission
except ImportError:
    pass
def setDefaultRoles( permission, roles ):
    """ Set the defaults roles for a permission.
    """
    if addPermission is not None:
        addPermission(permission, roles)

src/p/r/Products.CMFCore-2.2.8/Products/CMFCore/permissions.py   Products.CMFCore(Download)
addPermission = None
try:
    from AccessControl.Permission import addPermission
except ImportError:
    pass
    '''
    if addPermission is not None:
        addPermission(permission, roles)
    else:
        # BBB This is in AccessControl starting in Zope 2.13

src/p/r/Products.CMFCalendar-2.3.0-beta/Products/CMFCalendar/permissions.py   Products.CMFCalendar(Download)
 
from AccessControl import ModuleSecurityInfo
from AccessControl.Permission import addPermission
 
security = ModuleSecurityInfo('Products.CMFCalendar.permissions')
 
security.declarePublic('AddEvents')
AddEvents = 'Add portal events'
addPermission(AddEvents, ('Manager', 'Owner', 'Member'))
security.declarePublic('ChangeEvents')
ChangeEvents = 'Change portal events'
addPermission(ChangeEvents, ('Manager', 'Owner',))
 
security.declarePublic('AddPortalContent')

src/p/r/Products.CMFTopic-2.3.0-beta/Products/CMFTopic/permissions.py   Products.CMFTopic(Download)
 
from AccessControl import ModuleSecurityInfo
from AccessControl.Permission import addPermission
 
security = ModuleSecurityInfo('Products.CMFTopic.permissions')
 
security.declarePublic('AddTopics')
AddTopics = 'Add portal topics'
addPermission(AddTopics, ('Manager',))
security.declarePublic('ChangeTopics')
ChangeTopics = 'Change portal topics'
addPermission(ChangeTopics, ('Manager', 'Owner',))
 
security.declarePublic('AccessContentsInformation')

src/d/m/dm.zdoc-2.0/dm/zdoc/__init__.py   dm.zdoc(Download)
import App.FindHomes # activate Zope's import magic
from AccessControl.Permission import addPermission
 
# register our permission
addPermission("zdoc: view documentation")