Quellcode durchsuchen

Automatic creation of lists with tickets moved to the sharix-open repository

TonyKurts vor 1 Monat
Ursprung
Commit
9de87fa049
2 geänderte Dateien mit 44 neuen und 3 gelöschten Zeilen
  1. 1 1
      sharix_admin/apps.py
  2. 43 2
      sharix_admin/signals.py

+ 1 - 1
sharix_admin/apps.py

@@ -4,7 +4,7 @@ from django.apps import AppConfig
 class ShariXAdminConfig(AppConfig):
     default_auto_field = 'django.db.models.BigAutoField'
     name = 'sharix_admin'
-    verbose_name = "SHARIX_OPEN"
+    verbose_name = "ShariX Open"
 
     def ready(self):
        import sharix_admin.signals

+ 43 - 2
sharix_admin/signals.py

@@ -2,10 +2,11 @@ from django.contrib.auth.models import Group
 from django.dispatch import receiver
 from django.db.models.signals import post_migrate
 
+from tickets.models import TicketList
+
 
-# Создание групп
 @receiver(post_migrate)
-def create_groups(sender, **kwargs):
+def create_initial_groups(sender, **kwargs):
     Group.objects.get_or_create(pk=21, name='METASERVICE-ADMIN')
     Group.objects.get_or_create(pk=22, name='METASERVICE-SUPERVISOR')
     Group.objects.get_or_create(pk=23, name='METASERVICE-SUPPORT')
@@ -21,3 +22,43 @@ def create_groups(sender, **kwargs):
     Group.objects.get_or_create(pk=61, name='GUEST')
 
 
+@receiver(post_migrate)
+def create_initial_ticket_lists(sender, **kwargs):
+    if sender.name == 'tickets':
+        # METASERVICE
+        ## ADMIN
+        TicketList.objects.get_or_create(pk=2101, name='Активация партнеров (NEG_REQUEST)', group=Group.objects.get(name='METASERVICE-ADMIN'))
+        TicketList.objects.get_or_create(pk=2102, name='Права в сервисе (ACCESS_REQUEST)', group=Group.objects.get(name='METASERVICE-ADMIN'))
+        TicketList.objects.get_or_create(pk=2103, name='Проверка документов (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-ADMIN'))
+
+        ## SUPERVISOR
+        TicketList.objects.get_or_create(pk=2201, name='Активность пользователей (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPERVISOR'))
+        TicketList.objects.get_or_create(pk=2202, name='Оперативный доступ (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPERVISOR'))
+        TicketList.objects.get_or_create(pk=2203, name='Оперативный доступ экстра (ACCESS_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPERVISOR'))
+        TicketList.objects.get_or_create(pk=2204, name='Права сервиса (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPERVISOR'))
+        TicketList.objects.get_or_create(pk=2205, name='Проверка документов (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPERVISOR'))
+
+        ## SUPPORT
+        TicketList.objects.get_or_create(pk=2301, name='Входящие обычные заявки (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPPORT'))
+        TicketList.objects.get_or_create(pk=2302, name='Заявки на услуги сервиса (SERVICE_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPPORT'))
+
+        ## TECHSUPPORT
+        TicketList.objects.get_or_create(pk=2401, name='Входящие технические заявки (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-TECHSUPPORT'))
+
+        # PARTNER
+        ## ADMIN
+        TicketList.objects.get_or_create(pk=3101, name='Документы исполнителей (ST_REQUEST)', group=Group.objects.get(name='PARTNER-ADMIN'))
+        TicketList.objects.get_or_create(pk=3102, name='Документы ресурсов (ST_REQUEST)', group=Group.objects.get(name='PARTNER-ADMIN'))
+        TicketList.objects.get_or_create(pk=3103, name='Права в партнерке (ACCESS_REQUEST)', group=Group.objects.get(name='PARTNER-ADMIN'))
+        
+        ## SUPERVISOR
+        TicketList.objects.get_or_create(pk=3201, name='Активность внутри партнера (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
+        TicketList.objects.get_or_create(pk=3202, name='Документы исполнителей (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
+        TicketList.objects.get_or_create(pk=3203, name='Документы ресурсов (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
+        TicketList.objects.get_or_create(pk=3204, name='Доступ внутри партнера (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
+        TicketList.objects.get_or_create(pk=3205, name='Оперативный доступ (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
+        TicketList.objects.get_or_create(pk=3206, name='Оперативный доступ экстра (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
+        TicketList.objects.get_or_create(pk=3207, name='Ручное подтверждение заявок (ACCESS-REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
+        
+        ## TECHSUPPORT
+        TicketList.objects.get_or_create(pk=3401, name='Входящие технические заявки (ST_REQUEST)', group=Group.objects.get(name='PARTNER-TECHSUPPORT'))