diff --git a/.gitignore b/.gitignore index 8499533..bab5860 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ media/agencydata/* -media/agencymain/* !media/agencymain/default.jpg +!media/agencymain/ag_default.jpg !media/agencymain/linkdefault.png digitaleagentur/__pycache__/* @@ -14,14 +14,6 @@ areas/migrations/* !areas/migrations/__init__.py areas/__pycache__/* -news/migrations/* -!news/migrations/__init__.py -news/__pycache__/* - -quicklinks/migrations/* -!quicklinks/migrations/__init__.py -quicklinks/__pycache__/* - standards/migrations/* !standards/migrations/__init__.py standards/__pycache__/* @@ -43,6 +35,14 @@ notificsys/migrations/* notificsys/__pycache__/* dasettings/migrations/* + +news/migrations/* +!news/migrations/__init__.py +news/__pycache__/* + +quicklinks/migrations/* +!quicklinks/migrations/__init__.py +quicklinks/__pycache__/* !dasettings/migrations/__init__.py dasettings/__pycache__/* diff --git a/cloud/templates/cloud/cloud_main.html b/cloud/templates/cloud/cloud_main.html index 208efbf..79cc29b 100644 --- a/cloud/templates/cloud/cloud_main.html +++ b/cloud/templates/cloud/cloud_main.html @@ -325,7 +325,7 @@ a.disabled { -
+
@@ -28,6 +28,23 @@ {% for ap in agpass %} + + + {% setbool False %} + + {% for passgrous in ap.visibleby.all %} + {% if user|has_group:passgrous.group.name %} + {% setbool True %} + {% endif %} + {% endfor %} + + {% if ap.visibleby.all|length == 0 %} + {% setbool True %} + {% endif %} + + {% getbool as groupchecker %} + + {% if groupchecker %} @@ -51,6 +68,7 @@ @@ -59,6 +77,10 @@ + {% else %} + + {% endif %} {% endfor %}
{{ap.name }} {{ap.link}}
+  {{ap.name}}
@@ -68,7 +90,94 @@
+ + + + diff --git a/organizer/views.py b/organizer/views.py index 4a9fd43..4832ff8 100644 --- a/organizer/views.py +++ b/organizer/views.py @@ -5,9 +5,11 @@ from .models import QuickLinks, AGContacts, AGPassword from .forms import OrganizerAddQlForm, OrganizerAddContact, OrganizerUpdateContact, AddAGPassword from django.contrib import messages from django.shortcuts import redirect -from django.http import HttpResponse, HttpResponseRedirect +from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.contrib.auth.decorators import login_required from django.urls import reverse_lazy +from users.models import AgencyGroup + # Create your views here. class OrganizerManagement(LoginRequiredMixin, ListView): @@ -18,7 +20,7 @@ class OrganizerManagement(LoginRequiredMixin, ListView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) quicklinks = QuickLinks.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('name') - context.update({'active_link' : 'organizer', 'quicklinks' : quicklinks, 'contacts' : AGContacts.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('last_name'), 'agpass' : AGPassword.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('name')}) + context.update({'active_link' : 'organizer', 'quicklinks' : quicklinks, 'contacts' : AGContacts.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('last_name'), 'agpass' : AGPassword.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('name'), 'agencygroups' : AgencyGroup.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('agencygroupname') }) return context class OrganizerAdd(LoginRequiredMixin, CreateView): @@ -193,4 +195,27 @@ def loaddefaultql(request): tempql = QuickLinks(agency=request.user.profile.agency, name=ele[0], link=ele[1]) tempql.save() return redirect("ql-addql") + elif request.GET["action"] == "loadpassg": + data = {} + agpass = list(AGPassword.objects.filter(pk=request.GET["passid"], agency=request.user.profile.agency)) + if(len(agpass) == 1): + agpass_ele = agpass[0] + groupsid = [] + for ag in agpass_ele.visibleby.all(): + groupsid.append({"id" : ag.pk}) + data = {'success' : True, 'passgroups' : groupsid} + else: + data = {'success' : False} + return JsonResponse(data) + elif request.GET["action"] == "changepassg": + groupid = request.GET.get('groupid') + workingpass = request.GET.get('workingpass') + value = request.GET.get('value') + if(value == "true"): + AGPassword.objects.get(pk=workingpass, agency=request.user.profile.agency).visibleby.add(AgencyGroup.objects.get(pk=groupid, agency=request.user.profile.agency)) + else: + AGPassword.objects.get(pk=workingpass, agency=request.user.profile.agency).visibleby.remove(AgencyGroup.objects.get(pk=groupid, agency=request.user.profile.agency)) + + data = {'success' : False} + return JsonResponse(data) return redirect("ql-addql") \ No newline at end of file diff --git a/standards/__pycache__/urls.cpython-38.pyc b/standards/__pycache__/urls.cpython-38.pyc index a2dd1f2..edc950c 100644 Binary files a/standards/__pycache__/urls.cpython-38.pyc and b/standards/__pycache__/urls.cpython-38.pyc differ diff --git a/users/templates/users/base.html b/users/templates/users/base.html index 8c31965..50de61f 100644 --- a/users/templates/users/base.html +++ b/users/templates/users/base.html @@ -538,4 +538,4 @@ $(window).click(function() { - \ No newline at end of file + \ No newline at end of file