public function addResources(Kwf_Acl $acl)
 {
     if (!$acl->has('kwc_shop')) {
         $acl->add(new Kwf_Acl_Resource_MenuDropdown('kwc_shop', array('text' => trlKwfStatic('Shop'), 'icon' => 'cart.png')), 'kwf_component_root');
     }
     $acl->add(new Kwf_Acl_Resource_ComponentClass_MenuUrl($this->_class, array('text' => trlKwfStatic('Vouchers'), 'icon' => 'application_view_list.png'), Kwc_Admin::getInstance($this->_class)->getControllerUrl('Vouchers')), 'kwc_shop');
 }
Esempio n. 2
0
 public function setUp()
 {
     parent::setUp('Kwf_Component_PagesController_WithCategories_Root');
     $acl = new Kwf_Acl();
     $this->_acl = $acl->getComponentAcl();
     $acl->addRole(new Zend_Acl_Role('test'));
     $this->_acl->allowComponent('test', null);
 }
Esempio n. 3
0
 public function setUp()
 {
     parent::setUp('Kwf_Component_Acl_AllowedComponents_Root');
     $acl = new Kwf_Acl();
     $this->_acl = $acl->getComponentAcl();
     $acl->addRole(new Zend_Acl_Role('special'));
     $this->_acl->allowComponent('special', 'Kwf_Component_Acl_AllowedComponents_Special');
 }
Esempio n. 4
0
 public function setUp()
 {
     parent::setUp('Kwf_Component_Acl_Root');
     $acl = new Kwf_Acl();
     $this->_acl = $acl->getComponentAcl();
     $acl->addRole(new Kwf_Acl_Role('test', 'MainRole'));
     $acl->addRole(new Kwf_Acl_Role_Additional('testsub', 'SubRole', 'test'));
 }
Esempio n. 5
0
 public function testKwcAcl()
 {
     $acl = new Kwf_Acl();
     $acl->add(new Zend_Acl_Resource('misc'));
     $acl->allow(null, 'misc');
     $config = $acl->getMenuConfig(null);
     $this->assertEquals(1, count($config));
     $this->assertEquals('url', $config[0]['type']);
 }
 public function testBelowZendResourceGoesToParent()
 {
     $acl = new Kwf_Acl();
     $acl->add(new Zend_Acl_Resource('foo'));
     $acl->add(new Kwf_Acl_Resource_MenuUrl('misc_languages', array('text' => 'Sprachen', 'icon' => 'comment.png'), '/admin/misc/languages'), 'foo');
     $acl->allow(null, 'foo');
     $config = $acl->getMenuConfig(null);
     $this->assertEquals(1, count($config));
     $this->assertEquals('url', $config[0]['type']);
 }
Esempio n. 7
0
 public function setUp()
 {
     parent::setUp('Kwf_Component_PagesController_PagesGeneratorActions_Root');
     $acl = new Kwf_Acl();
     $this->_acl = $acl->getComponentAcl();
     $acl->addRole(new Zend_Acl_Role('test'));
     $this->_acl->allowComponent('test', null);
     $acl->addRole(new Zend_Acl_Role('special'));
     $this->_acl->allowComponent('special', 'Kwf_Component_PagesController_PagesGeneratorActions_SpecialComponent');
     $this->_acl->allowComponent('special', 'Kwf_Component_PagesController_PagesGeneratorActions_SpecialWithoutEditComponent');
 }
 public function addResources(Kwf_Acl $acl)
 {
     $masterCls = $this->_getSetting('masterComponentClass');
     if (Kwc_Abstract::hasSetting($this->_class, 'componentNameShort')) {
         $name = Kwc_Abstract::getSetting($this->_class, 'componentNameShort');
     } else {
         $name = Kwc_Abstract::getSetting($this->_class, 'componentName');
     }
     $icon = Kwc_Abstract::getSetting($this->_class, 'componentIcon');
     // **** create dropdown
     $dropdownName = 'kwc_' . $masterCls;
     if (!$acl->has($dropdownName)) {
         $acl->addResource(new Kwf_Acl_Resource_MenuDropdown($dropdownName, array('text' => $name, 'icon' => $icon)), $this->_getParentResource($acl));
     }
     // **** modify master component
     $masterComponents = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($masterCls, array('ignoreVisible' => true));
     //add language name to menu text
     foreach ($masterComponents as $c) {
         $resource = $acl->get('kwc_' . $c->dbId);
         $mc = $resource->getMenuConfig();
         $mc['text'] .= ' (' . $c->getBaseProperty('language') . ')';
         $resource->setMenuConfig($mc);
     }
     if (count($masterComponents) > 1) {
         //already in dropdown
     } else {
         if (count($masterComponents) == 1) {
             //just one, move into dropdown
             $c = $masterComponents[0];
             $resource = $acl->get('kwc_' . $c->dbId);
             $acl->remove($resource);
             $acl->addResource($resource, $dropdownName);
         }
     }
     // *** add own
     $components = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($this->_class, array('ignoreVisible' => true));
     foreach ($components as $c) {
         $t = $c->getTitle();
         if (!$t) {
             $t = $name;
         }
         if ($domain = $c->getParentByClass('Kwc_Root_DomainRoot_Domain_Component')) {
             $t .= " ({$domain->name})";
         }
         $t .= ' (' . $c->getBaseProperty('language') . ')';
         $acl->add(new Kwf_Acl_Resource_Component_MenuUrl($c, array('text' => $t, 'icon' => $icon)), $dropdownName);
     }
 }
 public function addResources(Kwf_Acl $acl)
 {
     if (!$acl->has('kwc_shop')) {
         $acl->add(new Kwf_Acl_Resource_MenuDropdown('kwc_shop', array('text' => trlKwf('Shop'), 'icon' => 'cart.png')), 'kwf_component_root');
     }
     $components = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($this->_class, array('ignoreVisible' => true));
     $icon = Kwc_Abstract::getSetting($this->_class, 'componentIcon');
     foreach ($components as $c) {
         $text = Kwc_Abstract::getSetting($this->_class, 'componentName');
         if (count($components) > 1) {
             if ($domain = $c->getParentByClass('Kwc_Root_DomainRoot_Domain_Component')) {
                 $text .= " ({$domain->name})";
             }
         }
         $acl->add(new Kwf_Acl_Resource_Component_MenuUrl($c, array('text' => $text, 'icon' => $icon), Kwc_Admin::getInstance($c->componentClass)->getControllerUrl('Orders') . '?componentId=' . $c->dbId), 'kwc_shop');
     }
 }
