@param string $service   - API name of the service
@param int    $requestor - Entity type requesting the service

@returns boolean
193004
public static function allowsServiceAccess($service, $requestor = ServiceRequestorTypes::API)
    {
        if (static::isSysAdmin()) {
            return true;
        }

        $roleId = Session::getRoleId();
        if ($roleId && !Role::getCachedInfo($roleId, 'is_active')) {
            return false;
        }

        $services = (array)static::get('role.services');
        $service = strval($service);

        //  If exact match found take it, otherwise follow up the chain as necessary
        //  All - Service - Component - Sub-component
        $allAllowed = VerbsMask::NONE_MASK;
        $allFound = false;
        $serviceAllowed = VerbsMask::NONE_MASK;
        $serviceFound = false;
        foreach ($services as $svcInfo) {
            $tempRequestors = array_get($svcInfo, 'requestor_mask', ServiceRequestorTypes::API);
            if (!($requestor & $tempRequestors)) {
                //  Requestor type not found in allowed requestors, skip access setting
                continue;
            }

            $tempService = strval(array_get($svcInfo, 'service'));
            $tempVerbs = array_get($svcInfo, 'verb_mask');

            if (0 == strcasecmp($service, $tempService)) {
                $serviceAllowed |= $tempVerbs;
                $serviceFound = true;
            } elseif (empty($tempService)) {
                $allAllowed |= $tempVerbs;
                $allFound = true;
            }
        }

        if ($serviceFound) {
            return (VerbsMask::NONE_MASK !== $serviceAllowed);
        } elseif ($allFound) {
            return (VerbsMask::NONE_MASK !== $allAllowed);
        }

        return false;
    }
83182
protected function processIsGranted(RequesterInterface $requester, ResourceInterface $resource, $action, &$buffer = [])
    {
        try {
            $permission = $this->findPermission($requester, $resource);

            $isGranted = $permission->isGranted($action);
        } catch (PermissionNotFoundException $e) {
            $this->permissionBuffer->add($this->initPermission($requester, $resource, 0));

            $isGranted = false;
        }

        if (false === $isGranted && $requester instanceof CascadingRequesterInterface) {
            $buffer[] = $requester->getAclRequesterIdentifier();

            foreach ($requester->getAclParentsRequester() as $requesterParent) {
                if (in_array($requesterParent->getAclRequesterIdentifier(), $buffer)) {
                    return $isGranted;
                }

                $buffer[] = $requesterParent->getAclRequesterIdentifier();
                if (true === $this->processIsGranted($requesterParent, $resource, $action, $buffer)) {
                    return true;
                }
            }
        }

        return $isGranted;
    }
782535
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /**
         * @var \Zend\ServiceManager\ServiceLocatorAwareTrait $serviceLocator
         */
        $sl = $serviceLocator->getServiceLocator();

        /**
         * @var \Mp3\Form\Search $formSearch
         */
        $formSearch = $sl->get('FormElementManager')
                         ->get('Mp3\Form\Search');

        /**
         * @var \Mp3\Service\Index $serviceIndex
         */
        $serviceIndex = $sl->get('Mp3\Service\Index');

        return new IndexController(
            $formSearch,
            $serviceIndex
        );
    }
1059874
public function post(Provider $provider, $userId, $requestScope, $requestUri, array $postBody, array $requestHeaders = [])
    {
        return $this->send($provider, $userId, $requestScope, Request::post($requestUri, $postBody, $requestHeaders));
    }
1122970
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        if (substr($name, -5) != 'table') {
            return false;
        }

        if (empty($this->config)) {
            $config = $serviceLocator->get('config');
            $this->config = isset($config['tables']) ? $config['tables'] : [];
        }

        if (!isset($this->config[$requestedName])) {
            return false;
        }

        return true;
    }
1221418
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        return $this->getContainer($serviceLocator)->has($requestedName);
    }
