ZF-Commons / zfc-rbac

Role-based access control module to provide additional features on top of Zend\Permissions\Rbac
BSD 3-Clause "New" or "Revised" License
181 stars 111 forks source link

why i always get error flow the cookbook? i will show what happend with my application #372

Closed Dreamseekai closed 7 years ago

Dreamseekai commented 7 years ago

flow the cookbookg i create the PostService and PostControler then i copy the Module.php like this --> class Module { // getAutoloaderConfig(), getConfig(), etc...

public function getServiceConfig()
{
    return [
        'factories' => [
             'PostService' => function($sm) {
                 return new PostService(
                     $sm->get('doctrine.entitymanager.orm_default')
                 );
             }
        ]
    ];
}

} now i get the first error !! undefund doctrine.entitymanager.orm_default! if need Doctrine Module please write in the cookbook. ok i composer required doctrine fixed it . the next problem
when i add
$sm->get('ZfcRbac\Service\AuthorizationService') // This is new! in the Module.php error again Fatal error: Uncaught Zend\ServiceManager\Exception\ServiceNotFoundException: Unable to resolve service "Zend\Authentication\AuthenticationService" to a factory; are you certain you provided it during configuration?

my god save me . i just flow the cookbook but it's not working ~~ come on friend . why the zendframework and other's components with ZF the docmoment all not working . come on MASTER GIVE ME SOME HELP~

basz commented 7 years ago

Are you sure you have registered the ZfcRbac Module in config/application.php Looks like this https://github.com/ZF-Commons/zfc-rbac/blob/master/config/module.config.php#L33 configuration isn’t active…

You did got help, but you did not gave any indication you have read it or understood it. I don't know from here what you have tried and what the exact problem is.

Also, a cookbook doesn't imply we are here to hold your hand and assumes novice or intermediate understanding of how the zendframework (modules) work. We have no idea of your level of expertise so give some sort of indication of that.

When you see an omission in the cookbook and think it it missing something it is a lot more helpful to respectfully point it out. Even better, fix it! It is open source.

Please stop throwing your frustration at us, it is not the way to get help.

basz commented 7 years ago

Did you follow the installation instructions? https://github.com/ZF-Commons/zfc-rbac#installation

Dreamseekai commented 7 years ago

thank you very much ~ i loss controll self.. i apologize for throw frustration. i am so sorry. i will provider my file , i hope it can give some help for fix error. i use the rbac by the step my application build on ZF3 1 composer intall zfcRbac 2 add ZfcRbac to my /config/moudules.config.php . 3 copy-pasting the zfc_rbac.global.php.dist file to your config/autoload folder. and rename to zfc_rbac.global.php 3 composer install DoctrineModule and add it to /config/Module.config.php 4 create a new Module by ZF3 rules 5 and then flow the cookbook like this (1) create PostService (2)create PostController (3) finish the router an zfRbac config in the module.config.php (4) the poblem begin at here in the add that to Module.php $sm->get('ZfcRbac\Service\AuthorizationService') // This is new! my application can't find the ZfcRbac\Service\AuthorizationService. and i don't know where and how regist the ZfcRbac\Service\AuthorizationService. i think when i run composer required ZfcRbac all ready?? this my application but i delete the vender floder beacuse it's to big @basz sz thank you and soory again.

ZF32.zip

prolic commented 7 years ago

@Dreamseekai I extracted your zip file and installed your application on my system. When I hit the website I get this: Fatal error: Uncaught Zend\ServiceManager\Exception\ServiceNotFoundException: Unable to resolve service "Zend\Authentication\AuthenticationService" to a factory.

You can check the quickstart: https://github.com/ZF-Commons/zfc-rbac/blob/master/docs/02.%20Quick%20Start.md

Quote: "By default, ZfcRbac internally uses the Zend\Authentication\AuthenticationService service key to retrieve the user (logged or not). Therefore, you must implement and register this service in your application by adding these lines in your module.config.php file ....."

ZfcRbac does expect you to configure an authentication service, otherwise it simply cannot know how to find out whether a user is logged in or not.

Next time, please read the docs first and be a little more polite, as we are giving this stuff for free in our spare time. You wouldn't either be allowed to talk with us like this, if you would pay us.