AdminModule/presenters/BasePresenter.php
private function checkPermission()
    {
        // creates system acl
        $acl = $this->initAcl();

        $identity = $this->getUser()->getIdentity();
        $permissions = $this->initPermissions($identity);
        foreach ($permissions as $key => $p) {
            if ($p && $acl->hasResource($key)) {
                $acl->allow($identity->roles[0], $key, Nette\Security\Permission::ALL);
            }
        }

        // homepage and login page can access everyone
        $acl->allow(Nette\Security\Permission::ALL, 'admin:Homepage', Nette\Security\Permission::ALL);
        $acl->allow(Nette\Security\Permission::ALL, 'admin:Login', Nette\Security\Permission::ALL);

        // superadmin has access to everywhere
        $acl->allow('superadmin', Nette\Security\Permission::ALL, Nette\Security\Permission::ALL);

        $roles = $this->getUser()->getRoles();

        if (!$this->checkRights($acl, $roles)) {
            $this->presenter->flashMessage($this->translation['You do not have a permission to do this operation!'], 'danger');
            $this->redirect(":Admin:Homepage:");
        }
    }
private function checkPermission()
    {
        // creates system acl
        $acl = $this->initAcl();

        $identity = $this->getUser()->getIdentity();
        $permissions = $this->initPermissions($identity);
        foreach ($permissions as $key => $p) {
            if ($p && $acl->hasResource($key)) {
                $acl->allow($identity->roles[0], $key, Nette\Security\Permission::ALL);
            }
        }

        // homepage and login page can access everyone
        $acl->allow(Nette\Security\Permission::ALL, 'admin:Homepage', Nette\Security\Permission::ALL);
        $acl->allow(Nette\Security\Permission::ALL, 'admin:Login', Nette\Security\Permission::ALL);

        // superadmin has access to everywhere
        $acl->allow('superadmin', Nette\Security\Permission::ALL, Nette\Security\Permission::ALL);

        $roles = $this->getUser()->getRoles();

        if (!$this->checkRights($acl, $roles)) {
            $this->presenter->flashMessage($this->translation['You do not have a permission to do this operation!'], 'danger');
            $this->redirect(":Admin:Homepage:");
        }
    }
private function checkPermission ( ) { // creates system acl $ acl = $ this -> initAcl ( ) ; $ identity = $ this -> getUser ( ) -> getIdentity ( ) ; $ permissions = $ this -> initPermissions ( $ identity ) ; foreach ( $ permissions as $ key => $ p ) { if ( $ p && $ acl -> hasResource ( $ key ) ) { $ acl -> allow ( $ identity -> roles [ 0 ] , $ key , Nette \ Security \ Permission :: ALL ) ; } } // homepage and login page can access everyone $ acl -> allow ( Nette \ Security \ Permission :: ALL , 'admin:Homepage' , Nette \ Security \ Permission :: ALL ) ; $ acl -> allow ( Nette \ Security \ Permission :: ALL , 'admin:Login' , Nette \ Security \ Permission :: ALL ) ; // superadmin has access to everywhere $ acl -> allow ( 'superadmin' , Nette \ Security \ Permission :: ALL , Nette \ Security \ Permission :: ALL ) ; $ roles = $ this -> getUser ( ) -> getRoles ( ) ; if ( ! $ this -> checkRights ( $ acl , $ roles ) ) { $ this -> presenter -> flashMessage ( $ this -> translation [ 'You do not have a permission to do this operation!' ] , 'danger' ) ; $ this -> redirect ( ":Admin:Homepage:" ) ; } }
Checks user permission.

@return void
Checks user permission .