Esempio n. 10
0
 public function addResources(Kwf_Acl $acl)
 {
     $menuConfig = array('icon' => new Kwf_Asset('group.png'));
     $components = Kwf_Component_Data_Root::getInstance()->getComponentsByClass(Kwc_Abstract::getSetting($this->_class, 'subscribeToNewsletterClass'), array('ignoreVisible' => true));
     foreach ($components as $c) {
         $menuConfig['text'] = $this->_getMenuConfigText($c);
         if (count($components) > 1) {
             $subRoot = $c;
             while ($subRoot = $subRoot->parent) {
                 if (Kwc_Abstract::getFlag($subRoot->componentClass, 'subroot')) {
                     break;
                 }
             }
             if ($subRoot) {
                 $menuConfig['text'] .= ' (' . $subRoot->name . ')';
             }
         }
         $acl->add(new Kwc_Newsletter_Subscribe_Resource($this->_class . $c->dbId, $menuConfig, Kwc_Admin::getInstance($this->_class)->getControllerUrl('Recipients') . '?newsletterComponentId=' . $c->dbId, $this->_class, $c), $this->_getParentResource($acl, 'subscribe'));
     }
 }
Esempio n. 11
0
 public function addResources(Kwf_Acl $acl)
 {
     $menuConfig = array('icon' => new Kwf_Asset('package'));
     $components = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($this->_class, array('ignoreVisible' => true));
     foreach ($components as $c) {
         $menuConfig['text'] = $this->_getMenuConfigText($c, 'categories');
         if (count($components) > 1) {
             $subRoot = $c;
             while ($subRoot = $subRoot->parent) {
                 if (Kwc_Abstract::getFlag($subRoot->componentClass, 'subroot')) {
                     break;
                 }
             }
             if ($subRoot) {
                 $menuConfig['text'] .= ' (' . $subRoot->name . ')';
             }
         }
         $acl->add(new Kwf_Acl_Resource_Component_MenuUrl('kwc_' . $c->dbId . '-categories', $menuConfig, Kwc_Admin::getInstance($this->_class)->getControllerUrl('Categories') . '?componentId=' . $c->dbId, $c), $this->_getParentResource($acl, 'categories'));
     }
     parent::addResources($acl);
 }
Esempio n. 12
0
 public function addResources(Kwf_Acl $acl)
 {
     $icon = Kwc_Abstract::getSetting($this->_class, 'componentIcon');
     $menuConfig = array('icon' => $icon);
     $components = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($this->_class, array('ignoreVisible' => true));
     foreach ($components as $c) {
         $menuConfig['text'] = $this->_getMenuConfigText($c, 'newsletter');
         if (count($components) > 1) {
             $subRoot = $c;
             while ($subRoot = $subRoot->parent) {
                 if (Kwc_Abstract::getFlag($subRoot->componentClass, 'subroot')) {
                     break;
                 }
             }
             if ($subRoot) {
                 $menuConfig['text'] .= ' (' . $subRoot->name . ')';
             }
         }
         $acl->add(new Kwf_Acl_Resource_Component_MenuUrl($c, $menuConfig), $this->_getParentResource($acl, 'newsletter'));
     }
 }
Esempio n. 13
0
 public function addResources(Kwf_Acl $acl)
 {
     $components = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($this->_class, array('ignoreVisible' => true));
     if (Kwc_Abstract::hasSetting($this->_class, 'componentNameShort')) {
         $name = Kwc_Abstract::getSetting($this->_class, 'componentNameShort');
     } else {
         $name = Kwc_Abstract::getSetting($this->_class, 'componentName');
     }
     $icon = Kwc_Abstract::getSetting($this->_class, 'componentIcon');
     foreach ($components as $c) {
         $t = $c->getTitle();
         if (!$t && $c->getPage()) {
             $t = $c->getPage()->name;
         }
         if ($domain = $c->getParentByClass('Kwc_Root_DomainRoot_Domain_Component')) {
             $t .= " - {$domain->name}";
         }
         $t = $name . ' (' . $t . ')';
         $menuUrl = Kwc_Admin::getInstance($c->componentClass)->getControllerUrl('Enquiries') . '?componentId=' . $c->dbId;
         $acl->addResource(new Kwf_Acl_Resource_Component_MenuUrl($c, array('text' => $t, 'icon' => $icon), $menuUrl), 'kwf_enquiries_dropdown');
     }
 }
