List authorization for user

    user : string
        username
    computed : boolean
        merge results from `auths` command into data from user_attr

    CLI Example:

    .. code-block:: bash

        salt '*' rbac.auth_get leo
514405
def auth_get(user, computed=True):
    '''
    
    '''
    user_auths = []

    ## read user_attr file (user:qualifier:res1:res2:attr)
    with salt.utils.files.fopen('/etc/user_attr', 'r') as user_attr:
        for auth in user_attr:
            auth = salt.utils.stringutils.to_unicode(auth)
            auth = auth.strip().split(':')

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

            # skip other users
            if auth[0] != user:
                continue

            # parse attr
            attrs = {}
            for attr in auth[4].strip().split(';'):
                attr_key, attr_val = attr.strip().split('=')
                if attr_key in ['auths', 'profiles', 'roles']:
                    attrs[attr_key] = attr_val.strip().split(',')
                else:
                    attrs[attr_key] = attr_val
            if 'auths' in attrs:
                user_auths.extend(attrs['auths'])

    ## also parse auths command
    if computed:
        res = __salt__['cmd.run_all']('auths {0}'.format(user))
        if res['retcode'] == 0:
            for auth in res['stdout'].splitlines():
                if ',' in auth:
                    user_auths.extend(auth.strip().split(','))
                else:
                    user_auths.append(auth.strip())

    return list(set(user_auths))
523126
function isAdmin(options, username) {
	return (options.configParams.get("orion.auth.user.creation") || "").split(",").some(function(user) {
		return user === username;
	});
}
279561
def get_authorization(self, **kwargs):
        """"""
        if self.authorization is not None:
            return self.authorization

        auth_class = self.get_authorization_class()
        auth_user = self.get_authorization_user()
        auth_kwargs = {
            'token': self.get_authorization_token(**kwargs)
        }

        if auth_user and auth_user.is_authenticated():
            auth_kwargs['created_user'] = self.get_authorization_user()

        self.authorization = auth_class.objects.get_by_token_or_404(
            **auth_kwargs
        )
        return self.authorization
1189331
function getAuthorization(user, auth) {
    if (auth === AUTH_BASIC) {
        return 'Basic ' + btoa(user.username + ':' + user.password);
    } else if (auth === AUTH_TOKEN) {
        return 'Token token=' + user.token;
    }
}
22922
def auth_list(**kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('auth:group:list', **{
        'storage': ctx.repo.create_secure_service('storage'),
    })
1352581
def basic_auth(self, username, password):
        
        if not (username and password):
            return

        self.auth = (username, password)

        # Disable token authentication
        self.headers.pop('Authorization', None)
53579
def _usernamesToSidObjects(cls, val, **kwargs):
        '''
        
        '''
        if not val:
            return val
        if isinstance(val, six.string_types):
            val = val.split(',')
        sids = []
        for _user in val:
            try:
                sid = win32security.LookupAccountName('', _user)[0]
                sids.append(sid)
            # This needs to be more specific
            except Exception as e:
                log.exception('Handle this explicitly')
                raise CommandExecutionError((
                    'There was an error obtaining the SID of user "{0}". Error '
                    'returned: {1}'
                    ).format(_user, e))
        return sids
1186045
def getUserAuthorizations(self, login, user):
    
    self.send_getUserAuthorizations(login, user)
    return self.recv_getUserAuthorizations()
1017634
def authDomainUser(self, realmname, username, password, environ):
        """"""
        try:
            apikey = self.user_manager.get_user_api_key(username, create=None)
            return apikey is not None and password == apikey
        except:
            return False
1162363
def list_userpass(self, mount_point='userpass'):
        
        try:
            return self._adapter.get('/v1/auth/{}/users'.format(mount_point), params={'list': True}).json()
        except exceptions.InvalidPath:
            return None
161494
def register_list_auth_roles_command(self, list_auth_roles_func):
        
        description = "List authorization roles for use with add_user command."
        list_auth_roles_parser = self.subparsers.add_parser('list-auth-roles', description=description)
        list_auth_roles_parser.set_defaults(func=list_auth_roles_func)
603662
def sync_auth_info(options = {})

      opts = {
        "RunSynchAutoInfo" => 'True',
        "EmailEPP" => 'True'
      }
      opts["EmailEPP"] = 'True' if options[:email]

      Client.request({"Command" => "SynchAuthInfo", "SLD" => sld, "TLD" => tld}.merge(opts))
      return self
    end
427785
def auth(self):
        
        if self.oauth:
            return self.oauth
        return (self.username, self.password)
1315268
def get_authorization(self):
        
        auth = get_authorization_header()

        if not auth:
            return None

        auth_type, auth_info = auth

        if auth_type != b'basic':
            return None

        try:
            username, password = base64.b64decode(auth_info).split(b':', 1)
        except Exception:
            return None

        return Authorization('basic', username=bytes_to_wsgi(username), password=bytes_to_wsgi(password))
63949
def get_auth(self):
        '''  '''
        return (self._cfgparse.get(self._section, 'username'), self._cfgparse.get(self._section, 'password'))
12117
def check_auth(self, name):
        
        if name in self.auths:
            # if the command name is in the **need authorization list**
            # get the authorization for the command
            auth = self.auths[name]
            if self.args.auth is None:
                # if we didn't pass the authorization phrase raise the
                # appropriate exception
                raise exceptions.ArgParseInatorAuthorizationRequired
            elif ((auth is True and self.args.auth != self.auth_phrase) or
                  (auth is not True and self.args.auth != auth)):
                # else if the authorization phrase is wrong
                raise exceptions.ArgParseInatorNotValidAuthorization
        return True
1054386
def list_user_permissions(name, runas=None):
    '''
    
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'list_user_permissions', name, '-q'],
        reset_system_locale=False,
        runas=runas,
        python_shell=False)

    return _output_to_dict(res)