Return the users logged in information from the device.
515150
def get_users_text(self):
        """"""
        users_text = None
        if self.users_cmd:
            try:
                users_text = self.device.send(self.users_cmd, timeout=60)
            except CommandError:
                self.log('Unable to collect connected users information')
        else:
            self.log('No users command for {}'.format(self.platform))
        return users_text
238790
def get_enroll(self):
        """"""

        devices = [DeviceRegistration.wrap(device) for device in self.__get_u2f_devices()]
        enroll  = start_register(self.__appid, devices)
        enroll['status'] = 'ok'

        session['_u2f_enroll_'] = enroll.json
        return enroll
1340540
def user_data(self, access_token, *args, **kwargs):
        """"""
        url = '{}/userinfo'.format(self.BASE_URL)
        response = self.get_json(
            url,
            headers={'Authorization': 'Bearer ' + access_token},
        )
        self.check_correct_audience(response['audience'])

        userdata = response['user']
        return userdata
1252255
def device_info(self):
        
        info = {
            'serial': self.serial,
            'model': self.model,
            'build_info': self.build_info,
            'user_added_info': self._user_added_device_info
        }
        return info
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
777526
def get_user_data(user=None,group=None,data_kind=DINGOS_USER_DATA_TYPE_NAME):
        
        logger.debug("Get user settings called")

        if not user.is_authenticated():
            user = None

        try:
            user_config =  UserData.objects.get(user=user,group=group,data_kind=data_kind)
            return user_config.retrieve()
        except:
            return None
965955
def user_info(self, kv):
        """"""

        key, value = kv
        self.__user_info[key] = value
203986
def people(self):
        ''''''
        people_response = self.get_request('people/')
        return [Person(self, pjson['user']) for pjson in people_response]
75920
def get_user_info(user):
    
    user = api.get_user(user)
    current = api.get_current_user()

    if api.is_anonymous():
        return {
            "username": current.getUserName(),
            "authenticated": False,
            "roles": current.getRoles(),
            "api_url": api.url_for("plone.jsonapi.routes.users", username="current"),
        }

    # nothing to do
    if user is None:
        logger.warn("No user found for {}".format(user))
        return None

    # plone user
    pu = user.getUser()

    info = {
        "username": user.getUserName(),
        "roles": user.getRoles(),
        "groups": pu.getGroups(),
        "authenticated": current == user,
        "api_url": api.url_for("senaite.jsonapi.v1.users", username=user.getId()),
    }

    for k, v in api.get_user_properties(user).items():
        if api.is_date(v):
            v = api.to_iso_date(v)
        if not api.is_json_serializable(v):
            logger.warn("User property '{}' is not JSON serializable".format(k))
            continue
        info[k] = v

    return info
212344
def get_info(self):
        """"""
        return [self.display_name.encode(),
                self.enabled and b'enabled' or b'disabled',
                STATE_NAMES[self.state].encode() + b':',
                self.last_printed_line.strip()]
71276
def API_GET(self):  # pylint: disable=arguments-differ
        
        if self.user_manager.session_logged_in():
            return 200, {"authenticated": True, "username": self.user_manager.session_username()}
        else:
            return 200, {"authenticated": False}
1269533
def _get_user(self) -> Dict:
        

        if 'callback_query' in self._update:
            return self._update['callback_query']['from']
        elif 'inline_query' in self._update:
            return self._update['inline_query']['from']
        elif 'message' in self._update:
            return self._update['message']['from']
1013207
def get_device_id(self, use_cached=True):
        """"""
        device_json = self.get_device_json(use_cached)
        return device_json["id"].get("devId")
34118
def get_users(self):
        """"""
        users = {}

        _JUNOS_CLASS_CISCO_PRIVILEGE_LEVEL_MAP = {
            "super-user": 15,
            "superuser": 15,
            "operator": 5,
            "read-only": 1,
            "unauthorized": 0,
        }

        _DEFAULT_USER_DETAILS = {"level": 0, "password": "", "sshkeys": []}

        users_table = junos_views.junos_users_table(self.device)
        users_table.get()
        users_items = users_table.items()
        root_user = self._get_root()

        for user_entry in users_items:
            username = user_entry[0]
            user_details = _DEFAULT_USER_DETAILS.copy()
            user_details.update({d[0]: d[1] for d in user_entry[1] if d[1]})
            user_class = user_details.pop("class", "")
            user_details = {
                key: py23_compat.text_type(user_details[key])
                for key in user_details.keys()
            }
            level = _JUNOS_CLASS_CISCO_PRIVILEGE_LEVEL_MAP.get(user_class, 0)
            user_details.update({"level": level})
            user_details["sshkeys"] = [
                user_details.pop(key)
                for key in ["ssh_rsa", "ssh_dsa", "ssh_ecdsa"]
                if user_details.get(key, "")
            ]
            users[username] = user_details
        users.update(root_user)
        return users
999051
def _get_user_info(self, access_token):
        """"""
        info_response = self._call('GET', self.info_url, params={'access_token': access_token})
        user_info = info_response.get('info')
        return user_info
1364331
def query_user_info(user):
    


    try:
        user_info = query_user_page(INIT_URL_USER.format(u=user))
        if user_info:
            logger.info(f"Got user information from username {user}")
            return user_info

    except KeyboardInterrupt:
        logger.info("Program interrupted by user. Returning user information gathered so far...")
    except BaseException:
        logger.exception("An unknown error occurred! Returning user information gathered so far...")

    logger.info(f"Got user information from username {user}")
    return user_info
544468
def users(self):
        
        # We do here some lazy loading.
        if not self._users:
            self._users = UserManager(self)
        return self._users