Esempio n. 14
0
 public function addResources(Kwf_Acl $acl)
 {
     $components = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($this->_class, array('ignoreVisible' => true));
     if (Kwc_Abstract::hasSetting($this->_class, 'componentNameShort')) {
         $name = Kwc_Abstract::getSetting($this->_class, 'componentNameShort');
     } else {
         $name = Kwc_Abstract::getSetting($this->_class, 'componentName');
     }
     $icon = Kwc_Abstract::getSetting($this->_class, 'componentIcon');
     if (count($components)) {
         $dropdownName = 'kwc_' . $this->_class;
         if (!$acl->has($dropdownName)) {
             $dropDown = new Kwf_Acl_Resource_MenuDropdown($dropdownName, array('text' => $name, 'icon' => $icon));
             $dropDown->setCollapseIfSingleChild(true);
             $acl->add($dropDown, $this->_getParentResource($acl));
         }
         foreach ($components as $c) {
             $t = $this->_getResourceText($c);
             $acl->add(new Kwf_Acl_Resource_Component_MenuUrl($c, array('text' => $t, 'icon' => $icon)), $dropdownName);
         }
     }
 }
Esempio n. 15
0
 public function offsetGet($index)
 {
     if ($index == 'db' && !parent::offsetExists($index)) {
         $v = Kwf_Setup::createDb();
         $this->offsetSet('db', $v);
         return $v;
     } else {
         if ($index == 'config' && !parent::offsetExists($index)) {
             $v = Kwf_Config_Web::getInstance();
             $this->offsetSet('config', $v);
             return $v;
         } else {
             if ($index == 'dao' && !parent::offsetExists($index)) {
                 $v = Kwf_Setup::createDao();
                 $this->offsetSet('dao', $v);
                 return $v;
             } else {
                 if ($index == 'acl' && !parent::offsetExists($index)) {
                     $v = Kwf_Acl::getInstance();
                     $this->offsetSet('acl', $v);
                     return $v;
                 } else {
                     if ($index == 'userModel' && !parent::offsetExists($index)) {
                         $v = self::get('config')->user->model;
                         if ($v) {
                             $v = Kwf_Model_Abstract::getInstance($v);
                         }
                         $this->offsetSet('userModel', $v);
                         return $v;
                     } else {
                         if ($index == 'trl' && !parent::offsetExists($index)) {
                             $v = Kwf_Trl::getInstance();
                             $this->offsetSet('trl', $v);
                             return $v;
                         }
                     }
                 }
             }
         }
     }
     return parent::offsetGet($index);
 }
