mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
Prep 2.29 (#1024)
* django3, py39, lgtm, linting (#715) * IX-F Importer: ticket status change when posting re-occuring conflict to existing resolved ticket (#920) * fix recaptcha requirement for user creation in django-admin (#715) * IX-F Importer: fix command output buffering #967 * Drop dot1q_support field #903 * fix test (#967) * Add name, city, country to ixfac (GET operation) #166 * additional tests fir #166 * Allow IXP to trigger ix-f importer for their exchange #779 * add docker compose for dev * add selinux labels for mountpoints * fixes #1013: The process to permanently remove old soft-deleted network contacts pdb_delete_pocs raises a false ProtectedAction * fix api test * relock poetry * remove django_namespace_perms from installed apps * fix user permissios ui * remove remaining references to django namespace perms * linting * copy tox.ini * comment flake8 check until we figure out why it ignores configs from tox.ini * black format * poetry lock Co-authored-by: Stefan Pratter <stefan@20c.com>
This commit is contained in:
@@ -2,54 +2,6 @@
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
from django_namespace_perms.constants import PERM_CRUD, PERM_READ
|
||||
|
||||
|
||||
def add_permissions(apps, schema_editor):
|
||||
Group = apps.get_model("auth", "Group")
|
||||
Organization = apps.get_model("peeringdb_server", "Organization")
|
||||
GroupPermission = apps.get_model("django_namespace_perms", "GroupPermission")
|
||||
|
||||
guest_group = Group.objects.filter(id=settings.GUEST_GROUP_ID).first()
|
||||
user_group = Group.objects.filter(id=settings.USER_GROUP_ID).first()
|
||||
|
||||
namespace = (
|
||||
"peeringdb.organization.{org}.internetexchange"
|
||||
".*.ixf_ixp_member_list_url.{visible}"
|
||||
)
|
||||
|
||||
if guest_group:
|
||||
GroupPermission.objects.create(
|
||||
group=guest_group,
|
||||
namespace=namespace.format(org="*", visible="public"),
|
||||
permissions=PERM_READ,
|
||||
)
|
||||
|
||||
if user_group:
|
||||
GroupPermission.objects.create(
|
||||
group=user_group,
|
||||
namespace=namespace.format(org="*", visible="public"),
|
||||
permissions=PERM_READ,
|
||||
)
|
||||
|
||||
GroupPermission.objects.create(
|
||||
group=user_group,
|
||||
namespace=namespace.format(org="*", visible="users"),
|
||||
permissions=PERM_READ,
|
||||
)
|
||||
|
||||
for org in Organization.handleref.all():
|
||||
|
||||
GroupPermission.objects.create(
|
||||
group=Group.objects.get(name=f"org.{org.id}.admin"),
|
||||
namespace=namespace.format(org=org.id, visible="private"),
|
||||
permissions=PERM_CRUD,
|
||||
)
|
||||
GroupPermission.objects.create(
|
||||
group=Group.objects.get(name=f"org.{org.id}"),
|
||||
namespace=namespace.format(org=org.id, visible="private"),
|
||||
permissions=PERM_READ,
|
||||
)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
@@ -59,7 +11,6 @@ class Migration(migrations.Migration):
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(add_permissions),
|
||||
migrations.AddField(
|
||||
model_name="ixlan",
|
||||
name="ixf_ixp_member_list_url_visible",
|
||||
|
||||
Reference in New Issue
Block a user