def parse_update_user_permissions(self):
    perms = self.helper.get_all_permission_items()
    req_keys = self.request.POST.keys()
    response = ''
    for fieldname, email in self.request.POST.iteritems():
      if re.match(self.USER_PERMISSION_REGEX, fieldname):
        for perm in perms:
          key = "{0}-{1}".format(email, perm)
          if key in req_keys and \
            self.request.get('CURRENT-{0}'.format(key)) == 'False':
            if self.helper.add_user_permissions(email, perm):
              response += 'Enabling {0} for {1}. '.format(perm, email)
            else:
              response += 'Error enabling {0} for {1}. '.format(perm, email)
          elif key not in req_keys and \
            self.request.get('CURRENT-{0}'.format(key)) == 'True':
            if self.helper.remove_user_permissions(email, perm):
              response += 'Disabling {0} for {1}. '.format(perm, email)
            else:
              response += 'Error disabling {0} for {1}. '.format(perm, email)
    return response
Update authorization matrix from form submission.
dataset/ETHPy150Open AppScale/appscale/AppDashboard/dashboard.py/AuthorizePage.parse_update_user_permissions