app/soc/views/helper/access.py
changeset 1318 3f41f33a4ad2
parent 1315 7c58f5cdd5b8
child 1334 5009b63c247a
equal deleted inserted replaced
1317:fad74cf4e5da 1318:3f41f33a4ad2
   109     'This request cannot be accepted (it is either completed or denied).')
   109     'This request cannot be accepted (it is either completed or denied).')
   110 
   110 
   111 DEF_SCOPE_INACTIVE_MSG = ugettext(
   111 DEF_SCOPE_INACTIVE_MSG = ugettext(
   112     'The scope for this request is not active.')
   112     'The scope for this request is not active.')
   113 
   113 
       
   114 DEF_NO_LIST_ACCESS_MSG = ugettext(
       
   115     'You do not have the required rights to list documents for this scope and prefix.')
       
   116 
   114 DEF_PAGE_DENIED_MSG = ugettext(
   117 DEF_PAGE_DENIED_MSG = ugettext(
   115     'Access to this page has been restricted')
   118     'Access to this page has been restricted')
   116 
   119 
   117 DEF_PREFIX_NOT_IN_ARGS_MSG = ugettext(
   120 DEF_PREFIX_NOT_IN_ARGS_MSG = ugettext(
   118     'A required GET url argument ("prefix") was not specified')
   121     'A required GET url argument ("prefix") was not specified')
   947 
   950 
   948     self.checkMembership('write', document.prefix,
   951     self.checkMembership('write', document.prefix,
   949                          document.write_access, django_args)
   952                          document.write_access, django_args)
   950 
   953 
   951   @allowDeveloper
   954   @allowDeveloper
       
   955   def checkDocumentList(self, django_args):
       
   956     """Checks whether the user is allowed to list documents.
       
   957     """
       
   958 
       
   959     filter = django_args['filter']
       
   960 
       
   961     prefix = filter['prefix']
       
   962     scope_path = filter['scope_path']
       
   963 
       
   964     checker = rights_logic.Checker(prefix)
       
   965     roles = checker.getMembership('list')
       
   966 
       
   967     if not self.hasMembership(roles, filter):
       
   968       raise out_of_band.AccessViolation(message_fmt=DEF_NO_LIST_ACCESS_MSG)
       
   969 
       
   970   @allowDeveloper
   952   def checkDocumentPick(self, django_args):
   971   def checkDocumentPick(self, django_args):
   953     """Checks whether the user has access to the specified pick url.
   972     """Checks whether the user has access to the specified pick url.
   954 
   973 
   955     Will update the 'read_access' field of django_args['GET'].
   974     Will update the 'read_access' field of django_args['GET'].
   956     """
   975     """