1349551
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $serviceManager = $serviceLocator instanceof AbstractPluginManager ?
            $serviceLocator->getServiceLocator() : $serviceLocator;

        $config = $serviceManager->get('config');

        $dataMapperSpec      = $config['thorr_persistence_dmm']['doctrine']['adapters'][$requestedName];
        $dataMapperClassName = is_string($dataMapperSpec) ? $dataMapperSpec : $dataMapperSpec['class'];

        $entityClass = array_search($requestedName, $config['thorr_persistence_dmm']['entity_data_mapper_map']);

        $objectManagerServiceName = isset($dataMapperSpec['object_manager']) ? $dataMapperSpec['object_manager'] : null;

        $objectManager = $this->getObjectManagerService($serviceManager, $objectManagerServiceName);

        $instance = new $dataMapperClassName($entityClass, $objectManager);

        if (! $instance instanceof DoctrineAdapter) {
            throw new Exception\ServiceNotCreatedException(sprintf(
                'Invalid data mapper type: "%s" is not a subtype of "%s"',
                $dataMapperClassName,
                DoctrineAdapter::class
            ));
        }

        return $instance;
    }
613915
public function formatServiceDescription($service, $scalar = true)
    {
        return sprintf(
            $scalar ? self::SCALAR_FORMAT : self::NON_SCALAR_FORMAT,
            gettype($service),
            $scalar ? (string) $service : null
        );
    }
426606
public static function can_create_data_request_for_user($user, $requester = null) {
        $usercontext = \context_user::instance($user);

        return has_capability('tool/dataprivacy:makedatarequestsforchildren', $usercontext, $requester);
    }
850370
public function onClientRequest(RequestEvent $event)
    {
        $errors = $this->validator->validate($event->getRequest());

        if (count($errors)) {
            throw new RequestException((string) $errors);
        }
    }
1350039
public function addRequester($requester)
    {
        $leader = $this->_mixer;

        if ($leader->eql($requester)) {
            return false;
        }

        if ($requester->following($leader)) {
            return false;
        }

        if ($leader->blocking($requester)) {
            return false;
        }

        $edge = $this->getService('repos:actors.request')->findOrAddNew(array(
                'requester' => $requester,
                'requestee' => $leader,
            ));

        $edge->save();

        $this->resetStats(array($leader, $requester));
    }
1219438
public static function castFrom($requestUri, string $requestMethod = null)
    {
        if ($requestUri instanceof self) {
            return $requestUri;
        }

        return new self($requestUri, (string) $requestMethod);
    }
962139
public function validate(string $requestUri, string $requestMethod): bool
    {
        $route = $this->findRoute($this->filterUri($requestUri), $requestMethod);

        if ($route instanceof Route) {
            $this->buildValidRoute($route);
            return true;
        }

        $this->buildErrorRoute();

        return false;
    }
484742
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) {
        $interface = 'oat\search\base\command\OperatorConverterInterface';
        return (class_exists($requestedName) && in_array($interface , class_implements($requestedName)));
    }
985031
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $serviceName, $requestedName)
    {
        if (!isset($this->allowedServiceNames[$requestedName])) {
            throw new Exception\InvalidServiceNameException('Service "' . $requestedName . '" is not whitelisted');
        }


        if ($serviceLocator instanceof AbstractPluginManager) {
            /* @var $serviceLocator AbstractPluginManager */
            $this->serviceLocator = $serviceLocator->getServiceLocator();
        } else {
            $this->serviceLocator = $serviceLocator;
        }

        return parent::get($requestedName);
    }
1255095
public static function require_can_create_data_request_for_user($user, $requester = null) {
        $usercontext = \context_user::instance($user);

        require_capability('tool/dataprivacy:makedatarequestsforchildren', $usercontext, $requester);

        return true;
    }
102677
public function handleRequest($requestAction, $useSSL = false)
    {
        if ($useSSL) {
            $connection = ftp_ssl_connect($this->ftpServer, $this->ftpPort, $this->ftpConnectTimeout);
        } else {
            $connection = ftp_connect($this->ftpServer, $this->ftpPort, $this->ftpConnectTimeout);
        }
        if (!$connection) {
            //throw new BaseCodedException("FTP Connection Failed",BaseCodedException::ASSERT_FAILED);
            return false;
        }
        try {
            $auth_passed = ftp_login($connection, $this->ftpUsername, $this->ftpPassword);
            ftp_pasv($connection, $this->ftpUsePassive);
            if (!$auth_passed) {
                throw new BaseCodedException("FTP Login Failed", BaseCodedException::USER_NOT_PRIVILEGED);
            }

            $error = null;
            $done = call_user_func_array($requestAction, [$connection, &$error]);
            if (!$done) {
                throw new BaseCodedException($error);
            }

            ftp_close($connection);
            return true;
        } catch (\Exception $exception) {
            ftp_close($connection);
            return false;
        }
    }