def __call__(self):
        parent = aq_parent(aq_inner(self.context))

        # not allowed for anonymous users
        mtool = getToolByName(self.context, 'portal_membership')
        if mtool.isAnonymousUser():
            return False

        # if webdav is not allowed, we cannot externally edit
        if not webdav_enabled(self.context, parent):
            return False

        # only allowed on documents
        if not IDocumentSchema.providedBy(self.context):
            return False

        # only allowed, when there already is a file
        if not self.context.file:
            return False

        # only allowed when the current user has checked out the document
        current_user_id = getSecurityManager().getUser().getId()
        manager = queryMultiAdapter((self.context, self.request),
                                    ICheckinCheckoutManager)

        if not manager or manager.get_checked_out_by() != current_user_id:
            return False

        # Content may provide data to the external editor ?
        portal = getToolByName(self.context, 'portal_url').getPortalObject()
        return not not portal.externalEditLink_(self.context)
    def render(self):
        parent = aq_parent(aq_inner(self.context))

        # not allowed for anonymous users
        mtool = getToolByName(self.context, 'portal_membership')
        if mtool.isAnonymousUser():
            return False

        # if webdav is not allowed, we cannot externally edit
        if not webdav_enabled(self.context, parent):
            return False

        # only allowed on documents
        if not IDocumentSchema.providedBy(self.context):
            return False

        # only allowed, when there already is a file
        if not self.context.file:
            return False

        # only allowed when the current user has checked out the document
        current_user_id = getSecurityManager().getUser().getId()
        manager = queryMultiAdapter((self.context, self.request),
                                    ICheckinCheckoutManager)

        if not manager or manager.checked_out() != current_user_id:
            return False

        # Content may provide data to the external editor ?
        portal = getToolByName(self.context, 'portal_url').getPortalObject()
        return not not portal.externalEditLink_(self.context)
 def isWebdavEnabled(self):
     """
     """
     #
     if not webdav_enabled(self.context, aq_parent(aq_inner(self.context))):
         return False
     #
     return True
Beispiel #4
0
 def isWebdavEnabled(self):
     """
     """
     #
     if not webdav_enabled(self.context, aq_parent(aq_inner(self.context))):
         return False
     #
     return True
Beispiel #5
0
#
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import webdav_enabled

portal = getToolByName(context, 'portal_url').getPortalObject()
mtool = getToolByName(portal, 'portal_membership')

if mtool.isAnonymousUser():
    return False

# Temporary content cannot be changed through EE (raises AttributeError)
portal_factory = getToolByName(portal, 'portal_factory')
if portal_factory.isTemporary(context):
    return False

# Check if the member property
member = mtool.getAuthenticatedMember()
if not member.getProperty('ext_editor', False):
    return False

if not webdav_enabled(context, container):
    return False

# Object not locked ?
# note: you may comment out those two lines if you prefer to let the user to borrow the lock
if context.wl_isLocked():
    return False

# Content may provide data to the external editor ?
return not not portal.externalEditLink_(context)
#
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import webdav_enabled

portal = getToolByName(context, 'portal_url').getPortalObject()
mtool = getToolByName(portal, 'portal_membership')

if mtool.isAnonymousUser():
    return False

# Temporary content cannot be changed through EE (raises AttributeError)
portal_factory = getToolByName(portal, 'portal_factory')
if portal_factory.isTemporary(context):
    return False

if not webdav_enabled(context, container):
    return False

# Object not locked ?
# note: you may comment out those two lines if you prefer to let the user to borrow the lock
if context.wl_isLocked():
    return False

allowed_types = [
    'opengever.document.document',
    ]
if context.portal_type not in allowed_types:
    return False

# document must contain data
if context.portal_type == 'opengever.document.document':