remiq / apigility-zfc-rbac-recipe

Recipe for ZfcRbac authorization in OAuth2 authenticated Apigility
22 stars 9 forks source link

Apigility + Doctrine + ZfcUser + oAuth2 + Rbac #3

Open DevDev1 opened 8 years ago

DevDev1 commented 8 years ago

Hi there,

While reading recipe I think (from what I learned) that something changed in Apigility since recipe is written

I believe StatusLib do not have classic controller? (there are StatusCollection.php, StatusEntity.php, StatusResource.php, StatusResourceFactory.php)

'rest_guard' => [
            'Status\\V1\\Rest\\Status\\Controller' => [
...

If you agree we can do skeleton together (I believe I'll need some help to make things work) and you can use it and provide it as example code with recipe? What do you think?

remiq commented 8 years ago

Hello DevDev1,

controllers are 'auto-magical' in Apigility. You don't have (Status)Controller.php file, but it exists.

In your case, you want to block GET /status, which is "collection GET". Collection is status/. Entity would be status/1. You should try:

'rest_guard' => [
    'Status\\V1\\Rest\\Status\\Controller' => [
        'collection' => [
            'GET' => ['canDoFoo']
        ],
    ]
]

Now define canDoFoo using the rest of the recipe.

I'm not interested in developing your program. This recipe should be enough to modify Apigility autogenerated code.