Esempio n. 16
0
 private static function _clearComponentSettingsCache($componentClasses, $setting = null)
 {
     Kwf_Component_Abstract::resetSettingsCache();
     $settings = Kwf_Component_Settings::_getSettingsCached();
     $dependenciesChanged = false;
     $generatorssChanged = false;
     $dimensionsChanged = false;
     $menuConfigChanged = false;
     foreach ($componentClasses as $c) {
         Kwf_Component_Settings::$_rebuildingSettings = true;
         if ($setting) {
             //a single setting changed
             $newSettings = $settings[$c];
             $newSettings[$setting] = Kwc_Abstract::getSetting($c, $setting);
         } else {
             //all settings might have changed
             $newSettings = Kwf_Component_Settings::_getSettingsIncludingPreComputed($c);
         }
         Kwf_Component_Settings::$_rebuildingSettings = false;
         if ($newSettings['assets'] != $settings[$c]['assets'] || $newSettings['assetsAdmin'] != $settings[$c]['assetsAdmin']) {
             $dependenciesChanged = true;
         }
         if ($newSettings['generators'] != $settings[$c]['generators']) {
             $generatorssChanged = true;
             $oldChildComponentClasses = self::_getComponentClassesFromGeneratorsSetting($settings[$c]['generators']);
             $newChildComponentClasses = self::_getComponentClassesFromGeneratorsSetting($newSettings['generators']);
         }
         if (isset($newSettings['dimensions']) && $newSettings['dimensions'] != $settings[$c]['dimensions']) {
             $dimensionsChanged = true;
         }
         if (isset($newSettings['menuConfig']) && $newSettings['menuConfig'] != $settings[$c]['menuConfig']) {
             $menuConfigChanged = true;
         }
         $settings[$c] = $newSettings;
     }
     echo "refreshed component settings cache...\n";
     if ($dependenciesChanged) {
         echo "assets changed...\n";
         self::_clearAssetsDependencies();
         self::_clearAssetsAll();
     }
     $clearCacheSimpleStatic = array('has-', 'cs-', 'flag-', 'componentClasses-', 'recCCGen-', 'genInst-', 'childComponentClasses-');
     if ($generatorssChanged) {
         echo "generators changed...\n";
         echo count(Kwc_Abstract::getComponentClasses()) . " component classes (previously)\n";
         $m = Kwf_Component_Cache::getInstance()->getModel('url');
         foreach ($m->getRows() as $r) {
             Kwf_Cache_Simple::delete('url-' . $r->url);
             $r->delete();
         }
         foreach ($newChildComponentClasses as $cmpClass) {
             if (!in_array($cmpClass, Kwc_Abstract::getComponentClasses())) {
                 self::_loadSettingsRecursive($settings, $cmpClass);
             }
         }
         $removedComponentClasses = array_diff($oldChildComponentClasses, $newChildComponentClasses);
         foreach ($removedComponentClasses as $removedCls) {
             self::_removeSettingsRecursive($settings, $removedCls);
         }
     }
     file_put_contents('build/component/settings', serialize($settings));
     echo "cleared component settings apc cache...\n";
     if (Kwf_Util_Apc::isAvailable()) {
         self::_clearApcCache(array('clearCacheSimpleStatic' => $clearCacheSimpleStatic));
     } else {
         foreach ($clearCacheSimpleStatic as $i) {
             Kwf_Cache_SimpleStatic::clear($i);
         }
     }
     echo "\n";
     if ($dimensionsChanged) {
         echo "dimensions changed...\n";
         $clearCacheSimple = array();
         foreach ($componentClasses as $c) {
             $idPrefix = str_replace(array('.', '>'), array('___', '____'), $c) . '_';
             $clearCacheSimple[] = 'media-output-' . $idPrefix;
             $clearCacheSimple[] = 'media-output-mtime-' . $idPrefix;
             foreach (glob('cache/media/' . $idPrefix . '*') as $f) {
                 echo $f . " [DELETED]\n";
                 unlink($f);
             }
         }
         Kwf_Cache_Simple::delete($clearCacheSimple);
         echo "cleared media cache...\n";
     }
     if ($menuConfigChanged) {
         echo "menu config changed...\n";
         Kwf_Acl::clearCache();
         echo "cleared acl cache...\n";
     }
     $dependentComponentClasses = array();
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (strpos($c, '.') !== false) {
             $params = substr($c, strpos($c, '.') + 1);
             foreach ($componentClasses as $i) {
                 if (strpos($params, $i) !== false) {
                     $dependentComponentClasses[] = $c;
                 }
             }
         }
     }
     if ($dependentComponentClasses) {
         echo "dependent componentClasses: " . count($dependentComponentClasses) . " (Cc, Trl)\n";
         echo implode(', ', $dependentComponentClasses) . "\n";
         self::_clearComponentSettingsCache($dependentComponentClasses, $setting);
     }
 }
