zend framework2 - ZendDeveloperTools not working with ZfcRbac -


i installed zfcrbac instead of bjyauthorize. toolbar of zenddevelopertools partially working. cannot find reason following warning. missing in setup ?

  1. warning: invalid argument supplied foreach() in c:\dev\xampp\htdocs\onlinefieldevaluation\vendor\zf-commons\zfc-rbac\view\zend-developer-tools\toolbar\zfc-rbac.phtml on line 94

  2. notice: undefined index: guards in c:\dev\xampp\htdocs\onlinefieldevaluation\vendor\zf-commons\zfc-rbac\view\zend-developer-tools\toolbar\zfc-rbac.phtml on line 38

  3. guest role
    ( ! ) notice: undefined index: options in c:\dev\xampp\htdocs\onlinefieldevaluation\vendor\zf-commons\zfc-rbac\view\zend-developer-tools\toolbar\zfc-rbac.phtml on line 19

enter image description here

enter image description here

enter image description here

edit 1: part of changes related zfcrbac broke zenddevelopertools:

zfc_rbac.global.php

<?php /*  * software provided copyright holders , contributors  * "as is" , express or implied warranties, including, not  * limited to, implied warranties of merchantability , fitness  * particular purpose disclaimed. in no event shall copyright  * owner or contributors liable direct, indirect, incidental,  * special, exemplary, or consequential damages (including, not  * limited to, procurement of substitute goods or services; loss of use,  * data, or profits; or business interruption) caused , on  * theory of liability, whether in contract, strict liability, or tort  * (including negligence or otherwise) arising in way out of use  * of software, if advised of possibility of such damage.  *  * software consists of voluntary contributions made many individuals  * , licensed under mit license.  */ use zfcrbac\guard\guardinterface; /**  * copy-paste file config/autoload folder (don't forget remove .dist extension!)  */ return [     'zfc_rbac' => [         /**          * key used fetch identity provider          *          * please note when identity found, must implements zfcrbac\identity\identityproviderinterface          * interface, otherwise throw exception.          */         'identity_provider' => 'zfcrbac\identity\authenticationidentityprovider', //        'identity_provider' => 'application\entity\systemuser',         /**          * set guest role          *          * role used authorization service when authentication service returns no identity          */         'guest_role' => 'guest',         /**          * set guards          *          * must comply various options of guards. format must of following format:          *          *      'guards' => [          *          'zfcrbac\guard\routeguard' => [          *              // options          *          ]          *      ]          */         // 'guards' => [],         'guards' => [             'zfcrbac\guard\routeguard' => [                 'zfcuser/login' => ['guest'],                 'zfcuser' => ['guest'],                 'home' =>  ['student'],              ],           ],         /**          * 1 rule either route or controller specified, guard automatically          * created , start hook mvc loop.          *          * if protection policy set deny, route/controller denied          * default unless explicitly added rule. on other hand, if set allow,          * not specified route/controller implicitly approved.          *          * deny secure way, more work developer          */         'protection_policy' => \zfcrbac\guard\guardinterface::policy_deny,         /**          * configuration role provider          *          * must array contains configuration role provider. provider config          * must follow following format:          *          *      'zfcrbac\role\inmemoryroleprovider' => [          *          'role1' => [          *              'children'    => ['children1', 'children2'], // optional          *              'permissions' => ['edit', 'read'] // optional          *          ]          *      ]          *          * supported options depend of role provider, please refer official documentation          */ //        'role_provider' => [],          'role_provider' => [              'zfcrbac\role\objectrepositoryroleprovider' => [                 'object_manager' => 'doctrine.entitymanager.orm_default', // alias doctrine objectmanager                 'class_name' => 'application\entity\myhierarchicalrole',                 'role_name_property' => 'name'             ],          ],          /**          * configure unauthorized strategy. used render template whenever user unauthorized          */         'unauthorized_strategy' => [             /**              * set template name render              */              'template' => 'error/no-auth'         ],          /**          * configure redirect strategy. used redirect user route when user          * unauthorized          */         'redirect_strategy' => [             /**              * enable redirection when user connected              */              'redirect_when_connected' => true,              /**              * set route redirect when user connected (of course, must exist!)              */             'redirect_to_route_connected' => 'zfcuser',              /**              * set route redirect when user disconnected (of course, must exist!)              */             'redirect_to_route_disconnected' => 'zfcuser/login',              /**              * if user unauthorized , redirected route (login, instance), should              * append previous uri (the 1 unauthorized) in query params?              */              'append_previous_uri' => true,              /**              * if append_previous_uri option set true, option set query key use when              * previous uri appended              */              'previous_uri_query_key' => 'redirectto'         ],          /**          * various plugin managers guards , role providers. each of them must follow common          * plugin manager config format, , can used create custom objects          */         // 'guard_manager'               => [],         // 'role_provider_manager'       => []     ] ]; 

this zdt.local.php :

<?php return array(     'zenddevelopertools' => array(          /**           * general profiler settings           */         'profiler' => array(             /**              * enables or disables profiler.              *              * expects: bool              * default: true              */             'enabled' => true,              /**              * enables or disables strict mode. if strict mode              * enabled, error throw exception, otherwise              * errors added report (and shown in toolbar).              *              * expects: bool              * default: true              */             'strict' => true,              /**              * if enabled, profiler tries flush content before              * starts collecting data. option ignored if toolbar              * enabled.              *              * note: flush listener listens mvcevent::event_finish event              *       priority of -9400. have disable function if              *       wish modify output lower priority.              *              * expects: bool              * default: false              */             'flush_early' => false,              /**              * cache directory used in version check , every storage              * type writes disk.              *              * note: default value assumes current working directory              *       application root.              *              * expects: string              * default: 'data/cache'              */             'cache_dir' => 'data/cache',              /**              * if matches defined, profiler disabled if              * request not match pattern.              *              * example: 'matcher' => array('ip' => '127.0.0.1')              *          or              *          'matcher' => array('url' => array('path' => '/admin')              *              * note: matcher not implemented yet!              */             'matcher' => array(),              /**              * contains list collector profiler should run.              * zend developer tools ships 'db' (zend\db), 'time', 'event', 'memory',              * 'exception', 'request' , 'mail' (zend\mail). if wish disable default              * collector, set value null or false.              *              * example: 'collectors' => array('db' => null)              *              * expects: array              */             'collectors' => array(),         ),          /**           * general toolbar settings           */         'toolbar' => array(             /**              * enables or disables toolbar.              *              * expects: bool              * default: false              */             'enabled' => true,              /**              * if enabled, every empty collector hidden.              *              * expects: bool              * default: false              */             'auto_hide' => false,              /**              * toolbar position.              *              * expects: string ('bottom' or 'top')              * default: bottom              */             'position' => 'bottom',              /**              * if enabled, toolbar check if current zend framework version              * up-to-date.              *              * note: check occur once every hour.              *              * expects: bool              * default: false              */             'version_check' => false,              /**              * contains list collector toolbar templates. name              * of array key must same name of collector.              *             *              * example: 'profiler' => array(              *              'collectors' => array(              *                  // my_collector_example::getname() -> mycollector              *                  'mycollector' => 'my_collector_example',              *              )              *          ),              *          'toolbar' => array(              *              'entries' => array(              *                  'mycollector' => 'example/toolbar/my-collector',              *              )              *          ),              *              * expects: array              */             'entries' => array(),         ),     ), ); 

this issue has started after commit:

https://github.com/zendframework/zenddevelopertools/commit/d3432681aa32177a741ad23604a40af9ad454acb

however, there fix waiting merge:

https://github.com/zf-commons/zfc-rbac/pull/297

in same pull request there temporary fix:

i don't think has been fixed yet, temporary solution have made following changes: in ./module/application/config/module.config.php:

'view_manager' => array(    'template_map' => array(       // temp fix until approved: https://github.com/zf-commons/zfc-rbac/pull/296       'zend-developer-tools/toolbar/zfc-rbac' => __dir__ . '/../view/zend-developer-tools/toolbar/zfc-rbac.phtml',     ), ), 

then copy zfc-rbac.phtml file ./vendor directory ./module/application/view/zend-developer-tools/toolbar (note: 'application' in application.config.php must loaded after 'zfcrbac')

in newly created zfc-rbac.phtml , modify top few lines this:

$this->collector->unserialize($this->collector->serialize()); /* @var $collection \zfcrbac\collector\rbaccollector */ $collection = $this->collector->getcollection(); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -