List all admins
---------------
returns an array containing administrator objects for all sites
547186
public function list_all_admins()
    {
        if (!$this->is_loggedin) {
            return false;
        }

        $response = $this->exec_curl('/api/stat/admin');

        return $this->process_response($response);
    }
150162
public function all()
    {
        $endpoint = '/admin/users.json';
        $response = $this->request($endpoint);
        return $this->createCollection(User::class, $response['users']);
    }
1188538
private function getAllowedRedirectHosts()
    {
        $ini = eZINI::instance();
        $allowedHosts = array_fill_keys( $ini->variable( 'SiteSettings', 'AllowedRedirectHosts' ), true );
        // Adding HostMatchMapItems from siteaccess match if present
        if ( $ini->hasVariable( 'SiteAccessSettings', 'HostMatchMapItems' ) )
        {
            $hostMatchMapItems = $ini->variable( 'SiteAccessSettings', 'HostMatchMapItems' );
            foreach ( $hostMatchMapItems as $item )
            {
                list( $host, $sa ) = explode( ';', $item );
                $allowedHosts[$host] = true;
            }
        }

        // Adding HostUriMatchMapItems
        foreach ( $ini->variable( 'SiteAccessSettings', 'HostUriMatchMapItems' ) as $item )
        {
            list( $host, $uri, $sa ) = explode( ';', $item );
            $allowedHosts[$host] = true;
        }

        return $allowedHosts;
    }
1171194
def admin_menu 
      @admin_menu ||= [
        ['overview', :dashboard, {controller: 'gricer/dashboard', action: 'overview'}],
        ['visitors', :menu, [
          ['entry_pages', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'entry_path'}],
          ['referers', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'referer_host'}],
          ['search_engines', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'search_engine'}],
          ['search_terms', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'search_query'}],
          ['countries', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'country'}],
          ['domains', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'domain'}],
          ['locales', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'requested_locale_major'}]
        ] ],
        ['pages', :menu, [
          ['views', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'path'}],
          ['hosts', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'host'}],
          ['methods', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'method'}],
          ['protocols', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'protocol'}],
        ] ],
        ['browsers', :menu, [
          ['browsers', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'agent.name'}],
          ['operating_systems', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'agent.os'}],
          ['engines', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'agent.engine_name'}],
          ['javascript', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'javascript'}],
          ['java', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'java'}],
          ['silverlight', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'silverlight_major_version'}],
          ['flash', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'flash_major_version'}],
          ['screen_sizes', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'screen_size'}],
          ['color_depths', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'screen_depth'}]
        ] ]
      ]
    end
282218
def list_users(self, instance, limit=None, marker=None):
        """"""
        return instance.list_users(limit=limit, marker=marker)
1307271
def all_project_administrators(self):
        
        for project in self.project_list():
            log.info('Processing project: {0} - {1}'.format(project.get('key'), project.get('name')))
            yield {
                'project_key': project.get('key'),
                'project_name': project.get('name'),
                'project_administrators': [{'email': x['emailAddress'], 'name': x['displayName']}
                                           for x in self.project_users_with_administrator_permissions(project['key'])]}
367680
public List<AdminList> getAdminLists() {
        return this.adminLists.get().stream().sorted(Comparator.comparing(o -> o.getListClass().getSimpleName())).collect(Collectors.toList());
    }
147090
def list_sites():
    '''
    
    '''
    ret = dict()
    ps_cmd = ['Get-ChildItem',
              '-Path', r"'IIS:\Sites'",
              '|',
              'Select-Object applicationPool, applicationDefaults, Bindings, ID, Name, PhysicalPath, State']

    keep_keys = ('certificateHash', 'certificateStoreName', 'protocol', 'sslFlags')

    cmd_ret = _srvmgr(cmd=ps_cmd, return_json=True)

    try:
        items = salt.utils.json.loads(cmd_ret['stdout'], strict=False)
    except ValueError:
        raise CommandExecutionError('Unable to parse return data as Json.')

    for item in items:
        bindings = dict()

        for binding in item['bindings']['Collection']:

            # Ignore bindings which do not have host names
            if binding['protocol'] not in ['http', 'https']:
                continue

            filtered_binding = dict()

            for key in binding:
                if key in keep_keys:
                    filtered_binding.update({key.lower(): binding[key]})

            binding_info = binding['bindingInformation'].split(':', 2)
            ipaddress, port, hostheader = [element.strip() for element in binding_info]
            filtered_binding.update({'hostheader': hostheader,
                                     'ipaddress': ipaddress,
                                     'port': port})
            bindings[binding['bindingInformation']] = filtered_binding

        # ApplicationDefaults
        application_defaults = dict()

        for attribute in item['applicationDefaults']['Attributes']:
            application_defaults.update({attribute['Name']: attribute['Value']})
        # ApplicationDefaults

        ret[item['name']] = {'apppool': item['applicationPool'],
                             'bindings': bindings,
                             'applicationDefaults': application_defaults,
                             'id': item['id'],
                             'state': item['state'],
                             'sourcepath': item['physicalPath']}

    if not ret:
        log.warning('No sites found in output: %s', cmd_ret['stdout'])

    return ret
