getServiceLocator()->get(PermissionInterface::SERVICE_ID); if (!in_array($right, $provider->getSupportedRights())) { return $resourceIds; } $permissions = $provider->getPermissions($this->getCurrentUser(),$resourceIds); return array_filter($resourceIds, function($id) use ($right, $permissions){ return isset($permissions[$id]) && in_array($right, $permissions[$id]); }); } private function getCurrentUser(): User { /** @noinspection PhpIncompatibleReturnTypeInspection */ return $this->getServiceLocator()->get(SessionService::SERVICE_ID)->getCurrentUser(); } }