Skip to content

Commit

Permalink
Coding standard
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBirdie authored and TheBirdie committed Feb 11, 2016
1 parent 82a0aa4 commit f525302
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sigma_core/serializers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ def create(self, fields):
from sigma_core.models.cluster import Cluster
try:
request = self.context['request']
inputClusters = request.data.get('clusters')
input_clusters = request.data.get('clusters')
if request.user.is_sigma_admin():
fields['clusters'] = Cluster.objects.filter(pk__in=inputClusters).values_list('id', flat=True)
fields['clusters'] = Cluster.objects.filter(pk__in=input_clusters).values_list('id', flat=True)
else:
fields['clusters'] = GroupMember.objects.filter(user=request.user, group__in=inputClusters).values_list('group', flat=True)
fields['clusters'] = GroupMember.objects.filter(user=request.user, group__in=input_clusters).values_list('group', flat=True)
except ValueError:
raise serializers.ValidationError("Cluster list: bad format")
if inputClusters != list(fields['clusters']):
if input_clusters != list(fields['clusters']):
raise serializers.ValidationError("Cluster list: incorrect values")
return super().create(fields)

Expand Down

0 comments on commit f525302

Please sign in to comment.