1053426
def list_principals():
    '''
    
    '''
    ret = {}

    cmd = __execute_kadmin('list_principals')

    if cmd['retcode'] != 0 or cmd['stderr']:
        ret['comment'] = cmd['stderr'].splitlines()[-1]
        ret['result'] = False

        return ret

    ret = {'principals': []}

    for i in cmd['stdout'].splitlines()[1:]:
        ret['principals'].append(i)

    return ret
55585
def _site_users():
    
    userlist = sudo("cat /etc/passwd | awk '/site/'").split('\n')
    siteuserlist = [user.split(':')[0] for user in userlist if 'site_' in user]
    return siteuserlist
154765
public function admin()
    {
        $currentuser = $this->getUser();
        $users = $this->users()->getUsers();
        $sessions = $this->accessControl()->getActiveSessions();

        foreach ($users as $name => $user) {
            if (($key = array_search(Permissions::ROLE_EVERYONE, $user['roles'], true)) !== false) {
                unset($users[$name]['roles'][$key]);
            }
        }

        $context = [
            'currentuser' => $currentuser,
            'users'       => $users,
            'sessions'    => $sessions,
        ];

        return $this->render('@bolt/users/users.twig', $context);
    }
1183498
def manage_admins():
    """"""
    build = g.build

    # Do not show cached data
    db.session.add(build)
    db.session.refresh(build)

    add_form = forms.AddAdminForm()
    if add_form.validate_on_submit():

        invitation_user_id = '%s:%s' % (
            models.User.EMAIL_INVITATION, add_form.email_address.data)

        invitation_user = models.User.query.get(invitation_user_id)
        if not invitation_user:
            invitation_user = models.User(
                id=invitation_user_id,
                email_address=add_form.email_address.data)
            db.session.add(invitation_user)

        db.session.add(build)
        db.session.add(invitation_user)
        db.session.refresh(build, lockmode='update')

        build.owners.append(invitation_user)
        save_admin_log(build, invited_new_admin=True,
                       message=invitation_user.email_address)

        db.session.commit()

        logging.info('Added user=%r as owner to build_id=%r',
                     invitation_user.id, build.id)
        return redirect(url_for('manage_admins', build_id=build.id))

    add_form.build_id.data = build.id

    revoke_form_list = []
    for user in build.owners:
        form = forms.RemoveAdminForm()
        form.user_id.data = user.id
        form.build_id.data = build.id
        form.revoke.data = True
        revoke_form_list.append((user, form))

    return render_template(
        'view_admins.html',
        build=build,
        add_form=add_form,
        revoke_form_list=revoke_form_list)
898525
def list_users(runas=None):
    '''
    
    '''
    # Windows runas currently requires a password.
    # Due to this, don't use a default value for
    # runas in Windows.
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'list_users', '-q'],
        reset_system_locale=False,
        runas=runas,
        python_shell=False)

    # func to get tags from string such as "[admin, monitoring]"
    func = lambda string: [x.strip() for x in string[1:-1].split(',')] if ',' in string else [x for x in
                                                                                              string[1:-1].split(' ')]
    return _output_to_dict(res, func)
1278245
def classes_can_admin(self):
        """"""
        if self.is_admin:
            return sorted(Session.query(Class).all())
        else:
            return sorted(self.admin_for)
91826
public function administrators(): Collection
    {
        return DB::table('user')
            ->join('user_setting', static function (JoinClause $join): void {
                $join
                    ->on('user_setting.user_id', '=', 'user.user_id')
                    ->where('user_setting.setting_name', '=', 'canadmin')
                    ->where('user_setting.setting_value', '=', '1');
            })
            ->where('user.user_id', '>', 0)
            ->orderBy('real_name')
            ->select(['user.*'])
            ->get()
            ->map(User::rowMapper());
    }
501409
private function adminModules()
    {
        $return = [];

        foreach ($this->app[ 'config' ]->get('modules.all') as $module) {
            $controller = '\\app\\'.$module.'\\Controller';

            if (!class_exists($controller)) {
                continue;
            }

            if (property_exists($controller, 'scaffoldAdmin') ||
                property_exists($controller, 'hasAdminView')) {
                $moduleInfo = [
                    'name' => $module,
                    'title' => Inflector::get()->titleize($module), ];

                if (property_exists($controller, 'properties')) {
                    $moduleInfo = array_replace($moduleInfo, $controller::$properties);
                }

                $return[] = $moduleInfo;
            }
        }

        return $return;
    }
1128770
def get_admin_enforcement(self):
        
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.protection_url + "/enforce_admins"
        )
        return data["enabled"]