@Secured annotation for Nette framework

v0.1 2015-01-05 18:35 UTC

This package is not auto-updated.

Last update: 2020-09-14 13:54:14 UTC


@Secured annotation for Nette framework inspired by Spring's @Secured annotation.


First, you need to have Kdyby\AOP installed and configured.

Install Secured using composer:

composer require klimesf/secured:@dev

and register SecuredAspect in your Nette application:

	- Klimesf\Secured\Secured


class Service

	 * @Klimesf\Secured\Secured(roles = {"admin"})
	public function doStuff() {
		// do stuff requiring admin role ...

If current Nette\Security\User is not logged in or does not have required roles, Nette\Security\AuthenticationException will be thrown.


Note: Due to a bug in Kdyby\AOP, you can't import the annotation with use statements at this moment. Until it's fixed you have to provide fully qualified name of the annotation (@Klimesf\Secured\Secured)

Note: You cannot annotate presenter methods.

Note: This extension was inspired by redhead/Cached.