Retrieves the user's services.

@return array
967749
public function getServices()
        {
            return isset($this->_data[self::PROFILE][self::SERVICES]) ? $this->_data[self::PROFILE][self::SERVICES] : null;
        }
659680
protected function getContactsByUserSystem()
    {
        $repo = $this->get('sulu_security.user_repository');
        $users = $repo->findUserBySystem($this->getParameter('sulu_security.system'));
        $contacts = [];

        foreach ($users as $user) {
            $contacts[] = $user->getContact();
        }

        return $contacts;
    }
1209388
public function getServices()
    {

        // Time?
        if (!empty($this->settings['timer'])) {
            $t = new Timer('Services');
        }

        // We allowed?
        if (empty($this->settings['show']['services']) || !is_array($this->settings['services']) || count($this->settings['services']) == 0) {
            return [];
        }

        // Temporarily keep statuses here
        $statuses = [];

        $this->settings['services']['executables'] = (array) $this->settings['services']['executables'];
        $this->settings['services']['pidFiles'] = (array) $this->settings['services']['pidFiles'];

        // Convert paths of executables to PID files
        $pids = [];
        $do_process_search = false;
        if (count($this->settings['services']['executables']) > 0) {
            $potential_paths = @glob('/proc/*/cmdline');
            if (is_array($potential_paths)) {
                $num_paths = count($potential_paths);
                $do_process_search = true;
            }
        }

        // Should we go ahead and do the PID search based on executables?
        if ($do_process_search) {
            // Precache all process cmdlines
            for ($i = 0; $i < $num_paths; ++$i) {
                $cmdline_cache[$i] = explode("\x00", Common::getContents($potential_paths[$i]));
            }

            // Go through the list of executables to search for
            foreach ($this->settings['services']['executables'] as $service => $exec) {
                // Go through pid file list. for loops are faster than foreach
                for ($i = 0; $i < $num_paths; ++$i) {
                    $cmdline = $cmdline_cache[$i];
                    $match = false;
                    if (is_array($exec)) {
                        $match = true;
                        foreach ($exec as $argn => $argv) {
                            if (isset($cmdline[$argn]) && $cmdline[$argn] != $argv) {
                                $match = false;
                            }
                        }
                    } elseif ($cmdline[0] == $exec) {
                        $match = true;
                    }
                    // If this one matches, stop here and save it
                    if ($match) {
                        // Get pid out of path to cmdline file
                        $pids[$service] = substr($potential_paths[$i], 6 /*strlen('/proc/')*/,
                                                strpos($potential_paths[$i], '/', 7) - 6);
                        break;
                    }
                }
            }
        }

        // PID files
        foreach ($this->settings['services']['pidFiles'] as $service => $file) {
            $pid = Common::getContents($file, false);
            if ($pid != false && is_numeric($pid)) {
                $pids[$service] = $pid;
            }
        }

        // Deal with PIDs
        foreach ($pids as $service => $pid) {
            $path = '/proc/'.$pid.'/status';
            $status_contents = Common::getContents($path, false);
            if ($status_contents == false) {
                $statuses[$service] = array('state' => 'Down', 'threads' => 'N/A', 'pid' => $pid);
                continue;
            }

            // Attempt getting info out of it
            if (!preg_match_all('/^(\w+):\s+(\w+)/m', $status_contents, $status_matches, PREG_SET_ORDER)) {
                continue;
            }

            // Initially set these as pointless
            $state = false;
            $threads = false;
            $mem = false;

            // Go through
            for ($i = 0, $num = count($status_matches); $i < $num; ++$i) {

                // What have we here?
                switch ($status_matches[$i][1]) {

                    // State section
                    case 'State':
                        switch ($status_matches[$i][2]) {
                            case 'D': // blocked on disk IO
                            case 'S':
                                $state = 'Up (Sleeping)';
                            break;
                            case 'Z':
                                $state = 'Zombie';
                            break;
                            // running
                            case 'R':
                                $state = 'Up (Running)';
                            break;
                            // stopped
                            case 'T':
                                $state = 'Up (Stopped)';
                            break;
                        }
                    break;

                    // Mem usage
                    case 'VmRSS':
                        if (is_numeric($status_matches[$i][2])) {
                            $mem = $status_matches[$i][2] * 1024;
                        } // Measured in kilobytes; we want bytes
                    break;

                    // Thread count
                    case 'Threads':
                        if (is_numeric($status_matches[$i][2])) {
                            $threads = $status_matches[$i][2];
                        }

                        // Thread count should be last. Stop here to possibly save time assuming we have the other values
                        if ($state !== false && $mem !== false && $threads !== false) {
                            break;
                        }
                    break;
                }
            }

            // Save info
            $statuses[$service] = array(
                'state' => $state ? $state : '?',
                'threads' => $threads,
                'pid' => $pid,
                'memory_usage' => $mem,
            );
        }

        return $statuses;
    }
