当前位置: 首页>>代码示例>>Python>>正文


Python service.is_project_owner函数代码示例

本文整理汇总了Python中taiga.permissions.service.is_project_owner函数的典型用法代码示例。如果您正苦于以下问题:Python is_project_owner函数的具体用法?Python is_project_owner怎么用?Python is_project_owner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_project_owner函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_serializer_class

    def get_serializer_class(self):
        use_admin_serializer = False

        if self.action == "create":
            use_admin_serializer = True

        if self.action == "retrieve":
            use_admin_serializer = permissions_service.is_project_owner(self.request.user, self.object.project)

        project_id = self.request.QUERY_PARAMS.get("project", None)
        if self.action == "list" and project_id is not None:
            project = get_object_or_404(models.Project, pk=project_id)
            use_admin_serializer = permissions_service.is_project_owner(self.request.user, project)

        if use_admin_serializer:
            return self.admin_serializer_class

        else:
            return self.serializer_class
开发者ID:ka7eh,项目名称:taiga-back,代码行数:19,代码来源:api.py

示例2: get_serializer_class

    def get_serializer_class(self):
        project_id = self.request.QUERY_PARAMS.get("project", None)
        if project_id is None:
            # Creation
            if self.request.method == 'POST':
                return self.admin_serializer_class

            return self.serializer_class

        project = get_object_or_404(models.Project, pk=project_id)
        if permissions_service.is_project_owner(self.request.user, project):
            return self.admin_serializer_class

        return self.serializer_class
开发者ID:bootinge,项目名称:taiga-back,代码行数:14,代码来源:api.py

示例3: get_i_am_owner

 def get_i_am_owner(self, obj):
     if "request" in self.context:
         return is_project_owner(self.context["request"].user, obj)
     return False
开发者ID:Sheshtawy,项目名称:taiga-back,代码行数:4,代码来源:serializers.py

示例4: check_permissions

 def check_permissions(self, request, view, obj=None):
     model = get_model_from_key(obj.key)
     pk = get_pk_from_key(obj.key)
     project = model.objects.get(pk=pk)
     return is_project_owner(request.user, project)
开发者ID:andrewchenshx,项目名称:taiga-back,代码行数:5,代码来源:permissions.py

示例5: check_permissions

 def check_permissions(self, request, view, obj=None):
     return is_project_owner(request.user, obj.webhook.project)
开发者ID:cubettech,项目名称:taiga-back,代码行数:2,代码来源:permissions.py


注:本文中的taiga.permissions.service.is_project_owner函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。