Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guest is not allowed to access dispatchable index (dispatchable/index) #11

Open
ghost opened this issue May 15, 2012 · 3 comments
Open

Comments

@ghost
Copy link

ghost commented May 15, 2012

Hi there,
I got this error.
I don't understand why.

@matuszeman
Copy link
Contributor

Hey,
It's because Dispatch guard is enabled and "guest" user (you are not logged in) has got no privileges on "dispatchable/index" resource (index controller).

What user/authentication module do you use? Is it KapitchiIdentity or ZfcUser? In order to use ZfcAcl you need to implement RoleProvider and inject it to Acl service.

Matus

@ghost
Copy link
Author

ghost commented May 17, 2012

Hi,
i'm using ZfcUser (with ZfcUserDoctrineORM).
Here is what i did:
1 - i make a copy of ZfcAcl.global.config.php into my config/autoload directory
2- i make a copy of KapitchiIdentity/src/KapitchiIdentityAcl/Service/RoleProvider.php into Application/src/Application/Plugin/ZfcAcl/RoleProvider.php
3 - i configured ZfcAcl.global.config.php with : 'roleProvider' => 'Application\Plugin\ZfcAcl\RoleProvider',

But now i suppose i should call somewhere RoleProvider::setIdentityRoleService($identityRoleService) using $aclService but i don't know how.

My current error is following because $this->getIdentityRoleService() is null:
Fatal error: Call to a member function getCurrentRole() on a non-object in N:\DEV\APPLICATIONS\zf2\module\Application\src\Application\Plugin\ZfcAcl\RoleProvider.php on line 11

https://github.com/kapitchi/KapitchiIdentity/blob/master/src/KapitchiIdentityAcl/Service/RoleProvider.php#L11

@matuszeman
Copy link
Contributor

ZfcUser does not provide roles. Although you might want to implement role provider this way:

  • getIdentityRoleService - is related KapitchiIdentity module - for ZfcUser you need to inject ZfcUser\Service\User and call getAuthService() to get Auth service.
  • getCurrentRole() should be written the way that it returns "user" role when $authService->hasIdentity() == true and "guest" otherwise. Return value should be Zend\Acl\Role\RoleInterface (you can use e.g. GenericRole)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant