From 80b20f529064758e60bbfc7c75ad99ef2a4fd353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 26 Nov 2024 20:05:49 +0100 Subject: [PATCH] =?UTF-8?q?Pr=C3=A1va=20v=20data/*=20a=20na=C4=8D=C3=ADtan?= =?UTF-8?q?=C3=A9=20pomoc=C3=AD=20./manage.py=20loaddata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy_v2/admin_org_prava.json | 622 ------------------ deploy_v2/full_redeploy.sh | 1 - make/init_local | 1 - .../commands/load_org_permissions.py | 30 - 4 files changed, 654 deletions(-) delete mode 100644 deploy_v2/admin_org_prava.json delete mode 100644 various/management/commands/load_org_permissions.py diff --git a/deploy_v2/admin_org_prava.json b/deploy_v2/admin_org_prava.json deleted file mode 100644 index c7fc8c7d..00000000 --- a/deploy_v2/admin_org_prava.json +++ /dev/null @@ -1,622 +0,0 @@ -[ - { - "codename": "org", - "ct_app_label": "auth", - "ct_model": "user" - }, - { - "codename": "add_flatpage", - "ct_app_label": "flatpages", - "ct_model": "flatpage" - }, - { - "codename": "change_flatpage", - "ct_app_label": "flatpages", - "ct_model": "flatpage" - }, - { - "codename": "delete_flatpage", - "ct_app_label": "flatpages", - "ct_model": "flatpage" - }, - { - "codename": "view_flatpage", - "ct_app_label": "flatpages", - "ct_model": "flatpage" - }, - { - "codename": "add_galerie", - "ct_app_label": "galerie", - "ct_model": "galerie" - }, - { - "codename": "change_galerie", - "ct_app_label": "galerie", - "ct_model": "galerie" - }, - { - "codename": "delete_galerie", - "ct_app_label": "galerie", - "ct_model": "galerie" - }, - { - "codename": "view_galerie", - "ct_app_label": "galerie", - "ct_model": "galerie" - }, - { - "codename": "add_obrazek", - "ct_app_label": "galerie", - "ct_model": "obrazek" - }, - { - "codename": "change_obrazek", - "ct_app_label": "galerie", - "ct_model": "obrazek" - }, - { - "codename": "delete_obrazek", - "ct_app_label": "galerie", - "ct_model": "obrazek" - }, - { - "codename": "view_obrazek", - "ct_app_label": "galerie", - "ct_model": "obrazek" - }, - { - "codename": "add_fotkaheader", - "ct_app_label": "header_fotky", - "ct_model": "fotkaheader" - }, - { - "codename": "change_fotkaheader", - "ct_app_label": "header_fotky", - "ct_model": "fotkaheader" - }, - { - "codename": "view_fotkaheader", - "ct_app_label": "header_fotky", - "ct_model": "fotkaheader" - }, - { - "codename": "add_fotkaurlvazba", - "ct_app_label": "header_fotky", - "ct_model": "fotkaurlvazba" - }, - { - "codename": "change_fotkaurlvazba", - "ct_app_label": "header_fotky", - "ct_model": "fotkaurlvazba" - }, - { - "codename": "view_fotkaurlvazba", - "ct_app_label": "header_fotky", - "ct_model": "fotkaurlvazba" - }, - { - "codename": "add_komentar", - "ct_app_label": "korektury", - "ct_model": "komentar" - }, - { - "codename": "change_komentar", - "ct_app_label": "korektury", - "ct_model": "komentar" - }, - { - "codename": "delete_komentar", - "ct_app_label": "korektury", - "ct_model": "komentar" - }, - { - "codename": "view_komentar", - "ct_app_label": "korektury", - "ct_model": "komentar" - }, - { - "codename": "add_korekturovanepdf", - "ct_app_label": "korektury", - "ct_model": "korekturovanepdf" - }, - { - "codename": "change_korekturovanepdf", - "ct_app_label": "korektury", - "ct_model": "korekturovanepdf" - }, - { - "codename": "delete_korekturovanepdf", - "ct_app_label": "korektury", - "ct_model": "korekturovanepdf" - }, - { - "codename": "view_korekturovanepdf", - "ct_app_label": "korektury", - "ct_model": "korekturovanepdf" - }, - { - "codename": "add_oprava", - "ct_app_label": "korektury", - "ct_model": "oprava" - }, - { - "codename": "change_oprava", - "ct_app_label": "korektury", - "ct_model": "oprava" - }, - { - "codename": "delete_oprava", - "ct_app_label": "korektury", - "ct_model": "oprava" - }, - { - "codename": "view_oprava", - "ct_app_label": "korektury", - "ct_model": "oprava" - }, - { - "codename": "add_hlasovani", - "ct_app_label": "prednasky", - "ct_model": "hlasovani" - }, - { - "codename": "change_hlasovani", - "ct_app_label": "prednasky", - "ct_model": "hlasovani" - }, - { - "codename": "delete_hlasovani", - "ct_app_label": "prednasky", - "ct_model": "hlasovani" - }, - { - "codename": "view_hlasovani", - "ct_app_label": "prednasky", - "ct_model": "hlasovani" - }, - { - "codename": "add_prednaska", - "ct_app_label": "prednasky", - "ct_model": "prednaska" - }, - { - "codename": "change_prednaska", - "ct_app_label": "prednasky", - "ct_model": "prednaska" - }, - { - "codename": "delete_prednaska", - "ct_app_label": "prednasky", - "ct_model": "prednaska" - }, - { - "codename": "view_prednaska", - "ct_app_label": "prednasky", - "ct_model": "prednaska" - }, - { - "codename": "add_seznam", - "ct_app_label": "prednasky", - "ct_model": "seznam" - }, - { - "codename": "change_seznam", - "ct_app_label": "prednasky", - "ct_model": "seznam" - }, - { - "codename": "delete_seznam", - "ct_app_label": "prednasky", - "ct_model": "seznam" - }, - { - "codename": "view_seznam", - "ct_app_label": "prednasky", - "ct_model": "seznam" - }, - { - "codename": "add_cislo", - "ct_app_label": "tvorba", - "ct_model": "cislo" - }, - { - "codename": "change_cislo", - "ct_app_label": "tvorba", - "ct_model": "cislo" - }, - { - "codename": "delete_cislo", - "ct_app_label": "tvorba", - "ct_model": "cislo" - }, - { - "codename": "view_cislo", - "ct_app_label": "tvorba", - "ct_model": "cislo" - }, - { - "codename": "add_clanek", - "ct_app_label": "tvorba", - "ct_model": "clanek" - }, - { - "codename": "change_clanek", - "ct_app_label": "tvorba", - "ct_model": "clanek" - }, - { - "codename": "delete_clanek", - "ct_app_label": "tvorba", - "ct_model": "clanek" - }, - { - "codename": "view_clanek", - "ct_app_label": "tvorba", - "ct_model": "clanek" - }, - { - "codename": "add_deadline", - "ct_app_label": "tvorba", - "ct_model": "deadline" - }, - { - "codename": "change_deadline", - "ct_app_label": "tvorba", - "ct_model": "deadline" - }, - { - "codename": "view_deadline", - "ct_app_label": "tvorba", - "ct_model": "deadline" - }, - { - "codename": "add_konfera", - "ct_app_label": "soustredeni", - "ct_model": "konfera" - }, - { - "codename": "change_konfera", - "ct_app_label": "soustredeni", - "ct_model": "konfera" - }, - { - "codename": "delete_konfera", - "ct_app_label": "soustredeni", - "ct_model": "konfera" - }, - { - "codename": "view_konfera", - "ct_app_label": "soustredeni", - "ct_model": "konfera" - }, - { - "codename": "add_konfery_ucastnici", - "ct_app_label": "soustredeni", - "ct_model": "konfery_ucastnici" - }, - { - "codename": "change_konfery_ucastnici", - "ct_app_label": "soustredeni", - "ct_model": "konfery_ucastnici" - }, - { - "codename": "delete_konfery_ucastnici", - "ct_app_label": "soustredeni", - "ct_model": "konfery_ucastnici" - }, - { - "codename": "view_konfery_ucastnici", - "ct_app_label": "soustredeni", - "ct_model": "konfery_ucastnici" - }, - { - "codename": "add_nastaveni", - "ct_app_label": "various", - "ct_model": "nastaveni" - }, - { - "codename": "change_nastaveni", - "ct_app_label": "various", - "ct_model": "nastaveni" - }, - { - "codename": "delete_nastaveni", - "ct_app_label": "various", - "ct_model": "nastaveni" - }, - { - "codename": "view_nastaveni", - "ct_app_label": "various", - "ct_model": "nastaveni" - }, - { - "codename": "add_novinky", - "ct_app_label": "novinky", - "ct_model": "novinky" - }, - { - "codename": "change_novinky", - "ct_app_label": "novinky", - "ct_model": "novinky" - }, - { - "codename": "delete_novinky", - "ct_app_label": "novinky", - "ct_model": "novinky" - }, - { - "codename": "view_novinky", - "ct_app_label": "novinky", - "ct_model": "novinky" - }, - { - "codename": "change_organizator", - "ct_app_label": "personalni", - "ct_model": "organizator" - }, - { - "codename": "view_organizator", - "ct_app_label": "personalni", - "ct_model": "organizator" - }, - { - "codename": "change_osoba", - "ct_app_label": "personalni", - "ct_model": "osoba" - }, - { - "codename": "view_osoba", - "ct_app_label": "personalni", - "ct_model": "osoba" - }, - { - "codename": "add_pohadka", - "ct_app_label": "tvorba", - "ct_model": "pohadka" - }, - { - "codename": "change_pohadka", - "ct_app_label": "tvorba", - "ct_model": "pohadka" - }, - { - "codename": "delete_pohadka", - "ct_app_label": "tvorba", - "ct_model": "pohadka" - }, - { - "codename": "view_pohadka", - "ct_app_label": "tvorba", - "ct_model": "pohadka" - }, - { - "codename": "add_prijemce", - "ct_app_label": "personalni", - "ct_model": "prijemce" - }, - { - "codename": "change_prijemce", - "ct_app_label": "personalni", - "ct_model": "prijemce" - }, - { - "codename": "delete_prijemce", - "ct_app_label": "personalni", - "ct_model": "prijemce" - }, - { - "codename": "view_prijemce", - "ct_app_label": "personalni", - "ct_model": "prijemce" - }, - { - "codename": "add_problem", - "ct_app_label": "tvorba", - "ct_model": "problem" - }, - { - "codename": "change_problem", - "ct_app_label": "tvorba", - "ct_model": "problem" - }, - { - "codename": "delete_problem", - "ct_app_label": "tvorba", - "ct_model": "problem" - }, - { - "codename": "view_problem", - "ct_app_label": "tvorba", - "ct_model": "problem" - }, - { - "codename": "change_resitel", - "ct_app_label": "personalni", - "ct_model": "resitel" - }, - { - "codename": "view_resitel", - "ct_app_label": "personalni", - "ct_model": "resitel" - }, - { - "codename": "add_rocnik", - "ct_app_label": "tvorba", - "ct_model": "rocnik" - }, - { - "codename": "change_rocnik", - "ct_app_label": "tvorba", - "ct_model": "rocnik" - }, - { - "codename": "delete_rocnik", - "ct_app_label": "tvorba", - "ct_model": "rocnik" - }, - { - "codename": "view_rocnik", - "ct_app_label": "tvorba", - "ct_model": "rocnik" - }, - { - "codename": "add_skola", - "ct_app_label": "personalni", - "ct_model": "skola" - }, - { - "codename": "change_skola", - "ct_app_label": "personalni", - "ct_model": "skola" - }, - { - "codename": "delete_skola", - "ct_app_label": "personalni", - "ct_model": "skola" - }, - { - "codename": "view_skola", - "ct_app_label": "personalni", - "ct_model": "skola" - }, - { - "codename": "add_soustredeni", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni" - }, - { - "codename": "change_soustredeni", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni" - }, - { - "codename": "delete_soustredeni", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni" - }, - { - "codename": "view_soustredeni", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni" - }, - { - "codename": "add_soustredeni_organizatori", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni_organizatori" - }, - { - "codename": "change_soustredeni_organizatori", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni_organizatori" - }, - { - "codename": "delete_soustredeni_organizatori", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni_organizatori" - }, - { - "codename": "view_soustredeni_organizatori", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni_organizatori" - }, - { - "codename": "add_soustredeni_ucastnici", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni_ucastnici" - }, - { - "codename": "change_soustredeni_ucastnici", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni_ucastnici" - }, - { - "codename": "delete_soustredeni_ucastnici", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni_ucastnici" - }, - { - "codename": "view_soustredeni_ucastnici", - "ct_app_label": "soustredeni", - "ct_model": "soustredeni_ucastnici" - }, - { - "codename": "add_tema", - "ct_app_label": "tvorba", - "ct_model": "tema" - }, - { - "codename": "change_tema", - "ct_app_label": "tvorba", - "ct_model": "tema" - }, - { - "codename": "delete_tema", - "ct_app_label": "tvorba", - "ct_model": "tema" - }, - { - "codename": "view_tema", - "ct_app_label": "tvorba", - "ct_model": "tema" - }, - { - "codename": "add_uloha", - "ct_app_label": "tvorba", - "ct_model": "uloha" - }, - { - "codename": "change_uloha", - "ct_app_label": "tvorba", - "ct_model": "uloha" - }, - { - "codename": "delete_uloha", - "ct_app_label": "tvorba", - "ct_model": "uloha" - }, - { - "codename": "view_uloha", - "ct_app_label": "tvorba", - "ct_model": "uloha" - }, - { - "codename": "add_tag", - "ct_app_label": "taggit", - "ct_model": "tag" - }, - { - "codename": "change_tag", - "ct_app_label": "taggit", - "ct_model": "tag" - }, - { - "codename": "delete_tag", - "ct_app_label": "taggit", - "ct_model": "tag" - }, - { - "codename": "view_tag", - "ct_app_label": "taggit", - "ct_model": "tag" - }, - { - "codename": "add_taggeditem", - "ct_app_label": "taggit", - "ct_model": "taggeditem" - }, - { - "codename": "change_taggeditem", - "ct_app_label": "taggit", - "ct_model": "taggeditem" - }, - { - "codename": "delete_taggeditem", - "ct_app_label": "taggit", - "ct_model": "taggeditem" - }, - { - "codename": "view_taggeditem", - "ct_app_label": "taggit", - "ct_model": "taggeditem" - } -] diff --git a/deploy_v2/full_redeploy.sh b/deploy_v2/full_redeploy.sh index cec9c15c..f050bb63 100644 --- a/deploy_v2/full_redeploy.sh +++ b/deploy_v2/full_redeploy.sh @@ -13,7 +13,6 @@ make install_venv make install deploy_v2/pre_migration.py make deploy_test -./manage.py load_org_permissions admin_org_prava.json ./manage.py loaddata data/* systemctl --user start mamweb-test.service ./manage.py generate_thumbnails diff --git a/make/init_local b/make/init_local index 76448a3c..90474f44 100755 --- a/make/init_local +++ b/make/init_local @@ -8,4 +8,3 @@ ensure_venv ./manage.py testdata ./manage.py loaddata data/* #make/sync_prod_flatpages -./manage.py load_org_permissions deploy_v2/admin_org_prava.json diff --git a/various/management/commands/load_org_permissions.py b/various/management/commands/load_org_permissions.py deleted file mode 100644 index 6b4f9e0a..00000000 --- a/various/management/commands/load_org_permissions.py +++ /dev/null @@ -1,30 +0,0 @@ -from django.core.management.base import BaseCommand -from django.contrib.sessions.models import Session -from django.contrib.auth.models import Group, Permission -from django.contrib.contenttypes.models import ContentType -from django.core.exceptions import ObjectDoesNotExist -import json -import argparse - -class Command(BaseCommand): - """ - - """ - def add_arguments(self, parser): - parser.add_argument('file', nargs=1, type=argparse.FileType('r', encoding='utf8')) - - - def handle(self, *args, **options): - try: - orgroup = Group.objects.get(name='org') - except ObjectDoesNotExist: - orgroup = Group(name='org') - orgroup.save() - permissions = json.load(options['file'][0]) - orgroup.permissions.clear() - for jp in permissions: - ct = ContentType.objects.get(app_label = jp['ct_app_label'], model = jp['ct_model']) - perm = Permission.objects.get(content_type = ct, codename = jp['codename']) - orgroup.permissions.add(perm) - orgroup.save() -