Ejemplo n.º 1
0
    def __init__(self, context, default=None):
        self.value = default
        if IDraftedContent.providedBy(context):
            return

        _context = removeSecurityProxy(context)

        ct = IContentType(_context, None)
        if ct is None:
            return

        perms = {}
        for ct in ct.listContainedTypes(False):
            dct = queryUtility(IDraftContentType, ct.name)
            if dct is not None:
                # do not check permission
                if IDraftedContentType.providedBy(ct):
                    interface.noLongerProvides(ct, IDraftedContentType)
                ct.permission = None
                if not ct.isAvailable():
                    continue

                if dct.publish:
                    perms[dct.publish] = 1

        principals = {}
        for permission in perms.keys():
            principals.update(
                [(user, 1) for user in getAccessList(_context, permission)])

        if principals:
            self.value = principals.keys()
Ejemplo n.º 2
0
    def __init__(self, context, default=None):
        self.value = default
        self.allowed = default

        if not IDraftContent.providedBy(context):
            return

        ct = IContentType(context, None)
        if ct is None:
            return

        location = context.getLocation()
        if location is None:
            return

        users = getAccessList(removeSecurityProxy(location), ct.publish)

        self.value = users
        self.allowed = users
Ejemplo n.º 3
0
 def __init__(self, item, default=None):
     self.value = getAccessList(removeAllProxies(item.content), "zope.View")
Ejemplo n.º 4
0
 def __init__(self, record, default=None):
     self.value = getAccessList(removeAllProxies(record.object), 'zope.View')
Ejemplo n.º 5
0
 def __init__(self, comment, default=None):
     self.value = getAccessList(
         removeAllProxies(comment.content), 'zope.View')
Ejemplo n.º 6
0
 def __init__(self, item, default=None):
     self.value = getAccessList(removeAllProxies(item.content), 'zope.View')