protected function processForm() { foreach ($this->request->acl as $key => $value) { // If key has an underscore, then we are creating a new permission if (1 == preg_match('/([\\w]+)_(.*)/', $key, $matches)) { list($action, $uri) = array_slice($matches, 1, 2); $params = $this->context->routing->parse(Qubit::pathInfo($uri)); $resource = $params['_sf_route']->resource; if (QubitAcl::INHERIT != $value && isset(QubitAcl::$ACTIONS[$action])) { $aclPermission = new QubitAclPermission(); $aclPermission->action = $action; $aclPermission->grantDeny = QubitAcl::GRANT == $value ? 1 : 0; switch ($resource->className) { case 'QubitTaxonomy': // Taxonomy specific rules $aclPermission->objectId = QubitTerm::ROOT_ID; $aclPermission->setTaxonomy($resource); break; default: $aclPermission->objectId = $resource->id; } $this->resource->aclPermissions[] = $aclPermission; } } else { if (null !== ($aclPermission = QubitAclPermission::getById($key))) { if ($value == QubitAcl::INHERIT) { $aclPermission->delete(); } else { $aclPermission->grantDeny = QubitAcl::GRANT == $value ? 1 : 0; $this->resource->aclPermissions[] = $aclPermission; } } } } }