Refactor the permissions app
Use the new AddRemove View for the Role's group and permissions views as well as the Group's role views. Convert the API to use viewsets. Add more tests. Add role created and edited events. Add event subscription support to roles. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
@@ -2,15 +2,12 @@ from __future__ import unicode_literals
|
||||
|
||||
import itertools
|
||||
import logging
|
||||
import warnings
|
||||
|
||||
from django.apps import apps
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.common.warnings import InterfaceWarning
|
||||
|
||||
from .exceptions import InvalidNamespace
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -49,6 +46,13 @@ class PermissionNamespace(object):
|
||||
self.permissions.append(permission)
|
||||
return permission
|
||||
|
||||
def get_permissions(self):
|
||||
result = {}
|
||||
for permission in self.permissions:
|
||||
result[permission.pk] = permission
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Permission(object):
|
||||
|
||||
Reference in New Issue
Block a user