Handler and ACL permissions
Notice: This thread is very old.
- Blažek
- Member | 4
Hi,
is it possible to manage handler permission with ACL? I followed this tutorial and
everything was clear but now I need to use handler with ACL and I found
nothing about it (so maybe it's nonsense… I was wondering about using action
instead of that handler but handler fits to my problem (switching boolean) –
better)
Thanks
- Blažek
- Member | 4
Ah, I'm soo sorry I mixed it up… I mean handle not
handler (moderators please fix title)
here is example
template.latte
<a n:href="homepage:markDone !"> Do something </a>
HomepagePresenter
public function handleMarkDone()
{
//Do something
}
and I'm looking for something like this if it's possible
{if $user->isAllowed('Homepage', 'handle')}
<a n:href="homepage:markDone!"> Do something </a>
{/if}
I can't figure out how to add handles into resources list…
Last edited by Blažek (2013-09-14 14:13)
- enumag
- Member | 2118
Oh you mean signals… I believe the Nette-way is this (although I don't use it anymore).
{if $user->isAllowed('Homepage', 'markDone')}
<a n:href="homepage:markDone!"> Do something </a>
{/if}
public function handleMarkDone()
{
if (!$this->user->isAllowed('Homepage', 'markDone')) {
throw new \Nette\Application\ForbiddenRequestException('...');
}
// do something
}
services:
authorizator:
class: Nette\Security\Permission
setup:
- addRole('editor')
- addResource('Homepage')
- allow('editor', 'Homepage', 'markDown')
Last edited by enumag (2013-09-14 14:24)