class WorkshopAttendanceViewset(viewsets.ModelViewSet): serializer_class = serializers.WorkshopAttendanceSerializer queryset = models.WorkshopAttendance.objects.order_by("pk") filter_backends = [DjangoFilterBackend] filterset_fields = ["attendee_user"] permission_classes = [ ActionIs("retrieve") & ( curriculum_permissions.IsWorkshopAttendee | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=_get_teams_from_workshop_attendance, ) ) | ActionIs("list") & ( core_permissions.IsCurrentUserInSpecificFilter("attendee_user") | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=core_permissions.get_teams_from_user_filter( "attendee_user" ), ) ) ]
class RepositoryViewset(viewsets.ModelViewSet): serializer_class = git_serializers.RepositorySerializer queryset = git_models.Repository.objects.all() permission_classes = [ ActionIs("retrieve") & (curriculum_permissions.IsRepoAttachedToProjectICanSee | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=_get_teams_from_repository, )) | ActionIs("list") & (permissions.IsAdminUser) ]
class RecruitProjectReviewViewset(viewsets.ModelViewSet): serializer_class = serializers.RecruitProjectReviewSerializer queryset = models.RecruitProjectReview.objects.order_by("-timestamp") filter_backends = [DjangoFilterBackend] filterset_fields = [ "status", "reviewer_user", "recruit_project", "recruit_project__recruit_users", ] permission_classes = [ ActionIs("list") & ( curriculum_permissions.IsCurrentUserInRecruitsForFilteredProject | curriculum_permissions.IsCurrentUserInReviewersForFilteredProject | core_permissions.IsCurrentUserInSpecificFilter("reviewer_user") | core_permissions.IsCurrentUserInSpecificFilter( "recruit_project__recruit_users" ) | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=core_permissions.get_teams_from_user_filter( "recruit_project__recruit_users" ), ) | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=core_permissions.get_teams_from_user_filter( "reviewer_user" ), ) | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=_get_teams_from_recruit_project_filter, ) ) | ActionIs("retrieve") & ( # curriculum_permissions.IsCurrentUserInRecruitsForFilteredProject # | curriculum_permissions.IsCurrentUserInReviewersForFilteredProject core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=_get_teams_from_recruit_project_review, ) ) ]
class TopicReviewViewset(viewsets.ModelViewSet): serializer_class = serializers.TopicReviewSerializer queryset = models.TopicReview.objects.order_by("pk") filter_backends = [DjangoFilterBackend] filterset_fields = [ "status", "reviewer_user", "topic_progress", "topic_progress__user", ] permission_classes = [ ActionIs("list") & ( curriculum_permissions.IsCurrentUserInUsersForFilteredTopicProgress | curriculum_permissions.IsCurrentUserInReviewersForFilteredTopicProgress | core_permissions.IsCurrentUserInSpecificFilter("reviewer_user") | core_permissions.IsCurrentUserInSpecificFilter("topic_progress__user") | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=core_permissions.get_teams_from_user_filter( "topic_progress__user" ), ) | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=core_permissions.get_teams_from_user_filter( "reviewer_user" ), ) | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=_get_teams_from_topic_progress_filter, ) ) | ActionIs("retrieve") & ( curriculum_permissions.IsCurrentUserInUsersForFilteredTopicProgress | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=_get_teams_from_topic_review, ) ) ]
class PullRequestViewSet(viewsets.ModelViewSet): serializer_class = git_serializers.PullRequestSerializer queryset = git_models.PullRequest.objects.order_by("-created_at") filter_backends = [DjangoFilterBackend] filterset_fields = ["repository"] permission_classes = [ ActionIs("list") & (curriculum_permissions.IsFilteredByRepoAttachedToProjectICanSee | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=_get_teams_from_repository_filter, )) ]
class ReviewTrustsViewSet(viewsets.ModelViewSet): permission_classes = [ permissions.IsAdminUser | ActionIs("list") & (core_permissions.IsCurrentUserInSpecificFilter("user") | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=core_permissions.get_teams_from_user_filter("user"), )) ] queryset = models.ReviewTrust.objects.order_by("user").all() serializer_class = serializers.ReviewTrustSerializer filter_backends = [DjangoFilterBackend] filterset_fields = ["user"]
class BurnDownSnapShotViewset(viewsets.ModelViewSet): permission_classes = [ permissions.IsAdminUser | ActionIs("list") & (IsCurrentUserInSpecificFilter("user__id") | core_permissions.HasObjectPermission( permissions=Team.PERMISSION_VIEW, get_objects=core_permissions.get_teams_from_user_filter( "user__id"), )) ] serializer_class = serializers.BurnDownSnapShotSerializer queryset = models.BurndownSnapshot.objects.order_by("-timestamp") filter_backends = [DjangoFilterBackend] filterset_fields = ["user__id", "timestamp"]