Esempio n. 17
0
 public function __construct()
 {
     parent::__construct();
     $this->remove('default_index');
     $this->addResource(new Kwf_Acl_Resource_MenuDropdown('default_menuitem', array('text' => trlKwfStatic('Dictionaries'), 'icon' => 'book.png')));
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_tasks', array('text' => trlKwfStatic('Tasks'), 'icon' => 'time.png'), '/tasks'));
     $this->addResource(new Kwf_Acl_Resource_MenuDropdown('default_staffmenuitem', array('text' => trlKwfStatic('Employees'), 'icon' => 'user.png')));
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_employees', array('text' => trlKwfStatic('Flight crew'), 'icon' => 'user.png'), '/employees'), 'default_staffmenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_staffs', array('text' => trlKwfStatic('Staff groups'), 'icon' => 'user.png'), '/staffs'), 'default_staffmenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuDropdown('default_flightsmenuitem', array('text' => trlKwfStatic('Flights'), 'icon' => 'calendar.png')));
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_index', array('text' => trlKwfStatic('Flight plans'), 'icon' => 'calendar.png'), '/'), 'default_flightsmenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_myflights', array('text' => trlKwfStatic('My flights'), 'icon' => 'book_open.png'), '/myflights'), 'default_flightsmenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuDropdown('default_edumenuitem', array('text' => trlKwfStatic('Education'), 'icon' => 'database.png')));
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_mytrainings', array('text' => trlKwfStatic('My trainings'), 'icon' => 'user.png'), '/mytrainings'), 'default_edumenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_mygroups', array('text' => trlKwfStatic('My groups'), 'icon' => 'group.png'), '/mygroups'), 'default_edumenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_myresults', array('text' => trlKwfStatic('My results'), 'icon' => 'user.png'), '/myresults'), 'default_edumenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_trainings', array('text' => trlKwfStatic('Trainings'), 'icon' => 'database.png'), '/trainings'), 'default_edumenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_traininggroups', array('text' => trlKwfStatic('Groups'), 'icon' => 'database.png'), '/traininggroups'), 'default_edumenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuDropdown('default_checksmenuitem', array('text' => trlKwfStatic('Checks'), 'icon' => 'calculator.png')));
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_checksdocs', array('text' => trlKwfStatic('Documents checks'), 'icon' => 'calculator.png'), '/checksdocs'), 'default_checksmenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_checksflights', array('text' => trlKwfStatic('Flights checks'), 'icon' => 'calculator.png'), '/checksflights'), 'default_checksmenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_checkstrainings', array('text' => trlKwfStatic('Trainings checks'), 'icon' => 'calculator.png'), '/checkstrainings'), 'default_checksmenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_checkresults', array('text' => trlKwfStatic('Check Results'), 'icon' => 'database.png'), '/checkresults'), 'default_checksmenuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_links', array('text' => trlKwfStatic('General'), 'icon' => 'book.png'), '/links'), 'default_menuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_countries', array('text' => trlKwfStatic('Countries'), 'icon' => 'book.png'), '/countries'), 'default_menuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_airports', array('text' => trlKwfStatic('Airports'), 'icon' => 'book.png'), '/airports'), 'default_menuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_landpoints', array('text' => trlKwfStatic('Landpoints'), 'icon' => 'book.png'), '/landpoints'), 'default_menuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_companies', array('text' => trlKwfStatic('Companies'), 'icon' => 'book.png'), '/companies'), 'default_menuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_wstypes', array('text' => trlKwfStatic('WsTypes'), 'icon' => 'book.png'), '/wstypes'), 'default_menuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('default_airplanes', array('text' => trlKwfStatic('Airplanes'), 'icon' => 'book.png'), '/airplanes'), 'default_menuitem');
     $this->addResource(new Kwf_Acl_Resource_MenuDropdown('default_settingsmenuitem', array('text' => trlKwfStatic('Settings'), 'icon' => 'cog.png')));
     $this->addResource(new Kwf_Acl_Resource_MenuUrl('kwf_user_users', array('text' => trlKwfStatic('Users management'), 'icon' => 'user_suit.png'), '/kwf/user/users'), 'default_settingsmenuitem');
     //$this->addResource(new Zend_Acl_Resource('default_tasks'), 'default_index');
     $this->addResource(new Zend_Acl_Resource('default_flightplans'), 'default_index');
     $this->addResource(new Zend_Acl_Resource('default_link'), 'default_links');
     $this->addResource(new Zend_Acl_Resource('default_linkdata'), 'default_links');
     $this->addResource(new Zend_Acl_Resource('default_linkdataentry'), 'default_linkdata');
     $this->addResource(new Zend_Acl_Resource('default_country'), 'default_countries');
     $this->addResource(new Zend_Acl_Resource('default_airport'), 'default_airports');
     $this->addResource(new Zend_Acl_Resource('default_landpoint'), 'default_landpoints');
     $this->addResource(new Zend_Acl_Resource('default_company'), 'default_companies');
     $this->addResource(new Zend_Acl_Resource('default_wstype'), 'default_wstypes');
     $this->addResource(new Zend_Acl_Resource('default_airplane'), 'default_airplanes');
     $this->addResource(new Zend_Acl_Resource('default_employee'), 'default_employees');
     $this->addResource(new Zend_Acl_Resource('default_staff'), 'default_staffs');
     $this->addResource(new Zend_Acl_Resource('default_staffdocuments'), 'default_staffs');
     $this->addResource(new Zend_Acl_Resource('default_staffdocument'), 'default_staffdocuments');
     $this->addResource(new Zend_Acl_Resource('default_documents'), 'default_employees');
     $this->addResource(new Zend_Acl_Resource('default_document'), 'default_documents');
     $this->addResource(new Zend_Acl_Resource('default_flightaccesses'), 'default_employees');
     $this->addResource(new Zend_Acl_Resource('default_flightaccess'), 'default_flightaccesses');
     $this->addResource(new Zend_Acl_Resource('default_flightresults'), 'default_employees');
     $this->addResource(new Zend_Acl_Resource('default_flightresult'), 'default_flightresults');
     $this->addResource(new Zend_Acl_Resource('default_task'), 'default_tasks');
     $this->addResource(new Zend_Acl_Resource('default_flightplan'), 'default_flightplans');
     $this->addResource(new Zend_Acl_Resource('default_flights'), 'default_flightplans');
     $this->addResource(new Zend_Acl_Resource('default_flight'), 'default_flightplans');
     $this->addResource(new Zend_Acl_Resource('default_flightfiles'), 'default_flight');
     $this->addResource(new Zend_Acl_Resource('default_flightfile'), 'default_flightfiles');
     $this->addResource(new Zend_Acl_Resource('default_myflight'), 'default_myflights');
     $this->addResource(new Zend_Acl_Resource('default_flighttracks'), 'default_flights');
     $this->addResource(new Zend_Acl_Resource('default_flighttrack'), 'default_flighttracks');
     $this->addResource(new Zend_Acl_Resource('default_planerstates'), 'default_flights');
     $this->addResource(new Zend_Acl_Resource('default_planerstate'), 'default_planerstates');
     $this->addResource(new Zend_Acl_Resource('default_flightfullresults'), 'default_flights');
     $this->addResource(new Zend_Acl_Resource('default_flightfullresult'), 'default_flightfullresults');
     $this->addResource(new Zend_Acl_Resource('default_flightgroups'), 'default_flights');
     $this->addResource(new Zend_Acl_Resource('default_flightgroup'), 'default_flightgroups');
     $this->addResource(new Zend_Acl_Resource('default_flightgroupsfilter'), 'default_flightgroup');
     $this->addResource(new Zend_Acl_Resource('default_staffgroups'), 'default_flights');
     $this->addResource(new Zend_Acl_Resource('default_staffgroup'), 'default_staffgroups');
     $this->addResource(new Zend_Acl_Resource('default_staffgroupsfilter'), 'default_staffgroup');
     $this->addResource(new Zend_Acl_Resource('default_training'), 'default_trainings');
     $this->addResource(new Zend_Acl_Resource('default_mytraining'), 'default_mytrainings');
     $this->addResource(new Zend_Acl_Resource('default_mygroup'), 'default_mygroups');
     $this->addResource(new Zend_Acl_Resource('default_myquestions'), 'default_mygroups');
     $this->addResource(new Zend_Acl_Resource('default_myquestion'), 'default_mygroups');
     $this->addResource(new Zend_Acl_Resource('default_myanswers'), 'default_mygroups');
     $this->addResource(new Zend_Acl_Resource('default_trainingquestions'), 'default_trainings');
     $this->addResource(new Zend_Acl_Resource('default_trainingquestion'), 'default_trainingquestions');
     $this->addResource(new Zend_Acl_Resource('default_traininganswers'), 'default_trainingquestion');
     $this->addResource(new Zend_Acl_Resource('default_traininganswer'), 'default_traininganswers');
     $this->addResource(new Zend_Acl_Resource('default_traininggroup'), 'default_traininggroups');
     $this->addResource(new Zend_Acl_Resource('default_trainingresults'), 'default_trainings');
     $this->addResource(new Zend_Acl_Resource('default_trainingresult'), 'default_trainingresults');
     $this->addResource(new Zend_Acl_Resource('default_checkdoc'), 'default_checksdocs');
     $this->addResource(new Zend_Acl_Resource('default_checkflight'), 'default_checksflights');
     $this->addResource(new Zend_Acl_Resource('default_checktraining'), 'default_checkstrainings');
     $this->add(new Zend_Acl_Resource('kwf_user_user'), 'kwf_user_users');
     $this->add(new Zend_Acl_Resource('kwf_user_log'), 'kwf_user_users');
     $this->add(new Zend_Acl_Resource('kwf_user_comments'), 'kwf_user_users');
     $this->addRole(new Kwf_Acl_Role('user', trlStatic('User')));
     $this->addRole(new Kwf_Acl_Role('plan', 'Планирование'));
     $this->add(new Kwf_Acl_Resource_EditRole('edit_role_user', 'user'), 'edit_role');
     $this->add(new Kwf_Acl_Resource_EditRole('edit_role_plan', 'plan'), 'edit_role');
     //$this->add(new Kwf_Acl_Resource_EditRole('edit_role_guest', 'guest'), 'edit_role');
     $this->allow('admin', 'edit_role_user');
     $this->allow('admin', 'edit_role_plan');
     //$this->allow('admin', 'edit_role_guest');
     //$this->allow('user', 'default_links');
     $this->allow('user', 'default_index');
     //$this->allow('user', 'default_employees');
     $this->allow('user', 'default_flightplans');
     //$this->allow('user', 'default_landpoints');
     $this->allow('user', 'default_tasks');
     $this->allow('user', 'default_mytrainings');
     $this->allow('user', 'default_mygroups');
     $this->allow('user', 'default_myquestions');
     $this->allow('user', 'default_myanswers');
     $this->allow('user', 'default_myresults');
     $this->allow('user', 'default_myflights');
     $this->allow('guest', 'default_flightsmenuitem');
     $this->allow('guest', 'default_flightplans');
     $this->allow('guest', 'default_flights');
     $this->allow('guest', 'default_index');
     $this->allow('plan', 'default_flightsmenuitem');
     $this->allow('plan', 'default_flightplans');
     $this->allow('plan', 'default_flights');
     $this->allow('plan', 'default_index');
     $this->allow('plan', 'default_tasks');
     $this->deny('plan', 'default_myflights');
     $this->deny('guest', 'default_myflights');
     $this->allow('admin', 'default_menuitem');
     $this->allow('admin', 'default_settingsmenuitem');
     $this->allow('admin', 'default_checksmenuitem');
     $this->allow('admin', 'default_flightsmenuitem');
     $this->allow('admin', 'default_flightgroupsfilter');
     $this->allow('admin', 'default_staffgroupsfilter');
     $this->allow('admin', 'default_flightplans');
     $this->allow('admin', 'default_myflights');
     $this->allow('admin', 'default_checkresults');
     $this->allow('admin', 'default_checksdocs');
     $this->allow('admin', 'default_checksflights');
     $this->allow('admin', 'default_checkstrainings');
     $this->allow('admin', 'default_mytrainings');
     $this->allow('admin', 'default_mygroups');
     $this->allow('admin', 'default_trainings');
     $this->allow('admin', 'default_trainingquestions');
     $this->allow('admin', 'default_traininggroups');
     $this->allow('admin', 'default_traininganswers');
     $this->allow('admin', 'default_trainingresults');
     $this->allow('admin', 'default_myresults');
     $this->allow('admin', 'default_myquestions');
     $this->allow('admin', 'default_myanswers');
     $this->allow('admin', 'default_flights');
     $this->allow('admin', 'default_tasks');
     $this->allow('admin', 'default_employees');
     $this->allow('admin', 'default_staffs');
     $this->allow('admin', 'default_airplanes');
     $this->allow('admin', 'default_wstypes');
     $this->allow('admin', 'default_companies');
     $this->allow('admin', 'default_airports');
     $this->allow('admin', 'default_landpoints');
     $this->allow('admin', 'default_countries');
     $this->allow('admin', 'default_links');
     $this->allow('admin', 'default_index');
     $this->allow('admin', 'kwf_media_upload');
     $this->allow('admin', 'kwf_user_users');
     $this->allow('guest', 'kwf_media_upload');
     $this->allow('guest', 'kwf_user_login');
     $this->allow(null, 'kwf_error_error');
 }
