Commit 2ac18d97 authored by louis kleverman's avatar louis kleverman

fixed issue

parent d0b585cb
......@@ -97,9 +97,9 @@ def update_processor_visibility(proc_id, prev_visibility, new_visibility,licence
resource = "processor:%s" % str(proc_id)
# log.debug("PASSED VALUES : id : %s prev_visibility : %s new_visibility : %s licenced : %s prev_licenced : %s" % (
# proc_id, prev_visibility, new_visibility,licenced,prev_licenced
# ))
log.debug("PASSED VALUES : id : %s prev_visibility : %s new_visibility : %s licenced : %s prev_licenced : %s" % (
proc_id, prev_visibility, new_visibility,licenced,prev_licenced
))
# log.debug(' --------CHECK %s (prev == %s and new == %s ' % (resource,prev_visibility,new_visibility) )
try:
......@@ -127,7 +127,7 @@ def update_processor_visibility(proc_id, prev_visibility, new_visibility,licence
"acl":acl
})
if(prev_visibility == 3 and new_visibility == 3 and licenced != prev_licenced):
if(prev_visibility == 3 and new_visibility == ProcessorVisibility.PUBLIC and licenced != prev_licenced):
log.debug(' ------------------ UPDATING LICENCED ACL ' + str(prev_licenced) +' =>' + str(licenced))
# get member id
......
......@@ -298,11 +298,12 @@ class ProcessorHandler(JsonApiHandler):
if 'visibility' in self.body:
# Only admins can LOCK or UNLOCK
if self.current_user.admin:
if 'licenced' in self.body:
licenced = self.body['licenced']
processor.licenced = self.body['licenced']
licenced = self.body['licenced'] if 'licenced' in self.body else processor.licenced
update_processor_visibility(processor.id, processor.visibility, self.body['visibility'],licenced, processor.licenced )
processor.visibility = self.body['visibility']
if 'licenced' in self.body:
processor.licenced = self.body['licenced']
else:
# NOT ADMIN
if 'licenced' in self.body: # YOU ARE NOT ALLOWED TO UPDATE THE LICENCE IF YOU'RE NOT ADMIN
......@@ -318,7 +319,7 @@ class ProcessorHandler(JsonApiHandler):
elif 'licenced' in self.body:
# Only admins can LICENCE or UNLICENCE
if self.current_user.admin:
# log.debug(' GOT IN CHANGE LICENCE TO %s ' % (self.body['licenced']) )
log.debug('LICENCED - GOT IN CHANGE LICENCE TO %s ' % (self.body['licenced']) )
update_processor_visibility(processor.id, processor.visibility, processor.visibility, self.body['licenced'], processor.licenced )
processor.licenced = self.body['licenced']
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment