app/soc/views/helper/access.py
changeset 1218 569a3fe9cb88
parent 1203 38225f2ad3a6
child 1223 aca77e2cc8f7
equal deleted inserted replaced
1217:aeabe6bed55b 1218:569a3fe9cb88
   659     if request_entity.scope.status == 'active':
   659     if request_entity.scope.status == 'active':
   660       return
   660       return
   661 
   661 
   662     raise out_of_band.AccessViolation(message_fmt=DEF_SCOPE_INACTIVE_MSG)
   662     raise out_of_band.AccessViolation(message_fmt=DEF_SCOPE_INACTIVE_MSG)
   663 
   663 
       
   664   @allowDeveloper
   664   @denySidebar
   665   @denySidebar
   665   @allowDeveloper
       
   666   def checkIsHostForProgram(self, django_args):
   666   def checkIsHostForProgram(self, django_args):
   667     """Checks if the user is a host for the specified program.
   667     """Checks if the user is a host for the specified program.
   668     """
   668     """
   669 
   669 
   670     key_fields = program_logic.getKeyFieldsFromFields(django_args)
   670     program = program_logic.getFromKeyFields(django_args)
   671     program = program_logic.getFromKeyFields(key_fields)
       
   672 
   671 
   673     if not program or program.status == 'invalid':
   672     if not program or program.status == 'invalid':
   674       self.deny(django_args)
   673       self.deny(django_args)
   675 
   674 
   676     new_args = {'scope_path': program.scope_path }
   675     new_args = {'scope_path': program.scope_path }
   875 
   874 
   876     Args:
   875     Args:
   877       django_args: a dictionary with django's arguments
   876       django_args: a dictionary with django's arguments
   878     """
   877     """
   879 
   878 
   880     key_fields = document_logic.getKeyFieldsFromFields(django_args)
   879     document = document_logic.getFromKeyFields(django_args)
   881     document = document_logic.getFromKeyFields(key_fields)
       
   882 
   880 
   883     self.checkMembership('write', document.prefix,
   881     self.checkMembership('write', document.prefix,
   884                          document.write_access, django_args)
   882                          document.write_access, django_args)
   885 
   883 
   886   def checkCanEditTimeline(self, django_args):
   884   def checkCanEditTimeline(self, django_args):