Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Phalcon ACL error with collections



  1. what kind of {% content %} should be expected in admin/index.volt ? What happens if you remove it ?
  2. in your volt files, why did you call {% block head %} twice (in layout and in view) ? (this should not have any effect on your problem)


Nothing changes if I remove it. The problem is being caused by this part :
{{ this.assets.outputCss('style')}} {{ this.assets.outputJs('js')}} there are no collections with the name style and js because ControllerBase's initialize function was not called. But the admin/index view is being rendered, why is that? The user has no permission to access that area, so he should be redirected to site controller index action and the view should not be even rendered.

edited Jun '14

I think "this" is not relevant here. Below is how I call my assets with Volt

{{ assets.outputCss('style')}} 
{{ assets.outputJs('js')}}

You have another problem with your ACL.

What does

$acl->isAllowed($role, $controller, $action)





It returns integer 1 or 0. My code doesn't fail in that part. Is is actually done like in this tutorial.

edited Jun '14

So the solution was to simply check if the collection exists like so

{% if assets.collection('style').count() %}
    {{ assets.outputCss('style')}}
{% endif %}

Anyway, it's kind of strange that if I redirect a user and I deny him access to a some route, the view is being rendered anyway.