def get_authorized_groups_for_product(product, permission): user = get_current_user() if user.is_superuser or user_has_permission(user, product, permission): authorized_groups = get_authorized_groups(Permissions.Group_View) return Product_Group.objects.filter(product=product, group__in=authorized_groups).order_by('group__name').select_related('role') else: return None
def group(request): groups = get_authorized_groups(Permissions.Group_View) groups = GroupFilter(request.GET, queryset=groups) paged_groups = get_page_items(request, groups.qs, 25) add_breadcrumb(title="All Groups", top_level=True, request=request) return render(request, 'dojo/groups.html', { 'groups': paged_groups, 'filtered': groups, 'name': 'All Groups' })