app/soc/logic/cleaning.py
changeset 1320 a5913d46e97e
parent 1311 9836cfc0bb31
child 1333 c0ff6fc3192e
equal deleted inserted replaced
1319:042347748c45 1320:a5913d46e97e
   364   """Validates that the user has access to the ACL for the specified fields.
   364   """Validates that the user has access to the ACL for the specified fields.
   365   """
   365   """
   366 
   366 
   367   access_level = self.cleaned_data[field]
   367   access_level = self.cleaned_data[field]
   368   prefix = self.cleaned_data['prefix']
   368   prefix = self.cleaned_data['prefix']
       
   369   scope_path = self.cleaned_data['scope_path']
   369 
   370 
   370   params = view.getParams()
   371   params = view.getParams()
   371   rights = params['rights']
   372   rights = params['rights']
   372 
   373 
   373   user = user_logic.logic.getForCurrentAccount()
   374   user = user_logic.logic.getForCurrentAccount()
   375   rights.setCurrentUser(user.account, user)
   376   rights.setCurrentUser(user.account, user)
   376   checker = rights_logic.Checker(prefix)
   377   checker = rights_logic.Checker(prefix)
   377 
   378 
   378   roles = checker.getMembership(access_level)
   379   roles = checker.getMembership(access_level)
   379 
   380 
   380   if not rights.hasMembership(roles, {}):
   381   if not rights.hasMembership(roles, {'scope_path': scope_path}):
   381     self._errors[field] = ErrorList([DEF_NO_RIGHTS_FOR_ACL_MSG])
   382     self._errors[field] = ErrorList([DEF_NO_RIGHTS_FOR_ACL_MSG])
   382     del self.cleaned_data[field]
   383     del self.cleaned_data[field]