本文整理匯總了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)