예제 #1
0
def favorite_all(request, organization_slug):
    organization = get_object_or_404(Organization, slug=organization_slug)
    for project in organization.projects.all():
        if project.active and access.has_read_access(project, request.user):
            Favorite.setFavorite(1, project.id, request.user, True)
    return HttpResponseRedirect(
        reverse("organization_detail",
                kwargs={"organization_slug": organization_slug}))
예제 #2
0
def news_feed(context):
    user = context["user"]
    request = context["request"]
    if "organization" in context:
        organization = context["organization"]
        if organization.hasStaffAccess(user):
            # The user can see app projects in the org.
            news_items = NewsItem.objects.filter(project__organization=organization)
        else:
            # NOTE: We need to watch this query to make sure it performs ok.
            news_items = NewsItem.objects.filter(project__organization=organization, project__teams__members=user).distinct()
    else:
        project = context["project"]
        if access.has_read_access(project,user):
            news_items = NewsItem.objects.filter(project=project)
        else:
            news_items = []
        
    return {'newsitems':news_items,"request":request}
예제 #3
0
def news_feed(context):
    user = context["user"]
    request = context["request"]
    if "organization" in context:
        organization = context["organization"]
        if organization.hasStaffAccess(user):
            # The user can see app projects in the org.
            news_items = NewsItem.objects.filter(
                project__organization=organization)
        else:
            # NOTE: We need to watch this query to make sure it performs ok.
            news_items = NewsItem.objects.filter(
                project__organization=organization,
                project__teams__members=user).distinct()
    else:
        project = context["project"]
        if access.has_read_access(project, user):
            news_items = NewsItem.objects.filter(project=project)
        else:
            news_items = []

    return {'newsitems': news_items, "request": request}
예제 #4
0
 def render(self, context):
     if has_read_access(context[self.project], context["request"].user):
         output = self.nodelist.render(context)
         return output
     else:
         return ""
예제 #5
0
 def render(self, context):
     if has_read_access(context[self.project], context["request"].user):
         output = self.nodelist.render(context)
         return output
     else:
         return "" 
예제 #6
0
파일: views.py 프로젝트: henriquemc/ScrumDo
def favorite_all(request, organization_slug):
    organization = get_object_or_404(Organization, slug=organization_slug)
    for project in organization.projects.all():
        if project.active and access.has_read_access(project, request.user):
            Favorite.setFavorite(1, project.id, request.user, True)
    return HttpResponseRedirect(reverse("organization_detail", kwargs={"organization_slug": organization_slug}))