mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Accomodate custom legacy permission in schema migration
This commit is contained in:
parent
c6e85970d4
commit
7a7634de2d
@ -16,7 +16,6 @@ class Migration(migrations.Migration):
|
|||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'permissions': (('run_script', 'Can run script'),),
|
|
||||||
'managed': False,
|
'managed': False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -564,9 +564,6 @@ class Script(models.Model):
|
|||||||
"""
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
permissions = (
|
|
||||||
('run_script', 'Can run script'),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -15,11 +15,11 @@ def replicate_permissions(apps, schema_editor):
|
|||||||
# are combined into a single ObjectPermission instance.
|
# are combined into a single ObjectPermission instance.
|
||||||
for perm in Permission.objects.all():
|
for perm in Permission.objects.all():
|
||||||
if perm.codename.split('_')[0] in ACTIONS:
|
if perm.codename.split('_')[0] in ACTIONS:
|
||||||
# Account for non-standard legacy permission names; e.g. napalm_read
|
|
||||||
action = perm.codename.split('_')[0]
|
action = perm.codename.split('_')[0]
|
||||||
elif perm.codename == 'activate_userkey':
|
elif perm.codename == 'activate_userkey':
|
||||||
# Rename activate_userkey permission
|
|
||||||
action = 'change'
|
action = 'change'
|
||||||
|
elif perm.codename == 'run_script':
|
||||||
|
action = 'run'
|
||||||
else:
|
else:
|
||||||
action = perm.codename
|
action = perm.codename
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user