Example #1
0
 def test__checkId_MethodAlias(self):
     test = self._makeOne('test')
     test._setPortalTypeName('Dummy Content 15')
     ttool = self.site._setObject('portal_types', TypesTool())
     ttool._setObject('Dummy Content 15', FTI(**FTIDATA_CMF15[0]))
     acl_users = self.site._setObject('acl_users', DummyUserFolder())
     test._checkId('view.html')
     newSecurityManager(None, acl_users.user_foo)
     self.assertRaises(BadRequest, test._checkId, 'view.html')
Example #2
0
 def test__checkId_MethodAlias(self):
     test = self._makeOne('test')
     test._setPortalTypeName('Dummy Content 15')
     ttool = self.site._setObject('portal_types', TypesTool())
     ttool._setObject('Dummy Content 15', FTI(**FTIDATA_CMF15[0]))
     acl_users = self.site._setObject('acl_users', DummyUserFolder())
     test._checkId('view.html')
     newSecurityManager(None, acl_users.user_foo)
     self.assertRaises(BadRequest, test._checkId, 'view.html')
Example #3
0
    def test__checkId_starting_with_dot(self):
        #
        # doted prefixed names at the root of the portal can be overriden
        #

        # Create a .foo at the root
        self.site._setObject('.foo', DummyContent('.foo'))

        # Create a sub-folder
        sub = self._makeOne('sub')

        # It should be possible to create another .foo object in the
        # sub-folder
        acl_users = self.site._setObject('acl_users', DummyUserFolder())
        newSecurityManager(None, acl_users.user_foo)

        self.assert_(sub.checkIdAvailable('.foo'))
Example #4
0
    def _initPolicyAndUser(self, a_lambda=None, v_lambda=None, c_lambda=None):
        def _promiscuous(*args, **kw):
            return 1

        if a_lambda is None:
            a_lambda = _promiscuous

        if v_lambda is None:
            v_lambda = _promiscuous

        if c_lambda is None:
            c_lambda = _promiscuous

        scp = _SensitiveSecurityPolicy(v_lambda, c_lambda)
        self._old_policy = SecurityManager.setSecurityPolicy(scp)

        newSecurityManager(None, _AllowedUser(a_lambda).__of__(self.root))
Example #5
0
    def test__checkId_starting_with_dot(self):
        #
        # doted prefixed names at the root of the portal can be overriden
        #

        # Create a .foo at the root
        self.site._setObject('.foo', DummyContent('.foo'))

        # Create a sub-folder
        sub = self._makeOne('sub')

        # It should be possible to create another .foo object in the
        # sub-folder
        acl_users = self.site._setObject('acl_users', DummyUserFolder())
        newSecurityManager(None, acl_users.user_foo)

        self.assert_(sub.checkIdAvailable('.foo'))
Example #6
0
    def _initPolicyAndUser( self
                          , a_lambda=None
                          , v_lambda=None
                          , c_lambda=None
                          ):
        def _promiscuous( *args, **kw ):
            return 1

        if a_lambda is None:
            a_lambda = _promiscuous

        if v_lambda is None:
            v_lambda = _promiscuous

        if c_lambda is None:
            c_lambda = _promiscuous

        scp = _SensitiveSecurityPolicy( v_lambda, c_lambda )
        self._old_policy = SecurityManager.setSecurityPolicy( scp )

        newSecurityManager( None
                          , _AllowedUser( a_lambda ).__of__( self.root ) )
Example #7
0
 def test__checkId_PortalRoot(self):
     test = self._makeOne('test')
     acl_users = self.site._setObject('acl_users', DummyUserFolder())
     test._checkId('acl_users')
     newSecurityManager(None, acl_users.user_foo)
     self.assertRaises(BadRequest, test._checkId, 'acl_users')
Example #8
0
 def test__checkId_PortalRoot(self):
     test = self._makeOne('test')
     acl_users = self.site._setObject('acl_users', DummyUserFolder())
     test._checkId('acl_users')
     newSecurityManager(None, acl_users.user_foo)
     self.assertRaises(BadRequest, test._checkId, 'acl_users')