Esempio n. 18
0
 public function addResources(Kwf_Acl $acl)
 {
     $acl->add(new Kwf_Acl_Resource_MenuUrl('misc_languages', array('text' => 'Sprachen', 'icon' => 'comment.png'), '/admin/misc/languages'), 'misc');
 }
Esempio n. 19
0
 public function addResources(Kwf_Acl $acl)
 {
     $acl->add(new Kwf_Acl_Resource_ComponentClass_MenuUrl('kwc_article_category', array('text' => trlKwfStatic('Categories'), 'icon' => 'application_side_tree'), Kwc_Admin::getInstance($this->_class)->getControllerUrl('Categories'), $this->_class), 'settings');
 }
 public function onComponentAddedRemoved(Kwf_Component_Event_Component_Abstract $ev)
 {
     Kwf_Acl::clearCache();
 }
 public function testComplexMenu()
 {
     $acl = new Kwf_Acl();
     $acl->add(new Kwf_Acl_Resource_MenuDropdown('fooBar1', array('text' => 'FooBar1', 'icon' => 'heart.png')));
     $acl->add(new Kwf_Acl_Resource_MenuUrl('foo1', array('text' => 'Foo1', 'icon' => 'heart.png', 'order' => -1), '/admin/foo'), 'fooBar1');
     $acl->add(new Kwf_Acl_Resource_MenuUrl('bar1', array('text' => 'Bar1', 'icon' => 'heart.png', 'order' => -2), '/admin/bar'), 'fooBar1');
     $acl->allow(null, 'fooBar1');
     $acl->add(new Kwf_Acl_Resource_MenuDropdown('fooBar2', array('text' => 'FooBar2', 'icon' => 'heart.png', 'order' => 1)));
     $acl->add(new Kwf_Acl_Resource_MenuUrl('foo2', array('text' => 'Foo2', 'icon' => 'heart.png', 'order' => 1), '/admin/foo'), 'fooBar2');
     $acl->add(new Kwf_Acl_Resource_MenuUrl('bar2', array('text' => 'Bar2', 'icon' => 'heart.png'), '/admin/bar'), 'fooBar2');
     $acl->allow(null, 'fooBar2');
     $acl->add(new Kwf_Acl_Resource_MenuDropdown('fooBar3', array('text' => 'FooBar3', 'icon' => 'heart.png', 'order' => -1)));
     $acl->add(new Kwf_Acl_Resource_MenuUrl('foo3', array('text' => 'Foo3', 'icon' => 'heart.png'), '/admin/foo'), 'fooBar3');
     $acl->add(new Kwf_Acl_Resource_MenuUrl('bar3', array('text' => 'Bar3', 'icon' => 'heart.png', 'order' => -1), '/admin/bar'), 'fooBar3');
     $acl->allow(null, 'fooBar3');
     $config = $acl->getMenuConfig(null);
     //order of the dropdowns
     $this->assertEquals('FooBar3', $config[0]['menuConfig']['text']);
     $this->assertEquals('FooBar1', $config[1]['menuConfig']['text']);
     //order of fooBar1 children
     $this->assertEquals('Bar1', $config[1]['children'][0]['menuConfig']['text']);
     //order of fooBar2 children
     $this->assertEquals('Bar2', $config[2]['children'][0]['menuConfig']['text']);
     //order of fooBar3 children
     $this->assertEquals('Bar3', $config[0]['children'][0]['menuConfig']['text']);
 }