820074
public function getUsers() {
        $routeUser = $this->getUser();
        $queryUsers = $this->query->get('users', []);

        if (!$routeUser && !$queryUsers) {
            return [];
        } elseif (!$queryUsers) {
            return [$routeUser];
        } elseif (!$routeUser) {
            return $queryUsers;
        }

        return array_merge([$routeUser], $queryUsers);
    }
1302254
public function getUserService()
    {
        if (null === $this->userService) {
            $this->userService = new UserService(
                $this->client,
                $this->inputDispatcher,
                $this->outputVisitor,
                $this->requestParser
            );
        }

        return $this->userService;
    }
979269
public function getAvailableRoles()
    {
        Piwik::checkUserHasSomeAdminAccess();

        $response = array();

        foreach ($this->roleProvider->getAllRoles() as $role) {
            $response[] = array(
                'id' => $role->getId(),
                'name' => $role->getName(),
                'description' => $role->getDescription(),
                'helpUrl' => $role->getHelpUrl(),
            );
        }

        return $response;
    }
124648
protected function getContext(): array
	{
		if($this->app->isCommandLine() === false && $this->container->has(Gatekeeper::class))
		{
			$user = $this->container->get(Gatekeeper::class)->getUser();

			return ['user_id' => $user !== null ? $user->getId() : null];
		}

		return [];
	}
841243
public function getFilters()
    {
        $roles = user_roles(true);
        unset($roles[DRUPAL_AUTHENTICATED_RID]);

        return [
            (new Filter('status', $this->t("Active")))->setChoicesMap(
                [
                    0 => $this->t("No"),
                    1 => $this->t("Yes"),
                ]
            ),
            (new Filter('role', $this->t("Role")))->setChoicesMap($roles),
            (new Filter('name', $this->t("Name"))),
        ];
    }
354288
public function getData()
    {
        return [
            'user___user__view_profile' => 'View user profile',
            'user___user__view_own_profile' => [
                'type' => Item::TYPE_PERMISSION,
                'description' => 'View user own profile',
                'rule' => new UpdateOwnDataRule(),
                'children' => ['user___user__view_profile']
            ],
            'user' => [
                'type' => Item::TYPE_ROLE,
                'description' => 'User',
                'children' => ['user___user__view_own_profile'],
            ],
            'admin' => [
                'type' => Item::TYPE_ROLE,
                'description' => 'Admin',
                'children' => ['user___user__view_profile']
            ],
            'owner' => [
                'type' => Item::TYPE_ROLE,
                'description' => 'Application owner',
                'children' => ['admin'],
            ]
        ];
    }
78139
public function getUsers()
    {
        if ($this->users === null) {
            $this->setUsers($this->userRepository->getAllByEnvironment($this));
        }
        return $this->users;
    }
1156104
public function getServiceIds()
    {
        return array_unique(array_merge(['service_container'], array_keys($this->fileMap), array_keys($this->methodMap), array_keys($this->services)));
    }
849555
public function getUser() {
        $session = $this->session_manager->session;

        if ($session && !$this->user) {
            $user_id = $session->get(Auth::getName());

            if ($user_id && is_null($this->user)) {
                $user_model = Config::get('auth.providers.users.model');

                if ($user_model) {
                    $this->user = $user_model::find($user_id);
                }
            } else {
                $this->user = null;
            }
        }

        return $this->user;
    }
1211206
public function getUsersHavingSuperUserAccess()
    {
        Piwik::checkUserIsNotAnonymous();

        $users = $this->model->getUsersHavingSuperUserAccess();
        $users = $this->enrichUsers($users);

        // we do not filter these users by access and return them all since we need to print this information in the
        // UI and they are allowed to see this.

        return $users;
    }
1374332
public function getResources()
    {
        $services = [];
        foreach (ServiceManager::getServiceNames(true) as $serviceName) {
            if (Session::allowsServiceAccess($serviceName)) {
                $services[] = [static::getResourceIdentifier() => $serviceName];
            }
        }

        return $services;
    }
