當前位置: 首頁>>代碼示例>>Python>>正文


Python UserService.permissions方法代碼示例

本文整理匯總了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)
開發者ID:stevepiercy,項目名稱:ziggurat_foundations,代碼行數:11,代碼來源:user.py

示例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"
開發者ID:ergo,項目名稱:testscaffold,代碼行數:21,代碼來源:test_users_api.py

示例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)
開發者ID:ergo,項目名稱:ziggurat_foundations,代碼行數:12,代碼來源:test_permissions.py


注:本文中的ziggurat_foundations.models.services.user.UserService.permissions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。