Esempio n. 22
0
 public function addResources(Kwf_Acl $acl)
 {
     if (!$acl->has('kwc_Kwc_Editable')) {
         $acl->add(new Kwc_Editable_AdminResource($this->_class, array('text' => trlKwf('Texts'), 'icon' => 'page_white_text.png'), Kwc_Admin::getInstance($this->_class)->getControllerUrl('Components')), 'kwf_component_root');
     }
 }
Esempio n. 23
0
 public function __construct()
 {
     parent::__construct();
     $this->addRole(new Kwf_Acl_Role('superuser', trlKwfStatic('Superuser')));
     $this->addRole(new Kwf_Acl_Role('preview', trlKwfStatic('Preview')));
     $this->add(new Kwf_Acl_Resource_EditRole('edit_role_superuser', 'superuser'), 'edit_role');
     $this->add(new Kwf_Acl_Resource_EditRole('edit_role_preview', 'preview'), 'edit_role');
     $this->add(new Zend_Acl_Resource('kwf_debug_class-tree'), 'kwf_debug');
     $this->add(new Zend_Acl_Resource('kwf_debug_logs'), 'kwf_debug');
     $this->add(new Zend_Acl_Resource('kwf_debug_logs-form'), 'kwf_debug_logs');
     $this->add(new Zend_Acl_Resource('kwf_component_web'));
     $this->add(new Zend_Acl_Resource('kwf_component_media'));
     $this->add(new Zend_Acl_Resource('kwf_component_benchmark'));
     $this->add(new Zend_Acl_Resource('kwf_component_show-component'));
     $this->add(new Kwf_Acl_Resource_MenuUrl('kwf_component_pages', array('text' => trlKwfStatic('Page tree'), 'icon' => 'application_side_tree.png')));
     $this->add(new Zend_Acl_Resource('kwf_component_page'), 'kwf_component_pages');
     $this->add(new Zend_Acl_Resource('kwf_component_components'), 'kwf_component_pages');
     // für /component/show
     $this->add(new Zend_Acl_Resource('kwf_component'), 'kwf_component_pages');
     // für /component/edit
     $this->add(new Zend_Acl_Resource('kwf_component_preview'), 'kwf_component_pages');
     $this->add(new Zend_Acl_Resource('kwf_component_root'));
     //Komponenten können hier resourcen anhängen
     $this->addResource(new Kwf_Acl_Resource_MenuDropdown('kwf_enquiries_dropdown', array('text' => trlKwfStatic('Enquiries'), 'icon' => 'email.png')));
     $this->add(new Kwf_Acl_Resource_MenuUrl('kwf_enquiries_enquiries', array('text' => trlKwfStatic('All Enquiries'), 'icon' => 'email.png')), 'kwf_enquiries_dropdown');
     $this->add(new Kwf_Acl_Resource_MenuDropdown('settings', array('text' => trlKwfStatic('Toolbox'), 'icon' => 'wrench.png')));
     $this->add(new Kwf_Acl_Resource_MenuUrl('kwf_user_users', array('text' => trlKwfStatic('Useradministration'), 'icon' => 'user.png')), 'settings');
     $this->add(new Zend_Acl_Resource('kwf_user_user'), 'kwf_user_users');
     $this->add(new Zend_Acl_Resource('kwf_user_log'), 'kwf_user_users');
     $this->add(new Zend_Acl_Resource('kwf_user_comments'), 'kwf_user_users');
     $this->add(new Kwf_Acl_Resource_MenuUrl('kwf_component_clear-cache', array('text' => trlKwfStatic('Clear Cache'), 'icon' => 'database.png')), 'settings');
     $this->add(new Kwf_Acl_Resource_MenuUrl('kwf_redirects_redirects', array('text' => trlKwfStatic('Redirects'), 'icon' => 'page_white_go.png')), 'settings');
     $this->add(new Zend_Acl_Resource('kwf_redirects_redirect'), 'kwf_redirects_redirects');
     $this->add(new Zend_Acl_Resource('kwf_redirects_pages'), 'kwf_redirects_redirect');
     $this->add(new Zend_Acl_Resource('kwc_structure'));
     // Create Structure Resource for all classes
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         $this->add(new Kwf_Acl_Resource_Component_Structure($class), 'kwc_structure');
     }
     $this->allow('admin', 'kwc_structure');
     $this->allow('superuser', 'kwc_structure');
     $this->allow(null, 'kwf_component_web');
     $this->allow(null, 'kwf_component_media');
     $this->allow('admin', 'kwf_component');
     $this->allow('superuser', 'kwf_component');
     $this->allow('superuser', 'edit_role_superuser');
     $this->allow('superuser', 'edit_role_preview');
     $this->allow('admin', null);
     $this->allow('superuser', 'settings');
     $this->allow('superuser', 'kwf_enquiries_enquiries');
     $this->deny('superuser', 'kwf_component_clear-cache');
     $this->allow('admin', 'kwf_component_show-component');
     $this->allow('admin', 'kwf_component_pages');
     $this->allow('admin', 'kwf_component_benchmark');
     $this->allow('superuser', 'kwf_component_show-component');
     $this->allow('superuser', 'kwf_component_pages');
     $this->allow('preview', 'kwf_component_preview');
     $this->allow(null, 'kwf_component_root');
     $this->deny('guest', 'kwf_welcome_welcome');
     $this->deny('guest', 'kwf_component_pages');
     // Kwf_Component_Acl nicht vergessen für Komponentenrechte!
 }
Esempio n. 24
0
 public function addResources(Kwf_Acl $acl)
 {
     $acl->add(new Kwf_Acl_Resource_ComponentClass_MenuUrl('kwc_tags', array('text' => $this->_getSetting('componentName'), 'icon' => 'tag_blue_edit'), Kwc_Admin::getInstance($this->_class)->getControllerUrl('Grid'), $this->_class), 'settings');
 }
Esempio n. 25
0
 public function __construct()
 {
     parent::__construct();
     $this->add(new Zend_Acl_Resource('kwf_test'));
     $this->allow(null, 'kwf_test');
 }