630767
public function getServiceConfig()
    {
        return [
            'aliases' => [
                //for controller/view helpers to work
                'Zend\Authentication\AuthenticationService' => 'ZF\MvcAuth\Authentication',
                //'Zend\Authentication\AuthenticationService' => 'KapSecurity\Authentication\AuthenticationService',
                //'ZF\OAuth2\Adapter\PdoAdapter' => 'KapSecurity\OAuth2\PdoAdapter'
            ],
            'factories' => array(
                //'KapSecurity\OAuth2\PdoAdapter' => 'KapSecurity\OAuth2\PdoAdapter',
                'KapSecurity\OAuth2\PdoAdapter' => function($services) {
                        $config = $services->get('Config');

                        if (!isset($config['zf-oauth2']['db']) || empty($config['zf-oauth2']['db'])) {
                            throw new \RuntimeException(
                                'The database configuration [\'zf-oauth2\'][\'db\'] for OAuth2 is missing'
                            );
                        }

                        $username = isset($config['zf-oauth2']['db']['username']) ? $config['zf-oauth2']['db']['username'] : null;
                        $password = isset($config['zf-oauth2']['db']['password']) ? $config['zf-oauth2']['db']['password'] : null;
                        $options  = isset($config['zf-oauth2']['db']['options']) ? $config['zf-oauth2']['db']['options'] : array();

                        $oauth2ServerConfig = array();
                        if (isset($config['zf-oauth2']['storage_settings']) && is_array($config['zf-oauth2']['storage_settings'])) {
                            $oauth2ServerConfig = $config['zf-oauth2']['storage_settings'];
                        }

                        return new OAuth2\PdoAdapter(array(
                            'dsn'      => $config['zf-oauth2']['db']['dsn'],
                            'username' => $username,
                            'password' => $password,
                            'options'  => $options,
                        ), $oauth2ServerConfig);
                    },
                'KapSecurity\Authentication\Adapter\AdapterManager' => function($sm) {
                        $config = $sm->get('Config');

                        $managerConfig = [];
                        if(!empty($config['authentication_adapter_manager']) && !empty($config['authentication_adapter_manager']['adapters'])) {
                            $managerConfig = $config['authentication_adapter_manager']['adapters'];
                        }

                        $ins = new AdapterManager(new Config($managerConfig), $sm->get('KapSecurity\Authentication\Options'));
                        return $ins;
                    },
                'KapSecurity\Authentication\AuthenticationService' => function($sm) {
                        $ins = new AuthenticationService(
                            $sm->get('KapSecurity\Authentication\Options'),
                            $sm->get('KapSecurity\\IdentityAuthenticationRepository'),
                            $sm->get('KapSecurity\\IdentityRepository'),
                            $sm->get('KapSecurity\Authentication\Adapter\AdapterManager')
                        );
                        $ins->setStorage(new NonPersistent());
                        return $ins;
                    },
                'KapSecurity\Authentication\Options' => function($sm) {
                        $config = $sm->get('Config');
                        $options = empty($config['authentication']) ? [] : $config['authentication'];
                        return new Options($options);
                    },
                'KapSecurity\\IdentityRepository' => function($sm) {
                        $ins = new IdentityRepository(
                            $sm->get('KapSecurity\V1\Rest\Identity\IdentityResource\Table')
                        );
                        return $ins;
                    },
                "KapSecurity\\V1\\Rest\\Identity\\IdentityResource" => function($sm) {
                        $ins = new \KapApigility\EntityRepositoryResource(
                            $sm->get('KapSecurity\\IdentityRepository')
                        );
                        return $ins;
                    },
                'KapSecurity\\IdentityAuthenticationRepository' => function($sm) {
                        $ins = new IdentityAuthenticationRepository(
                            $sm->get('KapSecurity\V1\Rest\IdentityAuthentication\IdentityAuthenticationResource\Table')
                        );
                        return $ins;
                    },
                "KapSecurity\\V1\\Rest\\IdentityAuthentication\\IdentityAuthenticationResource" => function($sm) {
                        $ins = new \KapApigility\EntityRepositoryResource(
                            $sm->get('KapSecurity\\IdentityAuthenticationRepository')
                        );
                        return $ins;
                    },
            )
        ];
    }
810735
public function getUsers() {
    $tmp = array();
    foreach ($this->htpwd as $key => $line) {
      if(empty($line) || !strpos($line,':')) continue;
      array_push($tmp,explode(":",$line)[0]);
    }
    return $tmp;
  }
739507
protected function getService()
    {
        if (!isset($this->service)) {
            $this->service = $this->getServiceLocator()
                    ->get($this->getModuleNamespace() . '\Service\\' . $this->getEntityName());
        }

        return $this->service;
    }