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