Author: david
Date: Mon Nov 1 15:29:22 2010
New Revision: 8755
Log:
Combine taxonomyAcl and termAcl like r8754.
Modified:
trunk/apps/qubit/modules/user/actions/editTermAclAction.class.php
Modified: trunk/apps/qubit/modules/user/actions/editTermAclAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/user/actions/editTermAclAction.class.php Mon Nov
1 15:23:20 2010 (r8754)
+++ trunk/apps/qubit/modules/user/actions/editTermAclAction.class.php Mon Nov
1 15:29:22 2010 (r8755)
@@ -78,36 +78,7 @@
protected function processForm()
{
- $this->processTermAcl('termAcl');
-
- if (isset($this->request->taxonomyAcl))
- {
- $this->processTermAcl('taxonomyAcl');
- }
- }
-
- public function execute($request)
- {
- parent::execute($request);
-
- if ($request->isMethod('post'))
- {
- $this->form->bind($request->getPostParameters());
-
- if ($this->form->isValid())
- {
- $this->processForm();
-
- $this->resource->save();
-
- $this->redirect(array($this->resource, 'module' => 'user', 'action' =>
'indexTermAcl'));
- }
- }
- }
-
- protected function processTermAcl($name)
- {
- foreach ($this->request[$name] as $key => $value)
+ 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))
@@ -122,15 +93,17 @@
$aclPermission->action = $action;
$aclPermission->grantDeny = (QubitAcl::GRANT == $value) ? 1 : 0;
- if ('taxonomyAcl' == $name)
- {
- // Taxonomy specific rules
- $aclPermission->objectId = QubitTerm::ROOT_ID;
- $aclPermission->setTaxonomy($resource);
- }
- else
+ switch ($resource->className)
{
- $aclPermission->objectId = $resource->id;
+ case 'QubitTaxonomy':
+ // Taxonomy specific rules
+ $aclPermission->objectId = QubitTerm::ROOT_ID;
+ $aclPermission->setTaxonomy($resource);
+
+ break;
+
+ default:
+ $aclPermission->objectId = $resource->id;
}
$this->resource->aclPermissions[] = $aclPermission;
@@ -153,4 +126,23 @@
}
}
}
+
+ public function execute($request)
+ {
+ parent::execute($request);
+
+ if ($request->isMethod('post'))
+ {
+ $this->form->bind($request->getPostParameters());
+
+ if ($this->form->isValid())
+ {
+ $this->processForm();
+
+ $this->resource->save();
+
+ $this->redirect(array($this->resource, 'module' => 'user', 'action' =>
'indexTermAcl'));
+ }
+ }
+ }
}
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.