Skip to content

Commit

Permalink
chore: fix new pylint naming error
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasNagy committed Jan 31, 2021
1 parent d919e22 commit bf49638
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions server/organization/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from inventory_item.updater import start_new_job
from user_account.permissions import IsInventoryManager, IsSystemAdmin, HasSameOrgInBody, PermissionFactory
from user_account.permissions import IsInventoryManager, IsSystemAdmin, HasSameOrgInBody, \
PermissionFactory

from .serializers import OrganizationSerializer
from .models import Organization
Expand All @@ -23,7 +24,7 @@ def get_permissions(self):
if self.action in ['retrieve', 'update', 'partial_update']:
permission_classes = factory.get_general_permissions([ValidateOrgMatchesUser])
else:
permission_classes = factory.baseSAPermissions
permission_classes = factory.base_sa_permissions
return [permission() for permission in permission_classes]

def create(self, request, *args, **kwargs):
Expand Down
8 changes: 4 additions & 4 deletions server/user_account/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

class PermissionFactory:
def __init__(self, request):
self.baseIMPermissions = [IsAuthenticated, IsInventoryManager, HasSameOrgInBody]
self.baseSAPermissions = [IsAuthenticated, IsSystemAdmin]
self.base_im_permissions = [IsAuthenticated, IsInventoryManager, HasSameOrgInBody]
self.base_sa_permissions = [IsAuthenticated, IsSystemAdmin]
self.request = request

def validate_is_sa(self):
Expand All @@ -14,10 +14,10 @@ def validate_is_sa(self):

def get_general_permissions(self, get_im_perms):
if self.validate_is_sa():
permission_classes = self.baseSAPermissions
permission_classes = self.base_sa_permissions
else:
# concatenate lists
permission_classes = self.baseIMPermissions + get_im_perms
permission_classes = self.base_im_permissions + get_im_perms
return permission_classes


Expand Down

0 comments on commit bf49638

Please sign in to comment.