Return a list of logged in users for this minion, using the w command

    CLI Example:

    .. code-block:: bash

        salt '*' status.w
508966
def w():  # pylint: disable=C0103
    '''
    
    '''
    def linux_w():
        '''
        Linux specific implementation for w
        '''
        user_list = []
        users = __salt__['cmd.run']('w -fh').splitlines()
        for row in users:
            if not row:
                continue
            comps = row.split()
            rec = {'idle': comps[3],
                   'jcpu': comps[4],
                   'login': comps[2],
                   'pcpu': comps[5],
                   'tty': comps[1],
                   'user': comps[0],
                   'what': ' '.join(comps[6:])}
            user_list.append(rec)
        return user_list

    def bsd_w():
        '''
        Generic BSD implementation for w
        '''
        user_list = []
        users = __salt__['cmd.run']('w -h').splitlines()
        for row in users:
            if not row:
                continue
            comps = row.split()
            rec = {'from': comps[2],
                   'idle': comps[4],
                   'login': comps[3],
                   'tty': comps[1],
                   'user': comps[0],
                   'what': ' '.join(comps[5:])}
            user_list.append(rec)
        return user_list

    # dict that returns a function that does the right thing per platform
    get_version = {
        'Darwin': bsd_w,
        'FreeBSD': bsd_w,
        'Linux': linux_w,
        'OpenBSD': bsd_w,
    }

    errmsg = 'This method is unsupported on the current operating system!'
    return get_version.get(__grains__['kernel'], lambda: errmsg)()
1056846
def get_user_blocks(session, user_text):
    
    logger.debug("Getting user_blocks for {0}".format(user_text))
    doc = session.get(action='query', list='blocks', bkusers=user_text,
                      bkprop=['id'])
    return doc['query']['blocks']
1202151
def user_list(user=None, password=None, host=None, port=None, database='admin', authdb=None):
    '''
    
    '''
    conn = _connect(user, password, host, port, authdb=authdb)
    if not conn:
        return 'Failed to connect to mongo database'

    try:
        log.info('Listing users')
        mdb = pymongo.database.Database(conn, database)

        output = []
        mongodb_version = _version(mdb)

        if _LooseVersion(mongodb_version) >= _LooseVersion('2.6'):
            for user in mdb.command('usersInfo')['users']:
                output.append(
                    {'user': user['user'],
                     'roles': user['roles']}
                )
        else:
            for user in mdb.system.users.find():
                output.append(
                    {'user': user['user'],
                     'readOnly': user.get('readOnly', 'None')}
                )
        return output

    except pymongo.errors.PyMongoError as err:
        log.error('Listing users failed with error: %s', err)
        return six.text_type(err)
273617
def find_users(self, *args):
        
        if args:
            names = reduce(lambda query, arg: query |
                (Q(first_name__icontains=arg) | Q(last_name__icontains=arg)),
                args, Q())  # noqa
            users = User.objects.filter(names)
        # If no args given, check every user
        else:
            users = User.objects.all()
        # Display errors if no user was found
        if not users.count() and args:
            if len(args) == 1:
                raise CommandError('No user was found with the name %s' % args[0])
            else:
                arg_list = ', '.join(args)
                raise CommandError('No users found with the names: %s' % arg_list)
        return users
1272643
def construct_user_list(raw_users=None):
        """"""
        users = Users(oktypes=User)
        for user_dict in raw_users:
            public_keys = None
            if user_dict.get('public_keys'):
                public_keys = [PublicKey(b64encoded=x, raw=None)
                               for x in user_dict.get('public_keys')]
            users.append(User(name=user_dict.get('name'),
                              passwd=user_dict.get('passwd'),
                              uid=user_dict.get('uid'),
                              gid=user_dict.get('gid'),
                              home_dir=user_dict.get('home_dir'),
                              gecos=user_dict.get('gecos'),
                              shell=user_dict.get('shell'),
                              public_keys=public_keys,
                              sudoers_entry=user_dict.get('sudoers_entry')))
        return users
1160227
def list_tab(user):
    '''
    
    '''
    if user == 'system':
        data = raw_system_incron()
    else:
        data = raw_incron(user)
        log.debug('incron user data %s', data)
    ret = {'crons': [],
           'pre': []
           }
    flag = False
    comment = None
    tag = '# Line managed by Salt, do not edit'
    for line in data.splitlines():
        if line.endswith(tag):
            if len(line.split()) > 3:
                # Appears to be a standard incron line
                comps = line.split()
                path = comps[0]
                mask = comps[1]
                (cmd, comment) = ' '.join(comps[2:]).split(' # ')

                dat = {'path': path,
                       'mask': mask,
                       'cmd': cmd,
                       'comment': comment}
                ret['crons'].append(dat)
                comment = None
        else:
            ret['pre'].append(line)
    return ret
1117411
def GetUsers(alias=None):
		
		if alias is None:  alias = clc.v1.Account.GetAlias()
		r = clc.v1.API.Call('post','User/GetUsers',{'AccountAlias': alias})
		if int(r['StatusCode']) == 0:  
			return(r['Users'])
282218
def list_users(self, instance, limit=None, marker=None):
        """"""
        return instance.list_users(limit=limit, marker=marker)
544468
def users(self):
        
        # We do here some lazy loading.
        if not self._users:
            self._users = UserManager(self)
        return self._users
1314633
def users_list(self, permission_set=None, role=None, **kwargs):
        ""
        api_path = "/api/v2/users.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if permission_set:
            api_query.update({
                "permission_set": permission_set,
            })
        if role:
            api_query.update({
                "role": role,
            })
        return self.call(api_path, query=api_query, **kwargs)
480099
def get_users_for_assigned_to():
    
    User = get_user_model()
    return User.objects.filter(is_active=True, is_staff=True)
323031
def getent(refresh=False):
    '''
    
    '''
    if 'user.getent' in __context__ and not refresh:
        return __context__['user.getent']

    ret = []
    for data in pwd.getpwall():
        ret.append(info(data.pw_name))
    __context__['user.getent'] = ret
    return ret
733742
def auth_list():
    '''
    
    '''
    auths = {}

    ## read auth_attr file (name:res1:res2:short_desc:long_desc:attr)
    with salt.utils.files.fopen('/etc/security/auth_attr', 'r') as auth_attr:
        for auth in auth_attr:
            auth = salt.utils.stringutils.to_unicode(auth)
            auth = auth.split(':')

            # skip comments and non complaint lines
            if len(auth) != 6:
                continue

            # add auth info to dict
            if auth[0][-1:] == '.':
                auth[0] = '{0}*'.format(auth[0])
            auths[auth[0]] = auth[3]

    return auths
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
537381
def list_users(root=None):
    '''
    
    '''
    if root is not None:
        getspall = functools.partial(_getspall, root=root)
    else:
        getspall = functools.partial(spwd.getspall)

    return sorted([user.sp_namp if hasattr(user, 'sp_namp') else user.sp_nam
                   for user in getspall()])
1334830
def members(self):
        """"""
        result = list()
        for member in self.run_command(command="replSetGetStatus", is_eval=False)['members']:
            result.append({
                "_id": member['_id'],
                "host": member["name"],
                "server_id": self._servers.host_to_server_id(member["name"]),
                "state": member['state']
            })
        return result
1048799
def list_users(root=None):
    '''
    
    '''
    if root is not None and __grains__['kernel'] != 'AIX':
        getpwall = functools.partial(_getpwall, root=root)
    else:
        getpwall = functools.partial(pwd.getpwall)

    return sorted([user.pw_name for user in getpwall()])