本文整理汇总了Python中permission.logics.AuthorPermissionLogic.has_perm方法的典型用法代码示例。如果您正苦于以下问题:Python AuthorPermissionLogic.has_perm方法的具体用法?Python AuthorPermissionLogic.has_perm怎么用?Python AuthorPermissionLogic.has_perm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类permission.logics.AuthorPermissionLogic
的用法示例。
在下文中一共展示了AuthorPermissionLogic.has_perm方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_has_perm_change_with_obj
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_change_with_obj(self):
permission_logic = AuthorPermissionLogic()
add_permission_logic(self.article.__class__, permission_logic)
self.assertFalse(
permission_logic.has_perm(self.user1, self.perm2, self.article))
示例2: test_has_perm_delete_without_obj
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_delete_without_obj(self):
permission_logic = AuthorPermissionLogic()
add_permission_logic(self.article.__class__, permission_logic)
self.assertTrue(permission_logic.has_perm(self.user1, self.perm3))
示例3: test_has_perm_delete_without_obj_with_anonymous
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_delete_without_obj_with_anonymous(self):
permission_logic = AuthorPermissionLogic()
add_permission_logic(self.article.__class__, permission_logic)
self.assertFalse(permission_logic.has_perm(self.anonymous, self.perm3))
示例4: test_has_perm_add_with_obj_author_non_any_no_change
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_add_with_obj_author_non_any_no_change(self):
permission_logic = AuthorPermissionLogic(any_permission=False,
change_permission=False)
add_permission_logic(self.article.__class__, permission_logic)
self.assertFalse(
permission_logic.has_perm(self.user2, self.perm1, self.article))
示例5: test_has_perm_delete_with_obj_non_any_no_delete
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_delete_with_obj_non_any_no_delete(self):
permission_logic = AuthorPermissionLogic(any_permission=False,
delete_permission=False)
add_permission_logic(self.article.__class__, permission_logic)
self.assertFalse(
permission_logic.has_perm(self.user2, self.perm3, self.article))
示例6: test_has_perm_add_with_obj_author
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_add_with_obj_author(self):
permission_logic = AuthorPermissionLogic()
add_permission_logic(self.article.__class__, permission_logic)
self.assertTrue(
permission_logic.has_perm(self.user2, self.perm1, self.article))
示例7: test_has_perm_delete_with_obj_author_diff_field_name
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_delete_with_obj_author_diff_field_name(self):
permission_logic = AuthorPermissionLogic(field_name='editor')
add_permission_logic(self.article.__class__, permission_logic)
self.assertFalse(
permission_logic.has_perm(self.user2, self.perm3, self.article))
示例8: test_has_perm_delete_with_obj_author
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_delete_with_obj_author(self):
permission_logic = AuthorPermissionLogic()
self.assertTrue(
permission_logic.has_perm(self.user2, self.perm3, self.article))
示例9: test_has_perm_add_with_obj_author_diff_field_name
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_add_with_obj_author_diff_field_name(self):
permission_logic = AuthorPermissionLogic(field_name='editor')
self.assertFalse(
permission_logic.has_perm(self.user2, self.perm1, self.article))
示例10: test_has_perm_delete_with_obj
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_delete_with_obj(self):
permission_logic = AuthorPermissionLogic()
self.assertFalse(
permission_logic.has_perm(self.user1, self.perm3, self.article))
示例11: test_has_perm_change_without_obj
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_change_without_obj(self):
permission_logic = AuthorPermissionLogic()
self.assertFalse(permission_logic.has_perm(self.user1, self.perm2))
示例12: test_has_perm_change_with_obj_author_non_any_no_delete
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_change_with_obj_author_non_any_no_delete(self):
permission_logic = AuthorPermissionLogic(any_permission=False,
delete_permission=False)
self.assertTrue(
permission_logic.has_perm(self.user2, self.perm2, self.article))
示例13: test_has_perm_delete_with_obj_non_any
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_delete_with_obj_non_any(self):
permission_logic = AuthorPermissionLogic(any_permission=False)
self.assertTrue(
permission_logic.has_perm(self.user2, self.perm3, self.article))
示例14: test_has_perm_add_with_obj_author_non_any
# 需要导入模块: from permission.logics import AuthorPermissionLogic [as 别名]
# 或者: from permission.logics.AuthorPermissionLogic import has_perm [as 别名]
def test_has_perm_add_with_obj_author_non_any(self):
permission_logic = AuthorPermissionLogic(any_permission=False)
self.assertFalse(
permission_logic.has_perm(self.user2, self.perm1, self.article))