示例#1
0
    def test_it_does_not_assign_create_permission_without_user_role(
            self, set_permissions, pyramid_request):
        set_permissions("acct:adminuser@foo", principals=["whatever"])

        context = GroupRoot(pyramid_request)

        assert not pyramid_request.has_permission("create", context)
示例#2
0
    def test_it_assigns_create_permission_with_user_role(
            self, set_permissions, pyramid_request):
        set_permissions("acct:adminuser@foo", principals=[role.User])

        context = GroupRoot(pyramid_request)

        assert pyramid_request.has_permission("create", context)
示例#3
0
文件: roots_test.py 项目: luke-rm/h
    def test_it_does_not_assign_create_permission_without_user_role(
            self, pyramid_config, pyramid_request):
        policy = pyramid.authorization.ACLAuthorizationPolicy()
        pyramid_config.testing_securitypolicy('acct:adminuser@foo',
                                              ['whatever'])
        pyramid_config.set_authorization_policy(policy)

        context = GroupRoot(pyramid_request)

        assert not pyramid_request.has_permission('create', context)
示例#4
0
    def test_it_assigns_create_permission_with_user_role(
            self, pyramid_config, pyramid_request):
        policy = pyramid.authorization.ACLAuthorizationPolicy()
        pyramid_config.testing_securitypolicy("acct:adminuser@foo",
                                              [role.User])
        pyramid_config.set_authorization_policy(policy)

        context = GroupRoot(pyramid_request)

        assert pyramid_request.has_permission("create", context)
示例#5
0
文件: roots_test.py 项目: luke-rm/h
 def group_factory(self, pyramid_request):
     return GroupRoot(pyramid_request)