Comments (10)
You can use the IsGranted (https://github.com/ZF-Commons/ZfcRbac/blob/master/src/ZfcRbac/Controller/Plugin/IsGranted.php) controller plugin inside actions.
from zfc-rbac.
Yes, I've seen this plugin but still I don't know how to implement it and even more how to get the permissions. My idea would be somehow to call this plugin in the 'Module.php' with the 'onBootstrap' method, in the main module 'Application' passing the permissions, which I don't know how to obtain.
from zfc-rbac.
in my module.config.php ()
module/Test/config/module.config.php
'controller_plugins' => array(
'invokables' => array(
'TestPlugin' => 'Test\Controller\Plugin\TestPlugin',
)
),
module/Test/src/Test/Controller/Plugin/TestPlugin.php
namespace Tam\Controller\Plugin;
class TestPlugin extends \ZfcRbac\Controller\Plugin\IsGranted{ }
module/Test/src/Test/Controller/IndexController.php
class IndexController extends AbstractActionController
{
public function indexAction()
{
$bool = $this->TestPlugin('test');
\Zend\Debug\Debug::dump($bool ); //bool(false)
}
}
Well that's my attempt (I know it's awful) which doesn't work and neither was my aim, just testing .. but at least I can reach somehow the IsGranted Plugin... like I said before I want to do it inside the Module.php all that stuff..
And when I changed the standard_identity to zfcuser_auth_service as explained in this link (https://github.com/ZF-Commons/ZfcRbac/wiki/How-to-use-with-zfcuser) after login with ZfcUser Module I get this message ( 'Identity must be null, a string, or an instance of ZfcRbac\Identity\IdentityInterface' ).
Thanks,
from zfc-rbac.
You have to modify the zfcuser user entity for zfcrbac. These are the additions I made for the first step of integration:
class User implements UserInterface, \ZfcRbac\Identity\IdentityInterface ... /** * @var array */ protected $roles; ... /* * Get roles. * * @return Roles */ public function getRoles() { return array(); }
Documentation is pretty scarce. I'm working through trying to load persisted role/permission information and using it in navigation menus right now. For me its a bear. Hopefully the community can work up some more documentation.
from zfc-rbac.
Thanks for your answer, I will check asap. I'm agree with the lack of documentation, unfortunately this is a common problem developing web apps, they usually are not properly documented. Always would be design the app with UML before write code, but this USUALLY not happens... Anyway thanks to the community, it helps also to learn ZF2, but I'm not going to continue reading tons of code before understand how it should work
from zfc-rbac.
@kelsey9649 Why are returning empty array when roles are called?
from zfc-rbac.
The empty array should be your identity's array of roles.
from zfc-rbac.
Hi @carpanta ,
Next version of ZfcRbac is going to be available soon. It currently is in the "refactor" branch. It now has a lot of docs.
It should be pretty simple to use any User module, as you only need to implement the "IdentityInterface". I'm closing this :).
from zfc-rbac.
HI @bakura10 you meant
https://github.com/ZF-Commons/ZfcRbac/blob/master/docs/01.%20Introduction.md
Your link is broken.
from zfc-rbac.
Yes, sorry :)
from zfc-rbac.
Related Issues (20)
- Tag stable version for ZF3 compat HOT 6
- Looking for a new maintainer(s) HOT 5
- Missing use statement in ZfcRbac\Initializer\AuthorizationServiceInitializer HOT 1
- RedirectStrategy doesn't work with "ZF3" Eventmanager HOT 8
- RedirectStrategy + zf3 HOT 8
- Future HOT 23
- Very strange session regeneration issue when using ZfcUser with ZfcRbac HOT 3
- Fllow the cookbook I get a problem not fund the authorizationservice HOT 3
- Unable to resolve service "Zend\Authentication\AuthenticationService
- why i always get error flow the cookbook? i will show what happend with my application HOT 4
- Cannot get a name and parameters for RoleProviderPluginManager HOT 2
- a guard priority question HOT 1
- Is there Mechanism of a cache? HOT 1
- Problem with doctrine update
- What is the plan of 3.0 release? HOT 7
- Maybe we could have PermissionProvider?
- HierarchicalRoleInterface problem HOT 1
- Config for version 3.0 needs some fixing or explaining HOT 9
- Migrate to Laminas HOT 7
- Is there a migration to Laminas either on-going or planned?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zfc-rbac.