Gets logged user info.
428914
protected function getUser()
    {
        $userData = [];

        if (config('visitlog.log_user')) {
            $name = '';
            $userNameFields = config('visitlog.user_name_fields');

            if (Auth::check()) {
                $user = Auth::user();
                $userData['user_id'] = $user->id;

                if (is_array($userNameFields)) {
                    foreach ($userNameFields as $userNameField) {
                        $name .= @$user->$userNameField . ' ';
                    }

                    $name = rtrim($name);
                } else {
                    $name = @$user->$userNameFields;
                }

                $userData['user_name'] = $name;
            } else {
                $userData['user_id'] = 0;
                $userData['user_name'] = 'Guest';
            }
        }

        return $userData;
    }
721354
public static function getPublicInfo()
    {
        if (empty(session('user'))) {
            throw new UnauthorizedException('There is no valid session for the current request.');
        }

        $sessionData = [
            'session_token'   => session('session_token'),
            'session_id'      => session('session_token'), // temp for compatibility with 1.x
            'id'              => session('user.id'),
            'name'            => session('user.display_name'),
            'first_name'      => session('user.first_name'),
            'last_name'       => session('user.last_name'),
            'email'           => session('user.email'),
            'is_sys_admin'    => session('user.is_sys_admin'),
            'last_login_date' => session('user.last_login_date'),
            'host'            => gethostname()
        ];

        $role = static::get('role');
        if (!session('user.is_sys_admin') && !empty($role)) {
            $sessionData['role'] = array_get($role, 'name');
            $sessionData['role_id'] = array_get($role, 'id');
        }

        return $sessionData;
    }
884026
def get_user_details(self, response):
        
        data = {}
        # None of them is mandatory
        data['id'] = response.get('user_id', None)
        data['username'] = response.get('custom_username', None)
        if not data['username']:
            data['username'] = response.get('ext_user_username', None)
        data['last_name'] = response.get('lis_person_name_family', None)
        data['email'] = response.get(
            'lis_person_contact_email_primary', None)
        data['first_name'] = response.get('lis_person_name_given', None)
        data['fullname'] = response.get('lis_person_name_full', None)
        logger.debug("User details being used: " + str(data))
        return data
166768
def userinfo_json(request, user_id):
    
    data = {'first_name': '',
            'last_name': '',
            'email': '',
            'slug': '',
            'bio': '',
            'phone': '',
            'is_active': False}

    try:
        member = StaffMember.objects.get(pk=user_id)
        for key in data.keys():
            if hasattr(member, key):
                data[key] = getattr(member, key, '')

    except StaffMember.DoesNotExist:
        pass

    return HttpResponse(json.dumps(data),
                        mimetype='application/json')
743297
def user_info(name, **client_args):
    '''
    
    '''
    matching_users = (user for user in list_users(**client_args)
                      if user.get('user') == name)

    try:
        return next(matching_users)
    except StopIteration:
        pass
455744
def get_logout_information(self, logout_token):
        """"""
        data = dict(logout_token=logout_token, app_id=self.app_id, app_secret=self.app_secret)
        logout_response = self._call('POST', self.logout_url, params=data)
        clef_user_id = logout_response.get('clef_id')
        return clef_user_id
696805
def get_user_info(self, request):
        
        user_info = {}

        try:
            ip_address = request.access_route[0]
        except IndexError:
            ip_address = request.remote_addr

        if ip_address:
            user_info['ip_address'] = ip_address

        if not has_flask_login:
            return user_info

        if not hasattr(current_app, 'login_manager'):
            return user_info

        try:
            is_authenticated = current_user.is_authenticated
        except AttributeError:
            # HACK: catch the attribute error thrown by flask-login is not attached
            # >   current_user = LocalProxy(lambda: _request_ctx_stack.top.user)
            # E   AttributeError: 'RequestContext' object has no attribute 'user'
            return user_info

        if callable(is_authenticated):
            is_authenticated = is_authenticated()

        if not is_authenticated:
            return user_info

        user_info['id'] = current_user.get_id()

        if 'SENTRY_USER_ATTRS' in current_app.config:
            for attr in current_app.config['SENTRY_USER_ATTRS']:
                if hasattr(current_user, attr):
                    user_info[attr] = getattr(current_user, attr)

        return user_info
274819
def get_userinfo(self, access_token, id_token, payload):
        """"""

        user_response = requests.get(
            self.OIDC_OP_USER_ENDPOINT,
            headers={
                'Authorization': 'Bearer {0}'.format(access_token)
            },
            verify=self.get_settings('OIDC_VERIFY_SSL', True))
        user_response.raise_for_status()
        return user_response.json()
28308
def get_user_info(self):
        
        response = self.get_proto(path='/user')
        message = yamcsManagement_pb2.UserInfo()
        message.ParseFromString(response.content)
        return UserInfo(message)
919189
def info(self, user_id):
        
        resp = self._rtm_client.get('v1/user.info?user_id={}'.format(user_id))
        if resp.is_fail():
            raise RTMServiceError('Failed to get user information', resp)

        return resp.data['result']
165837
def get_user_variables(self):
        """'"""
        # TODO: Check if some user fields are stored in other content_trees
        return [
            e.get('{%s}name' % e.nsmap.get('text'))[5:]
            for e in get_user_fields(self.content_trees[0], self.namespaces)
        ]
276380
def get_current_user():
    """"""
    thread_local = AutomatedLoggingMiddleware.thread_local
    if hasattr(thread_local, 'current_user'):
        user = thread_local.current_user
        if isinstance(user, AnonymousUser):
            user = None
    else:
        user = None

    return user
916241
def user_info(self, verbose=False):
        '''
        
        '''
        url = '{}/{}'.format(self.rest_url, 'user')
        return self.__auth_req_get(url, verbose=verbose)
1320887
def get_auth_info(self, **params):
        """"""
        response = self._get('v2', 'user', 'auth', params=params)
        return self._make_api_object(response, APIObject)
857392
def is_logged(self, user):
        """"""

        response = None
        if user.is_authenticated():
            if not user.needs_update:
                response = redirect('user_profile', username=user.username)

        return response
779872
def _get_user_data(self):
        

        url = self.session.host + '/sessions/' + str(self.session.id) + '/visualizations/' + str(self.id) + '/settings/'
        r = requests.get(url)
        if r.status_code == 200:
            content = r.json()
        else:
            raise Exception('Error retrieving user data from server')

        return content
384990
def get_user(self):
        
        for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'):
            user = os.environ.get(name)
            if user:
                break     
        for u in users:
            if u['name'] == user:
                return u['type'], u['name']