|
From: <gem...@li...> - 2011-10-26 12:51:35
|
Revision: 144
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=144&view=rev
Author: mennodekker
Date: 2011-10-26 12:51:28 +0000 (Wed, 26 Oct 2011)
Log Message:
-----------
activated cache in Gems_Roles, and forced a rebuild of the acl on save in the RoleAction
Modified Paths:
--------------
trunk/library/classes/Gems/Default/RoleAction.php
trunk/library/classes/Gems/Roles.php
Modified: trunk/library/classes/Gems/Default/RoleAction.php
===================================================================
--- trunk/library/classes/Gems/Default/RoleAction.php 2011-10-26 11:58:13 UTC (rev 143)
+++ trunk/library/classes/Gems/Default/RoleAction.php 2011-10-26 12:51:28 UTC (rev 144)
@@ -46,6 +46,11 @@
*/
class Gems_Default_RoleAction extends Gems_Controller_BrowseEditAction
{
+ /**
+ * @var GemsEscort
+ */
+ public $escort;
+
protected function _showTable($caption, $data, $nested = false)
{
$table = MUtil_Html_TableElement::createArray($data, $caption, $nested);
@@ -107,6 +112,21 @@
}
/**
+ * As the ACL might have to be updated, rebuild the acl
+ *
+ * @param array $data
+ * @param type $isNew
+ * @return type
+ */
+ public function afterSave(array $data, $isNew)
+ {
+ $roles = $this->loader->getRoles($this->escort);
+ $roles->build();
+
+ return true;
+ }
+
+ /**
* Check the disabled (=inherited) privileges
*
* @param Gems_Form $form
Modified: trunk/library/classes/Gems/Roles.php
===================================================================
--- trunk/library/classes/Gems/Roles.php 2011-10-26 11:58:13 UTC (rev 143)
+++ trunk/library/classes/Gems/Roles.php 2011-10-26 12:51:28 UTC (rev 144)
@@ -241,13 +241,16 @@
private function save() {
if ($this->_cache instanceof Zend_Cache_Core) {
if (!$this->_cache->save($this->_acl, $this->_cacheid, array(), null))
- echo "MISLUKT!";
+ throw new Gems_Exception('Failed to save acl to cache');
}
}
public function setCache($cache) {
- if ($cache instanceof Zend_Cache_Core)
+ if ($cache instanceof Zend_Cache_Core) {
$this->_cache = $cache;
- }
+ } elseif ($cache instanceof GemsEscort) {
+ $this->_cache = $cache->cache;
+ }
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|