public function getRules(EventInterface $event) {
        $request = $event->getRequest();
        $publicKey = $request->getRoute()->get('publickey');

        $accessControl = $event->getAccessControl();
        $keyExists = $accessControl->publicKeyExists($publicKey);

        if (!$keyExists) {
            throw new RuntimeException('Public key not found', 404);
        }

        $accessList = $accessControl->getAccessListForPublicKey($publicKey);

        if ($request->query->has('expandGroups')) {
            foreach ($accessList as &$rule) {
                if (!isset($rule['group'])) {
                    continue;
                }

                $rule['resources'] = $accessControl->getGroup($rule['group']);
            }
        }

        $model = new AccessRulesModel();
        $model->setRules($accessList);

        $event->getResponse()->setModel($model);
    }
public function getRules(EventInterface $event) {
        $request = $event->getRequest();
        $publicKey = $request->getRoute()->get('publickey');

        $accessControl = $event->getAccessControl();
        $keyExists = $accessControl->publicKeyExists($publicKey);

        if (!$keyExists) {
            throw new RuntimeException('Public key not found', 404);
        }

        $accessList = $accessControl->getAccessListForPublicKey($publicKey);

        if ($request->query->has('expandGroups')) {
            foreach ($accessList as &$rule) {
                if (!isset($rule['group'])) {
                    continue;
                }

                $rule['resources'] = $accessControl->getGroup($rule['group']);
            }
        }

        $model = new AccessRulesModel();
        $model->setRules($accessList);

        $event->getResponse()->setModel($model);
    }
public function getRules ( EventInterface $ event ) { $ request = $ event -> getRequest ( ) ; $ publicKey = $ request -> getRoute ( ) -> get ( 'publickey' ) ; $ accessControl = $ event -> getAccessControl ( ) ; $ keyExists = $ accessControl -> publicKeyExists ( $ publicKey ) ; if ( ! $ keyExists ) { throw new RuntimeException ( 'Public key not found' , 404 ) ; } $ accessList = $ accessControl -> getAccessListForPublicKey ( $ publicKey ) ; if ( $ request -> query -> has ( 'expandGroups' ) ) { foreach ( $ accessList as & $ rule ) { if ( ! isset ( $ rule [ 'group' ] ) ) { continue ; } $ rule [ 'resources' ] = $ accessControl -> getGroup ( $ rule [ 'group' ] ) ; } } $ model = new AccessRulesModel ( ) ; $ model -> setRules ( $ accessList ) ; $ event -> getResponse ( ) -> setModel ( $ model ) ; }
Get access rules for the specified public key

@param EventInterface $event The current event
Get access rules for the specified public key