def test_permission_with_and_permission_set_02(self):
        Permission = create_permission(lambda: And(create_component(
            False), create_component(False), create_component(True)))

        permission = Permission()
        self.assertFalse(permission.has_permission(None, None))
        self.assertTrue(
            len(list(permission.global_permission_set().components)), 3)
示例#2
0
class RootBarPermissionsOrObjectPermissions(BaseComposedPermission):
    permission_set = lambda self: \
        And(AllowOnlyAuthenticated, Or(RootBarPermissionComponent, DjangoObjectPermissionComponent))
示例#3
0
class RootBarPermissionsOrAnonReadOnly(BaseComposedPermission):
    permission_set = lambda self: \
        And(AllowOnlyAuthenticated, RootBarPermissionComponent) \
        | And(AllowOnlySafeHttpMethod, AllowAll)
示例#4
0
class PerBarPermissionsOrObjectPermissionsOrAnonReadOnly(
        BaseComposedPermission):
    permission_set = lambda self: \
        And(AllowOnlyAuthenticated, Or(PerBarPermissionComponent, DjangoObjectPermissionComponent)) \
        | And(AllowOnlySafeHttpMethod, AllowAll)
示例#5
0
class PerBarPermissionsOrAuthedReadOnly(BaseComposedPermission):
    permission_set = lambda self: \
        And(AllowOnlyAuthenticated, Or(PerBarPermissionComponent, AllowOnlySafeHttpMethod))
示例#6
0
class PerBarPermissions(BaseComposedPermission):
    permission_set = lambda self: \
        And(AllowOnlyAuthenticated, PerBarPermissionComponent)
示例#7
0
class AristotlePermissions(BaseComposedPermision):

    global_permission_set = (
        lambda s: And(AllowOnlyAuthenticated, TokenPermissions))