KLUK
This commit is contained in:
parent
09979ce792
commit
58cbe7bf68
|
|
@ -12,5 +12,7 @@ urlpatterns = [
|
|||
path('getsinglechat/<int:pk>', views.getsinglechat, name='api-getsinglechat'),
|
||||
path('chatnewmessage/', views.savenewchatmessage, name='api-savechatmessage'),
|
||||
# MIGRATION
|
||||
path('migrateagencyusers/<int:pk>', views.migrateAgencyUsers, name="api-migrateagencyusers")
|
||||
path('migrateagencyusers/<int:pk>', views.migrateAgencyUsers, name="api-migrateagencyusers"),
|
||||
path('test/', views.test, name="api-test"),
|
||||
|
||||
]
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
from django.shortcuts import redirect
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
#from rest_framework.permissions import IsAuthenticated # <-- Here
|
||||
|
|
@ -86,4 +87,10 @@ def migrateAgencyUsers(request, pk):
|
|||
for user in User.objects.filter(profile__agency=Ag):
|
||||
if(len(user.email) > 0 and len(user.first_name) > 0 and len(user.last_name) > 0):
|
||||
datapackage.update({str(user.pk) : {"userid" : user.email, "displayname" : user.first_name + " " + user.last_name}})
|
||||
return JsonResponse(datapackage)
|
||||
return JsonResponse(datapackage)
|
||||
|
||||
|
||||
from django.contrib.auth import login, logout
|
||||
@api_view(['GET', ])
|
||||
def test(request):
|
||||
return redirect('users-logout')
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
from django.shortcuts import render, redirect
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from channels_presence.models import Presence
|
||||
#from channels_presence.models import Presence
|
||||
from django.http import HttpResponseRedirect,HttpResponse, JsonResponse
|
||||
from django.contrib.auth.models import User
|
||||
from channels_presence.models import Room
|
||||
from channels_presence.models import Presence
|
||||
import channels.layers
|
||||
#from channels_presence.models import Room
|
||||
#from channels_presence.models import Presence
|
||||
#import channels.layers
|
||||
from django.utils import timezone
|
||||
from .models import ChatRoom, ChatMessage
|
||||
from .forms import ChatAddChatRoom, ChatUpdateChatRoom
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -2,11 +2,11 @@
|
|||
ASGI entrypoint. Configures Django and then runs the application
|
||||
defined in the ASGI_APPLICATION setting.
|
||||
"""
|
||||
|
||||
'''
|
||||
import os
|
||||
import django
|
||||
from channels.routing import get_default_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "digitaleagentur.settings")
|
||||
django.setup()
|
||||
application = get_default_application()
|
||||
'''
|
||||
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "digitaleagentur.settings")
|
||||
#django.setup()
|
||||
#application = get_default_application()
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
'''
|
||||
from channels.auth import AuthMiddlewareStack
|
||||
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||
import users.routing
|
||||
|
||||
|
||||
application = ProtocolTypeRouter({
|
||||
# Empty for now (http->django views is added by default)
|
||||
'websocket': AuthMiddlewareStack(
|
||||
|
|
@ -9,4 +11,6 @@ application = ProtocolTypeRouter({
|
|||
users.routing.websocket_urlpatterns
|
||||
)
|
||||
),
|
||||
})
|
||||
})
|
||||
|
||||
'''
|
||||
|
|
@ -92,8 +92,8 @@ INSTALLED_APPS = [
|
|||
'django_user_agents',
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
'channels',
|
||||
'channels_presence',
|
||||
#'channels',
|
||||
#'channels_presence',
|
||||
'simple_history',
|
||||
'captcha',
|
||||
'auditlog',
|
||||
|
|
@ -115,6 +115,8 @@ MIDDLEWARE = [
|
|||
|
||||
ROOT_URLCONF = 'digitaleagentur.urls'
|
||||
|
||||
CSRF_COOKIE_SECURE = False
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
|
|
@ -141,10 +143,11 @@ REST_FRAMEWORK = {
|
|||
#],
|
||||
}
|
||||
|
||||
#WSGI_APPLICATION = 'digitaleagentur.wsgi.application'
|
||||
WSGI_APPLICATION = 'digitaleagentur.wsgi.application'
|
||||
ASGI_APPLICATION = "digitaleagentur.routing.application"
|
||||
|
||||
|
||||
'''
|
||||
CHANNEL_LAYERS = {
|
||||
'default': {
|
||||
'BACKEND': 'channels_redis.core.RedisChannelLayer',
|
||||
|
|
@ -153,7 +156,7 @@ CHANNEL_LAYERS = {
|
|||
},
|
||||
},
|
||||
}
|
||||
|
||||
'''
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ urlpatterns = [
|
|||
path('newsga/<int:pk>', permission_required('users.modulenews')(views.NewsGoToArchiv), name="news-gotoarchiv"),
|
||||
|
||||
#path('standard/<int:pk>/area', views.StandardArea, name="standard-area"),
|
||||
#path('standard/<int:pk>/task', views.StandardTask, name="standard-task")
|
||||
#path('standard/<int:pk>/task', views.StandardTask, name="standard-task")
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from django.http.response import JsonResponse
|
||||
from django.shortcuts import render, redirect
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.views.generic import CreateView, ListView, UpdateView, DetailView, DeleteView
|
||||
|
|
@ -134,8 +135,3 @@ def NewsSingle(request, pk):
|
|||
|
||||
return render(request, 'news/news_single.html', context)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,4 +36,5 @@ xhtml2pdf==0.2.5
|
|||
django-simple-captcha==0.5.13
|
||||
auditlog3==1.0.1
|
||||
filetype==1.0.7
|
||||
Authlib==0.15.3
|
||||
Authlib==0.15.3
|
||||
xmltodict==0.12.0
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
import json
|
||||
from channels.generic.websocket import WebsocketConsumer
|
||||
from asgiref.sync import async_to_sync
|
||||
Binary file not shown.
|
|
@ -1,3 +1,5 @@
|
|||
import re
|
||||
from requests.api import request
|
||||
from authlib.integrations.base_client import OAuthError
|
||||
from authlib.integrations.django_client import OAuth
|
||||
from authlib.oauth2.rfc6749 import OAuth2Token
|
||||
|
|
@ -5,8 +7,9 @@ from django.shortcuts import redirect
|
|||
from django.utils.deprecation import MiddlewareMixin
|
||||
from users.models import Agency, Profile
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth import login
|
||||
from django.contrib.auth import login, logout
|
||||
from digitaleagentur import settings
|
||||
import requests, json
|
||||
|
||||
class OAuthMiddleware(MiddlewareMixin):
|
||||
|
||||
|
|
@ -33,7 +36,6 @@ class OAuthMiddleware(MiddlewareMixin):
|
|||
if not User.objects.filter(username = sub).exists():
|
||||
pr = Profile(user=None, agency=Agency.objects.get(pk=1))
|
||||
pr.save()
|
||||
print(pr)
|
||||
activeuser = User.objects.create(username=sub, profile=pr)
|
||||
pr.user = activeuser
|
||||
pr.save()
|
||||
|
|
@ -41,12 +43,20 @@ class OAuthMiddleware(MiddlewareMixin):
|
|||
activeuser = User.objects.get(username=sub)
|
||||
|
||||
if activeuser is not None:
|
||||
headers = {
|
||||
'Authorization': 'Bearer ' + request.session.get('token').get('access_token'),
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
data = {}
|
||||
#response = requests.get("http://localhost:8080/apps/agency/getcurrentuser", data=data, headers=headers)
|
||||
#print(response.text)
|
||||
login(request, activeuser)
|
||||
|
||||
sso_client = self.oauth.register(
|
||||
settings.OAUTH_CLIENT_NAME, overwrite=True, **settings.OAUTH_CLIENT, update_token=update_token
|
||||
)
|
||||
if request.path.startswith('/users/oauth/callback'):
|
||||
if request.path.startswith('/oauth/callback'):
|
||||
self.clear_session(request)
|
||||
request.session['token'] = sso_client.authorize_access_token(request)
|
||||
if self.get_current_user(sso_client, request) is not None:
|
||||
|
|
@ -81,8 +91,6 @@ class OAuthMiddleware(MiddlewareMixin):
|
|||
try:
|
||||
res = sso_client.get(settings.OAUTH_CLIENT['userinfo_endpoint'], token=OAuth2Token(token))
|
||||
if res.ok:
|
||||
print("OK WE ARE HERE!")
|
||||
print(res)
|
||||
#request.session['user'] = res.json()
|
||||
#request.session['user'] = res
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
'''
|
||||
from django.urls import re_path
|
||||
|
||||
from . import mainwebsocket
|
||||
|
|
@ -7,4 +8,5 @@ websocket_urlpatterns = [
|
|||
re_path(r'ws/groupchat/(?P<chatid>\w+)/$', mainwebsocket.GroupChat, name="ws-groupchat"),
|
||||
re_path(r'ws/appchat/(?P<creator>\w+)/(?P<single>\w+)/(?P<token>\w+)/$', mainwebsocket.UsersChat, name="ws-appchat"),
|
||||
re_path(r'ws/', mainwebsocket.UsersConsumer, name="ws-default"),
|
||||
]
|
||||
]
|
||||
'''
|
||||
|
|
@ -27,14 +27,24 @@ from asgiref.sync import async_to_sync
|
|||
from django.contrib.auth.decorators import login_required
|
||||
from datetime import timedelta
|
||||
from django.core.signals import request_started
|
||||
from channels_presence.models import Room
|
||||
from channels_presence.models import Presence
|
||||
from channels_presence.signals import presence_changed
|
||||
#from channels_presence.models import Room
|
||||
#from channels_presence.models import Presence
|
||||
#from channels_presence.signals import presence_changed
|
||||
from organizer.models import *
|
||||
from chat.models import ChatMessage
|
||||
|
||||
from digitaleagentur.utils import *
|
||||
|
||||
from django.core.signals import request_finished
|
||||
from django.dispatch import receiver
|
||||
|
||||
|
||||
@receiver(request_finished)
|
||||
def loginController(sender, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def loadingFreeDays(plz, year):
|
||||
# Getting land
|
||||
file_path = os.path.join(settings.STATIC_ROOT, 'users/extra/plz_short.csv')
|
||||
|
|
@ -544,7 +554,7 @@ def save_agjoin_prep(sender, instance, **kwargs):
|
|||
def receiver_function(sender, **kwargs):
|
||||
# DELETES ALL PRESENCE-OBJECTS LOWER THAN 15 MINUTES
|
||||
now_minus = datetime.datetime.now() - datetime.timedelta(minutes=2)
|
||||
Presence.objects.filter(last_seen__lt=now_minus).delete()
|
||||
#Presence.objects.filter(last_seen__lt=now_minus).delete()
|
||||
|
||||
users = User.objects.all()
|
||||
|
||||
|
|
@ -559,17 +569,19 @@ def receiver_function(sender, **kwargs):
|
|||
|
||||
|
||||
# PRESENCE CHANGED
|
||||
'''
|
||||
@receiver(signal=presence_changed)
|
||||
def update_presence_live(sender, **kwargs):
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)(str(kwargs["room"]), {'type' : 'update_presence_live'})
|
||||
|
||||
'''
|
||||
|
||||
'''
|
||||
|
||||
ABWESENHEIT BERECHNUNG UND SPEICHERUNG DER NEUEN URLAUBSTAGE - VERWEIS AUF timemenagement.views
|
||||
|
||||
'''
|
||||
|
||||
@receiver(signal=post_save, sender=Absence)
|
||||
def save_newabsence(sender, instance, **kwargs):
|
||||
post_save.disconnect(save_newabsence, sender=sender)
|
||||
|
|
@ -665,8 +677,8 @@ def save_newabsence(sender, instance, **kwargs):
|
|||
newnotification = UserNotification(touser=user, notificationtext="Neue Abwesenheit!", notificationtype="", elementid=instance.pk)
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Abwesenheit | Neue Abwesenheit für " + instance.user.first_name + " " + instance.user.last_name + " eingetragen!"})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Abwesenheit | Neue Abwesenheit für " + instance.user.first_name + " " + instance.user.last_name + " eingetragen!"})
|
||||
# Benutzer ist Vertreter
|
||||
if(user == instance.representator):
|
||||
if(user.usernotifications.absence_user_is_rep_mail):
|
||||
|
|
@ -676,8 +688,8 @@ def save_newabsence(sender, instance, **kwargs):
|
|||
newnotification = UserNotification(touser=user, notificationtext="Neue Abwesenheitsvertretung!", notificationtype="", elementid=instance.pk)
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Abwesenheit | Sie wurden als Vertreter für " + instance.user.first_name + " " + instance.user.last_name + " eingetragen!"})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Abwesenheit | Sie wurden als Vertreter für " + instance.user.first_name + " " + instance.user.last_name + " eingetragen!"})
|
||||
|
||||
# ABWESENHEIT GEÄNDERT
|
||||
else:
|
||||
|
|
@ -698,8 +710,8 @@ def save_newabsence(sender, instance, **kwargs):
|
|||
newnotification = UserNotification(touser=user, notificationtext="Aktualisierte Abwesenheit!", notificationtype="", elementid=instance.pk)
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Abwesenheit | Abwesenheit für " + instance.user.first_name + " " + instance.user.last_name + " wurde aktualisiert!"})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Abwesenheit | Abwesenheit für " + instance.user.first_name + " " + instance.user.last_name + " wurde aktualisiert!"})
|
||||
|
||||
# Benutzer ist Vertreter
|
||||
if(user == instance.representator):
|
||||
|
|
@ -710,8 +722,8 @@ def save_newabsence(sender, instance, **kwargs):
|
|||
newnotification = UserNotification(touser=user, notificationtext="Neue Abwesenheitsvertretung!", notificationtype="", elementid=instance.pk)
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Abwesenheit | Sie wurden als Vertreter für " + instance.user.first_name + " " + instance.user.last_name + " eingetragen!"})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Abwesenheit | Sie wurden als Vertreter für " + instance.user.first_name + " " + instance.user.last_name + " eingetragen!"})
|
||||
|
||||
else:
|
||||
# Kein Urlaubsanspruch, dennoch prüfen ob bereits bestehende Arbeitstage involviert sind
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ html h1 {
|
|||
}
|
||||
body{
|
||||
background-color: #f8f9fc;
|
||||
padding-top: 70px;
|
||||
}
|
||||
.modal-open {overflow-y: auto}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,33 +14,20 @@
|
|||
<!-- Custom fonts for this template-->
|
||||
|
||||
<link rel="canonical" href="https://app.digitale-agentur.com">
|
||||
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.js" type="text/javascript"></script>-->
|
||||
<script src="{%static 'users/js/jquery.js' %}" type="text/javascript"></script>
|
||||
|
||||
<link href="{%static 'users/vendor/fontawesome-free/css/all.min.css' %}" rel="stylesheet" type="text/css">
|
||||
|
||||
<!--<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">-->
|
||||
<link href="{%static 'users/css/google_font.css' %}" rel="stylesheet" type="text/css">
|
||||
|
||||
|
||||
<!--<link href="{%static 'users/css/bootstrap.min.css' %}" rel="stylesheet">-->
|
||||
<!--<link href='https://fonts.googleapis.com/css?family=Roboto&display=swap' rel='stylesheet' type='text/css'>-->
|
||||
<link href="{%static 'users/css/google_swap.css' %}" rel="stylesheet" type="text/css">
|
||||
<!-- include summernote css/js -->
|
||||
<!--<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.js"></script>-->
|
||||
|
||||
<!--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js"></script>-->
|
||||
<script src="{%static 'users/js/jquery_ui_min.js' %}" type="text/javascript"></script>
|
||||
<!-- <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>-->
|
||||
<!-- CROPPER -->
|
||||
<link href="{% static 'users/css/cropper.min.css' %}" type="text/css" rel="stylesheet">
|
||||
|
||||
|
||||
<!-- DATATABLES -->
|
||||
<!--<link href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css" type="text/css" rel="stylesheet">-->
|
||||
<link href="{% static 'users/css/jquery_datatables.css' %}" type="text/css" rel="stylesheet">
|
||||
<!--<link href="https://cdn.datatables.net/1.10.20/css/dataTables.bootstrap4.min.css" type="text/css" rel="stylesheet">-->
|
||||
<link href="{% static 'users/css/datatables_bs4.css' %}" type="text/css" rel="stylesheet">
|
||||
|
||||
<!-- Custom styles for this template-->
|
||||
|
|
@ -50,63 +37,32 @@
|
|||
|
||||
|
||||
<script src="{%static 'users/js/bs4_summernote.js' %}" type="text/javascript"></script>
|
||||
<!--<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/summernote@0.8.16/dist/summernote-bs4.js"></script>-->
|
||||
<link href="{% static 'users/css/bs4_summernote.css' %}" type="text/css" rel="stylesheet">
|
||||
<!--<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.16/dist/summernote.css" rel="stylesheet" type="text/css">-->
|
||||
<script type="text/javascript" src="{% static 'summernote/lang/summernote-de-DE.min.js' %}"></script>
|
||||
|
||||
<!-- Bootstrap core JavaScript-->
|
||||
<!--<script src="{%static 'users/vendor/jquery/jquery.min.js' %}"></script>-->
|
||||
<script type="text/javascript" src="{%static 'users/vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
|
||||
<!-- Core plugin JavaScript-->
|
||||
<script type="text/javascript" src="{%static 'users/vendor/jquery-easing/jquery.easing.min.js' %}"></script>
|
||||
<!-- DATABLES JS -->
|
||||
<!--<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>-->
|
||||
<script type="text/javascript" src="{%static 'users/js/jquery_dataTables.min.js' %}"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.22/dataRender/datetime.js"></script>
|
||||
|
||||
<!--<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js"></script>-->
|
||||
<script type="text/javascript" src="{%static 'users/js/bs4_dt.js' %}"></script>
|
||||
|
||||
<!-- Custom scripts for all pages-->
|
||||
<script type="text/javascript" src="{%static 'users/js/sb-admin-2.js' %}"></script>
|
||||
<!-- CUSTOM FONT -->
|
||||
<!--<link href="{% static 'users/css/custom.css' %}" rel="stylesheet">-->
|
||||
|
||||
|
||||
<!-- TABLE SORT -->
|
||||
<!--<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>-->
|
||||
|
||||
<!-- Page level plugins -->
|
||||
<!--<script src="vendor/chart.js/Chart.min.js"></script>-->
|
||||
|
||||
<!-- Page level custom scripts -->
|
||||
<!--<script src="js/demo/chart-area-demo.js"></script>-->
|
||||
<!--<script src="js/demo/chart-pie-demo.js"></script>-->
|
||||
|
||||
|
||||
<link href="{% static 'users/css/custom.css' %}" type="text/css" rel="stylesheet">
|
||||
|
||||
|
||||
|
||||
<!-- -->
|
||||
|
||||
|
||||
|
||||
|
||||
<link href="{% static 'users/css/custom.css' %}" type="text/css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Page Wrapper -->
|
||||
<div id="wrapper" >
|
||||
|
||||
|
||||
<!-- Sidebar -->
|
||||
<ul class=" bg-gray-900 sidebar sidebar-dark accordion fixed-top " style="overflow: all; height: 100vh;"id="accordionSidebar">
|
||||
|
||||
<!--<ul class=" bg-gray-900 sidebar sidebar-dark accordion fixed-top " style="overflow: all; height: 100vh;"id="accordionSidebar">
|
||||
-->
|
||||
{% if request.user.profile.agency.paymentplan == 0 and request.user.profile.agency.paymentstatus == 0 %}
|
||||
<style type="text/css">
|
||||
.trail_arrow {
|
||||
|
|
@ -128,231 +84,37 @@
|
|||
}
|
||||
|
||||
</style>
|
||||
<div class="trail_arrow">
|
||||
<!-- <div class="trail_arrow">
|
||||
{% getTrialDays request.user.profile.agency as trialdays %}
|
||||
<span class="trail_font"><nobr><b>TRIAL ({{trialdays}})</b></nobr>
|
||||
</span>
|
||||
</div>
|
||||
</div>-->
|
||||
{% endif %}
|
||||
|
||||
<!-- Sidebar - Brand -->
|
||||
<!--
|
||||
<a class="sidebar-brand d-flex align-items-center justify-content-center" href="{% url 'users-dashboard' %}">
|
||||
-->
|
||||
<!--<i class="fas fa-laptop"></i>
|
||||
<div class="sidebar-brand-text mx-2" style="">Digitale Agentur</div>-->
|
||||
<img src="{% static 'users/img/logo_neu.png' %}" width="100%">
|
||||
</a>
|
||||
<!--<img src="{% static 'users/img/logo_neu.png' %}" width="100%">-->
|
||||
<!--</a>-->
|
||||
<!-- Divider -->
|
||||
<hr class="sidebar-divider my-0">
|
||||
<!--<hr class="sidebar-divider my-0">-->
|
||||
|
||||
<!-- Nav Item - Dashboard -->
|
||||
{% if active_link == 'dashboard' %}
|
||||
<li class="nav-item active">
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
<a class="nav-link" href="{% url 'users-dashboard' %}">
|
||||
<i class="fas fa-fw fa-tachometer-alt"></i>
|
||||
<span>Dashboard</span></a>
|
||||
</li>
|
||||
|
||||
<!-- Divider -->
|
||||
<hr class="sidebar-divider">
|
||||
|
||||
<!-- Heading -->
|
||||
<div class="sidebar-heading">
|
||||
Agentur
|
||||
</div>
|
||||
|
||||
{% getUnpubStandards request.user as standardUnPubCount %}
|
||||
{% if active_link == 'standards' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
<a class="nav-link " href="{% url 'standards' %}" aria-expanded="true">
|
||||
<i class="fas fa-fw fa-lightbulb"></i>
|
||||
<span>Standards
|
||||
{% if standardUnPubCount > 0 %}
|
||||
<span class="badge badge-primary badge-counter" id="messcounter_badge" style="margin-right: 95px;"><span id="messcounter">{{standardUnPubCount}}</span></span>
|
||||
{% endif %}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% if active_link == 'orga' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
<a class="nav-link " href="{% url 'orga-main' %}" aria-expanded="true">
|
||||
<i class="fas fa-fw fa-sitemap"></i>
|
||||
<span>Organigramm</span>
|
||||
</a>
|
||||
</li>
|
||||
{% if request.user.profile.agency.module_organizer %}
|
||||
{% if active_link == 'organizer' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
<a class="nav-link " href="{% url 'organizer-management' %}" aria-expanded="true">
|
||||
<i class="fas fa-address-book"></i>
|
||||
<span>Organizer</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user.profile.agency.module_files and request.user|usergperm:"filesviewer" %}
|
||||
{% if active_link == 'cloud' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
<a class="nav-link " href="{% url 'cloud-main' 'first' %}" aria-expanded="true">
|
||||
<i class="fas fa-file"></i>
|
||||
<span>Dateien</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user.profile.agency.module_messages %}
|
||||
{% if active_link == 'messages' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
|
||||
{% getmesscounter request.user as gs %}
|
||||
<a class="nav-link " href="{% url 'messages' %}" aria-expanded="true">
|
||||
<i class="fas fa-envelope"></i>
|
||||
<span>Mitteilungen
|
||||
{% if gs > 0 %}
|
||||
<span class="badge badge-primary badge-counter" id="messcounter_badge" style="margin-right: 85px;"><span id="messcounter">{{gs}}</span></span>
|
||||
{% endif %}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user.profile.agency.module_chat %}
|
||||
<script type="text/javascript">preventUpdatePresLive = false;</script>
|
||||
{% if active_link == 'chat' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
|
||||
<a class="nav-link " href="{% url 'chat:chat-management' %}" aria-expanded="true">
|
||||
<i class="fas fa-comments"></i>
|
||||
<span>Chat <sup>BETA</sup></span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<!--
|
||||
|
||||
TASK: Counter einfügen, der in der Navi zeigt, wie viele ausstehende Anträge es gibt
|
||||
|
||||
-->
|
||||
|
||||
{% if request.user.profile.agency.module_timemanagement %}
|
||||
|
||||
{% getAbsenceAsks request.user as ab_ask %}
|
||||
|
||||
{% if active_link == 'abscence' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
<a class="nav-link " href="{% url 'tma-management' %}" aria-expanded="true">
|
||||
<i class="fas fa-umbrella-beach"></i>
|
||||
<!-- TASK: Anzahl ausstehender Anträge hier rein -->
|
||||
<span>Abwesenheiten
|
||||
{% if ab_ask > 0 and request.user|usergperm:"absencemanager" %}
|
||||
<span class="badge badge-primary badge-counter" id="messcounter_badge" style="margin-right: 62px;"><span id="messcounter">{{ab_ask}}</span></span>
|
||||
{% endif %}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user.usertime.usetime or request.user|usergperm:"usermanager" and request.user.profile.agency.module_timemanagement %}
|
||||
{% if active_link == 'timemanagement' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
<a class="nav-link " href="{% url 'tm-management' %}" aria-expanded="true">
|
||||
<i class="far fa-clock"></i>
|
||||
<span>Zeiterfassung</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user.profile.agency.module_recoverdir and request.user|has_group_byname:"Notfallhilfe" %}
|
||||
|
||||
{% if active_link == 'recoverdir' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
<a class="nav-link " href="{% url 'recoverdir' %}" aria-expanded="true">
|
||||
<i class="fas fa-medkit"></i>
|
||||
<span>Notfallhilfe</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<!-- Sidebar Toggler (Sidebar) -->
|
||||
<!--
|
||||
<div class="text-center d-none d-md-inline">
|
||||
<button class="rounded-circle border-0" id="sidebarToggle"></button>
|
||||
</div>
|
||||
-->
|
||||
<style scoped>
|
||||
#bottom_info {
|
||||
bottom: 0;
|
||||
}
|
||||
</style>
|
||||
<div id="bottom_info" style="z-index: -200">
|
||||
|
||||
|
||||
<hr class="sidebar-divider d-none d-md-block">
|
||||
{% if request.user.is_staff %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " href="{% url 'adm-main' %}" aria-expanded="true" style="margin-top: -15px">
|
||||
<i class="fas fa-user-shield"></i>
|
||||
<span>Adminoberfläche</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
{% if active_link == 'dasettings' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
<a class="nav-link " href="{% url 'dasettings' %}" aria-expanded="true" style="margin-top: -15px">
|
||||
<i class="fas fa-cog"></i>
|
||||
<span>Einstellungen</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% if active_link == 'support' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
<a class="nav-link " href="{% url 'supportda' %}" aria-expanded="true" style="margin-top: -15px">
|
||||
<i class="fas fa-question"></i>
|
||||
<span>Support</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<div style="" class="sidebar-heading ">
|
||||
<!--<div style="" class="sidebar-heading ">-->
|
||||
<!--<span style="float: left"><small>poweder by </small><img src="{% static 'users/img/VVE-Logo.png' %}" width="27%" class="mb-2"></span>-->
|
||||
<a style="color: #999; text-decoration: none;" href="https://digitale-agentur.com/datenschutz" target="_blank">Datenschutz</a><br />
|
||||
<!--<a style="color: #999; text-decoration: none;" href="https://digitale-agentur.com/datenschutz" target="_blank">Datenschutz</a><br />
|
||||
<a style="color: #999; text-decoration: none;" href="https://digitale-agentur.com/impressum" target="_blank">Impressum</a>
|
||||
<br />
|
||||
<br />
|
||||
|
|
@ -362,12 +124,12 @@
|
|||
<a href="https://www.myvve.de/" target="_blank"><img src="{% static 'users/img/VVE-Logo.png' %}" width="27%" class="mb-2"></a>
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
</ul>-->
|
||||
|
||||
<!-- End of Sidebar -->
|
||||
|
||||
<!-- Content Wrapper -->
|
||||
<style scoped>
|
||||
<!--<style scoped>
|
||||
.sidebar{
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
|
|
@ -413,17 +175,17 @@
|
|||
}*/
|
||||
</style>
|
||||
<div id="content-wrapper">
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<!-- Main Content -->
|
||||
<!-- Topbar -->
|
||||
<nav id="topnavbarmain" class="navbar navbar-expand navbar-light bg-white topbar fixed-top mb-4 static-top shadow" style="margin-left: 224px;">
|
||||
<nav id="topnavbarmain" class="navbar navbar-expand navbar-light bg-white topbar fixed-top mb-4 static-top shadow" style="">
|
||||
<!-- Sidebar Toggle (Topbar) -->
|
||||
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3" onclick="javascript:toggleSidebar()">
|
||||
<!--<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3" onclick="javascript:toggleSidebar()">
|
||||
<i class="fa fa-bars"></i>
|
||||
</button>
|
||||
</button>-->
|
||||
|
||||
<!-- Topbar Search -->
|
||||
<form class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
|
||||
|
|
@ -588,11 +350,11 @@
|
|||
|
||||
<!-- End of Topbar -->
|
||||
<!-- Begin Page Content -->
|
||||
<div class="container-fluid" >
|
||||
<div class="container-fluid" style="padding-top: 90px !important;" >
|
||||
|
||||
<div id="searchcontent" style="min-height: 100%; margin-top: 85px;">
|
||||
<div id="searchcontent" style="min-height: 100%; display: none;">
|
||||
</div>
|
||||
<div id="maincontent" style="min-height: 100%; margin-top: 85px;" >
|
||||
<div id="maincontent" style="min-height: 100%; " >
|
||||
<!-- MESSAGES -->
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
|
|
@ -610,26 +372,6 @@
|
|||
<div style="height: 300px"> </div>
|
||||
</div> <!-- End of Main Content CONTAINER FLUID-->
|
||||
<!-- End of Content Wrapper -->
|
||||
{% if active_link != 'chat' %}
|
||||
{% if request.user.profile.agency.module_chat %}
|
||||
<div id="chat_alluserscontent" style="position: fixed; bottom: 75px; right: 36px; z-index: 999;"></div>
|
||||
<button id="chatButton" class="btn btn-primary" style="position: fixed; right: 36px; bottom: 30px;"><i class="far fa-comments"></i></button>
|
||||
|
||||
<!-- CHATAREA -->
|
||||
<div id="dynamicchatwindow" class="col-4" style="position: fixed; bottom: 30px; right: 23px; display: none;z-index: 999;">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<span id="dynamicchatwindow_content"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
</script>
|
||||
{% endif %}
|
||||
<!-- CHATAREA END -->
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<!-- SUMMERNOTE ADDED CSS -->
|
||||
|
|
@ -642,21 +384,7 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
<!-- CHAT BUTTON -->
|
||||
|
||||
|
||||
<!-- End of Page Wrapper -->
|
||||
<!--
|
||||
<footer class="sticky-footer bg-white" style="width: 86.2%;position: absolute;
|
||||
bottom: 0; margin-top: 80px; padding-top: 20px; padding-bottom: 20px;
|
||||
">
|
||||
<div class="container my-auto">
|
||||
<div class="copyright text-center my-auto">
|
||||
<span>Copyright © digitale-agentur.com für <b>{{ user.profile.agency.name }}</b></span><br /><small>Version 0.0.5</small>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
<!-- Scroll to Top Button-->
|
||||
<a class="scroll-to-top rounded" href="#page-top">
|
||||
<i class="fas fa-angle-up"></i>
|
||||
|
|
@ -741,18 +469,11 @@ $(document).ready(function(){
|
|||
|
||||
|
||||
|
||||
if($( window ).width() < 768)
|
||||
{
|
||||
$("#accordionSidebar").addClass("toggled");
|
||||
$("#content-wrapper").css("margin-left" , "0px");
|
||||
|
||||
$("#topnavbarmain").css("margin-left" , "0px");
|
||||
|
||||
sidebar_hidden = false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Toggle the side navigation
|
||||
/*
|
||||
function toggleSidebar(){
|
||||
if(sidebar_hidden == false){
|
||||
$("#accordionSidebar").removeClass("toggled");
|
||||
|
|
@ -785,7 +506,7 @@ $( window ).resize(function() {
|
|||
$("#topnavbarmain").css("margin-left" , "224px");
|
||||
sidebar_hidden = true;
|
||||
}
|
||||
});
|
||||
});*/
|
||||
/*
|
||||
AJAX CALL FOR NOTIFICATIONS
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ Permissions definiert in models.py bei USERS und dann hier vor die View geschrie
|
|||
'''
|
||||
|
||||
urlpatterns = [
|
||||
path('nclog/<str:uid>', views.ncLogin, name='nclog'),
|
||||
path('', views.dashboard, name='users-dashboard'),
|
||||
path('logout/', auth_views.LogoutView.as_view(template_name='users/logout.html'), name='users-logout'),
|
||||
path('usersman/', permission_required('users.usermanager')(UsersManagement.as_view(template_name="users/users_management.html")), name='users-management'),
|
||||
|
|
@ -42,7 +43,7 @@ urlpatterns = [
|
|||
path('icspublicall/<slug:code>/<int:ag>', views.getICSFileExAll, name="geticsall"),
|
||||
path('updateuserorga/', views.UpdateUserOrga, name="update-user-orga"),
|
||||
# OAUTH
|
||||
path('oauth/callback', views.oauthCallBack, name="oauthcallback"),
|
||||
path('oauth/callback/', views.oauthCallBack, name="oauthcallback"),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ from message.models import Message
|
|||
from notificsys.models import UserNotification
|
||||
from organizer.models import AGContacts, AGPassword
|
||||
import sys, os
|
||||
from asgiref.sync import async_to_sync
|
||||
from channels_presence.models import Room
|
||||
from channels_presence.models import Presence
|
||||
import channels.layers
|
||||
#from asgiref.sync import async_to_sync
|
||||
#from channels_presence.models import Room
|
||||
#from channels_presence.models import Presence
|
||||
#import channels.layers
|
||||
from datetime import date, timedelta
|
||||
from timemanagement.models import Workday, Absence, Breaks
|
||||
import base64
|
||||
|
|
@ -69,7 +69,32 @@ from django.http import HttpResponse
|
|||
|
||||
# OAUTH
|
||||
def oauthCallBack(request):
|
||||
return None
|
||||
return redirect('users-dashboard')
|
||||
|
||||
# NC LOGIN
|
||||
'''
|
||||
|
||||
A User has to be logged in in NC. If yes, we check the user-status and retrieving the userId. If the logged user by this session is the same we want to see in Django, than the user will logged in.
|
||||
|
||||
Double-Check: Logged-Session from NC (session-id cannot be hacked cause it is serverside) and we check userId local, django and NC
|
||||
|
||||
'''
|
||||
import xmltodict, json
|
||||
import urllib.request as urllib2
|
||||
from django.contrib.auth import login, logout
|
||||
def ncLogin(request, uid):
|
||||
logout(request)
|
||||
nc_login_headers = {'Authorization' : 'Bearer ' + request.COOKIES['nc_session_id']}
|
||||
r = requests.get("http://localhost:8080/ocs/v2.php/apps/user_status/api/v1/user_status", headers=nc_login_headers)
|
||||
xpars = xmltodict.parse(r.text)
|
||||
js = json.dumps(xpars)
|
||||
final_json = json.loads(js)
|
||||
useridFromServer = final_json['ocs']['data']['userId']
|
||||
if(uid == urllib2.unquote(request.COOKIES['nc_username']) and useridFromServer == uid):
|
||||
login(request, User.objects.get(username=urllib2.unquote(request.COOKIES['nc_username'])))
|
||||
return redirect('users-dashboard')
|
||||
return redirect('login')
|
||||
|
||||
|
||||
def getICSFile(request, ag):
|
||||
if 'HTTP_AUTHORIZATION' in request.META:
|
||||
|
|
@ -723,23 +748,8 @@ def showUserLog(request, pk):
|
|||
return render(request, 'users/userlog_forbidden.html', context)
|
||||
|
||||
|
||||
|
||||
@login_required
|
||||
def dashboard(request):
|
||||
'''
|
||||
headers = {
|
||||
'Authorization': 'Bearer ' + request.session.get('token').get('access_token'),
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
|
||||
json_data = {}
|
||||
r = requests.get("http://localhost:8080/ocs/v1.php/cloud/users/" + request.session.get('token').get('user_id'), data=json_data, headers=headers)
|
||||
data = json.loads(r.text)
|
||||
#print(data.get('ocs').get('data').get('displayname'))
|
||||
request.user.first_name = data.get('ocs').get('data').get('displayname')
|
||||
'''
|
||||
|
||||
# UPDATE FUNCTIONS BY NEW MODEL-CHANGES FOR COPIEN SOME DATA
|
||||
toUpdate(request)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue