protected function getRoleAccessCallback()
    {
        return function ($key, $val, $index) {
            /** @var Token $sessionAuth */
            if (!$this->session->isStarted()) {
                return ['disabled' => 'disabled'];
            }
            $sessionAuth = $this->session->get('authentication');
            $currentUser = $sessionAuth->getUser();
            $allowedRoles = $this->permissions->getManipulatableRoles($currentUser->toArray());

            return in_array($key, $allowedRoles) ? [] : ['disabled' => 'disabled'];
        };
    }
protected function getRoleAccessCallback()
    {
        return function ($key, $val, $index) {
            /** @var Token $sessionAuth */
            if (!$this->session->isStarted()) {
                return ['disabled' => 'disabled'];
            }
            $sessionAuth = $this->session->get('authentication');
            $currentUser = $sessionAuth->getUser();
            $allowedRoles = $this->permissions->getManipulatableRoles($currentUser->toArray());

            return in_array($key, $allowedRoles) ? [] : ['disabled' => 'disabled'];
        };
    }
protected function getRoleAccessCallback ( ) { return function ( $ key , $ val , $ index ) { /** @var Token $sessionAuth */ if ( ! $ this -> session -> isStarted ( ) ) { return [ 'disabled' => 'disabled' ] ; } $ sessionAuth = $ this -> session -> get ( 'authentication' ) ; $ currentUser = $ sessionAuth -> getUser ( ) ; $ allowedRoles = $ this -> permissions -> getManipulatableRoles ( $ currentUser -> toArray ( ) ) ; return in_array ( $ key , $ allowedRoles ) ? [ ] : [ 'disabled' => 'disabled' ] ; } ; }
Callback to disable role choices that a user doesn't have access to
manipulate.

@return callable
Callback to disable role choices that a user doesn t have access to manipulate .