本文整理汇总了Python中ziggurat_foundations.models.services.user.UserService.resources_with_possible_perms方法的典型用法代码示例。如果您正苦于以下问题:Python UserService.resources_with_possible_perms方法的具体用法?Python UserService.resources_with_possible_perms怎么用?Python UserService.resources_with_possible_perms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ziggurat_foundations.models.services.user.UserService
的用法示例。
在下文中一共展示了UserService.resources_with_possible_perms方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_resources_with_possible_perms
# 需要导入模块: from ziggurat_foundations.models.services.user import UserService [as 别名]
# 或者: from ziggurat_foundations.models.services.user.UserService import resources_with_possible_perms [as 别名]
def test_resources_with_possible_perms(self, db_session):
self.set_up_user_group_and_perms(db_session)
resource = TestResourceB(
resource_id=3, resource_name="other", owner_user_id=self.user.id
)
self.user.resources.append(resource)
resource_g = TestResourceB(resource_id=4, resource_name="group owned")
self.group.resources.append(resource_g)
db_session.flush()
perms = UserService.resources_with_possible_perms(
self.user, db_session=db_session
)
second = [
PermissionTuple(
self.user, "foo_perm", "user", None, self.resource, False, True
),
PermissionTuple(
self.user, "group_perm", "group", self.group, self.resource, False, True
),
PermissionTuple(
self.user, "test_perm2", "user", None, self.resource, False, True
),
PermissionTuple(
self.user, ALL_PERMISSIONS, "user", None, resource, True, True
),
PermissionTuple(
self.user, ALL_PERMISSIONS, "group", self.group, resource_g, True, True
),
]
check_one_in_other(perms, second)
示例2: resources_with_possible_perms
# 需要导入模块: from ziggurat_foundations.models.services.user import UserService [as 别名]
# 或者: from ziggurat_foundations.models.services.user.UserService import resources_with_possible_perms [as 别名]
def resources_with_possible_perms(self, resource_ids=None,
resource_types=None,
db_session=None):
"""
.. deprecated:: 0.8
:param resource_ids:
:param resource_types:
:param db_session:
:return:
"""
db_session = get_db_session(db_session, self)
return UserService.resources_with_possible_perms(
self, resource_ids=resource_ids, resource_types=resource_types,
db_session=db_session)