Merge pull request #369 from alexbarcelo/always_create_permission

creation of Permission-per-Queue is done always
This commit is contained in:
Ross Poulton
2015-12-22 09:41:17 +11:00
3 changed files with 14 additions and 20 deletions

View File

@ -276,16 +276,15 @@ class Queue(models.Model):
self.email_box_port = 110
if not self.id:
# Always prepare the permission codename
# Prepare the permission codename and the permission
# (even if they are not needed with the current configuration)
basename = self.prepare_permission_name()
# Create the permission only if the flag is active
if helpdesk_settings.HELPDESK_ENABLE_PER_QUEUE_STAFF_PERMISSION:
Permission.objects.create(
name=_("Permission for queue: ") + self.title,
content_type=ContentType.objects.get(model="queue"),
codename=basename,
)
Permission.objects.create(
name=_("Permission for queue: ") + self.title,
content_type=ContentType.objects.get(model="queue"),
codename=basename,
)
super(Queue, self).save(*args, **kwargs)