コード例 #1
0
ファイル: test_schemaeditor.py プロジェクト: a25kk/stv2
    def afterSetUp(self):
        self.installDependencies()
        self.createBasicSetup()

        self.container._clear()
        self.user_member = User('testmember', '', ('Member', ), []).__of__(self.portal.acl_users)
        self.user_manager = User('testmanager', '', ('Manager', ), []).__of__(self.portal.acl_users)
        self.user_anonymous = nobody.__of__(self.portal.acl_users)

        self.container.atse_registerObject(self.target1)
コード例 #2
0
def bbox_value(obj, **kw):
    # Execute this as 'Anonymous'
    try:
        sm = getSecurityManager()
        newSecurityManager(None, nobody.__of__(obj.acl_users))
        ex = IExtent(obj)
        return tuple(shape(ex.extent).bounds)
    except:
        raise AttributeError
    finally:
        setSecurityManager(sm)
コード例 #3
0
def reprPt_value(obj, **kw):
    # Execute this as 'Anonymous'
    try:
        sm = getSecurityManager()
        newSecurityManager(None, nobody.__of__(obj.acl_users))
        pt = IRepresentativePoint(obj)
        return pt.coords, pt.precision
    except:
        raise AttributeError
    finally:
        setSecurityManager(sm)
コード例 #4
0
def zgeo_geometry_value(obj, **kw):
    # Execute this as 'Anonymous'
    try:
        sm = getSecurityManager()
        newSecurityManager(None, nobody.__of__(obj.acl_users))
        ex = IExtent(obj)
        return ex.extent
    except:
        raise AttributeError
    finally:
        setSecurityManager(sm)
コード例 #5
0
def reprPt_value(obj, **kw):
    # Execute this as 'Anonymous'
    try:
        sm = getSecurityManager()
        newSecurityManager(None, nobody.__of__(obj.acl_users))
        pt = IRepresentativePoint(obj)
        return pt.coords, pt.precision
    except:
        raise AttributeError
    finally:
        setSecurityManager(sm)
コード例 #6
0
def bbox_value(obj, **kw):
    # Execute this as 'Anonymous'
    try:
        sm = getSecurityManager()
        newSecurityManager(None, nobody.__of__(obj.acl_users))
        ex = IExtent(obj)
        return tuple(shape(ex.extent).bounds)
    except:
        raise AttributeError
    finally:
        setSecurityManager(sm)
コード例 #7
0
def zgeo_geometry_value(obj, **kw):
    # Execute this as 'Anonymous'
    try:
        sm = getSecurityManager()
        newSecurityManager(None, nobody.__of__(obj.acl_users))
        ex = IExtent(obj)
        return ex.extent
    except:
        raise AttributeError
    finally:
        setSecurityManager(sm)
コード例 #8
0
    def _createAnonymousUser(self, plugins):
        """ Allow IAnonymousUserFactoryPlugins to create or fall back.
        """
        factories = plugins.listPlugins(IAnonymousUserFactoryPlugin)

        for factory_id, factory in factories:

            anon = factory.createAnonymousUser()

            if anon is not None:
                return anon.__of__(self)

        return nobody.__of__(self)
コード例 #9
0
ファイル: PluggableAuthService.py プロジェクト: goschtl/zope
    def _createAnonymousUser( self, plugins ):

        """ Allow IAnonymousUserFactoryPlugins to create or fall back.
        """
        factories = plugins.listPlugins( IAnonymousUserFactoryPlugin )

        for factory_id, factory in factories:

            anon = factory.createAnonymousUser()

            if anon is not None:
                return anon.__of__( self )

        return nobody.__of__( self )
コード例 #10
0
def representative_point(obj):
    # Get a representative point as Anonymous."""
    sm = getSecurityManager()
    try:
        newSecurityManager(None, nobody.__of__(obj.acl_users))
        pt = IRepresentativePoint(obj)
        res = {'precision': pt.precision, 'coords': pt.coords}
    except NotLocatedError:
        res = {'precision': 'unlocated', 'coords': None}
    except:
        log.warn("Failed to adapt %s in 'representative_point'", obj)
        res = None
    finally:
        setSecurityManager(sm)
    return res
コード例 #11
0
ファイル: geo.py プロジェクト: isawnyu/pleiades-geographer
def representative_point(obj):
    # Get a representative point as Anonymous."""
    sm = getSecurityManager()
    try:
        newSecurityManager(None, nobody.__of__(obj.acl_users))
        pt = IRepresentativePoint(obj)
        res = {'precision': pt.precision, 'coords': pt.coords}
    except NotLocatedError:
        res = {'precision': 'unlocated', 'coords': None}
    except:
        log.warn("Failed to adapt %s in 'representative_point'", obj)
        res = None
    finally:
        setSecurityManager(sm)
    return res
コード例 #12
0
def extent(obj):
    # "unlocated", "rough", "related", "precise"
    # Executed as anonymous to keep unpublished data out
    sm = getSecurityManager()
    try:
        newSecurityManager(None, nobody.__of__(obj.acl_users))
        ex = IExtent(obj)
        res = {'extent': ex.extent, 'precision': ex.precision}
    except NotLocatedError:
        res = {'extent': None, 'precision': 'unlocated'}
    except:
        log.warn("Failed to adapt %s in 'location_precision'", obj)
        res = None
    finally:
        setSecurityManager(sm)
    return res
コード例 #13
0
ファイル: geo.py プロジェクト: isawnyu/pleiades-geographer
def extent(obj):
    # "unlocated", "rough", "related", "precise"
    # Executed as anonymous to keep unpublished data out
    sm = getSecurityManager()
    try:
        newSecurityManager(None, nobody.__of__(obj.acl_users))
        ex = IExtent(obj)
        res = {'extent': ex.extent, 'precision': ex.precision}
    except NotLocatedError:
        res = {'extent': None, 'precision': 'unlocated'}
    except:
        log.warn("Failed to adapt %s in 'location_precision'", obj)
        res = None
    finally:
        setSecurityManager(sm)
    return res
コード例 #14
0
ファイル: dump.py プロジェクト: isawnyu/PleiadesEntity
def anonymous_user(site):
    sm = getSecurityManager()
    newSecurityManager(None, nobody.__of__(site.acl_users))
    yield
    setSecurityManager(sm)