本文整理汇总了Python中ziggurat_foundations.models.services.user.UserService.permissions方法的典型用法代码示例。如果您正苦于以下问题:Python UserService.permissions方法的具体用法?Python UserService.permissions怎么用?Python UserService.permissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ziggurat_foundations.models.services.user.UserService
的用法示例。
在下文中一共展示了UserService.permissions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: permissions
# 需要导入模块: from ziggurat_foundations.models.services.user import UserService [as 别名]
# 或者: from ziggurat_foundations.models.services.user.UserService import permissions [as 别名]
def permissions(self):
"""
.. deprecated:: 0.8
:return:
"""
db_session = get_db_session(None, self)
return UserService.permissions(self, db_session=db_session)
示例2: test_permission_add
# 需要导入模块: from ziggurat_foundations.models.services.user import UserService [as 别名]
# 或者: from ziggurat_foundations.models.services.user.UserService import permissions [as 别名]
def test_permission_add(self, full_app, sqla_session):
from ziggurat_foundations.models.services.user import UserService
with session_context(sqla_session) as session:
admin, token = create_admin(session)
user = create_user(
{"user_name": "testX", "email": "[email protected]"},
sqla_session=session,
)
url_path = "/api/0.1/users/{}/permissions".format(user.id)
headers = {str("x-testscaffold-auth-token"): str(token)}
permission = {"perm_name": "root_administration"}
permissions = UserService.permissions(user)
assert not list(permissions)
full_app.post_json(url_path, permission, status=200, headers=headers)
sqla_session.expire_all()
permissions = UserService.permissions(user)
assert permissions[0].perm_name == "root_administration"
示例3: test_user_permissions
# 需要导入模块: from ziggurat_foundations.models.services.user import UserService [as 别名]
# 或者: from ziggurat_foundations.models.services.user.UserService import permissions [as 别名]
def test_user_permissions(self, db_session):
created_user = add_user(db_session)
permissions = UserService.permissions(created_user, db_session=db_session)
expected = [
PermissionTuple(
created_user, "alter_users", "user", None, None, False, True
),
PermissionTuple(created_user, "root", "user", None, None, False, True),
]
check_one_in_other(permissions, expected)