Get the alternative this user is enrolled in.
340674
def get_alternative(self, experiment_name):
        
        experiment = None
        try:
            # catching the KeyError instead of using .get so that the experiment is auto created if desired
            experiment = experiment_manager[experiment_name]
        except KeyError:
            pass
        if experiment:
            if experiment.is_displaying_alternatives():
                alternative = self._get_enrollment(experiment)
                if alternative is not None:
                    return alternative
            else:
                return experiment.default_alternative
        return conf.CONTROL_GROUP
998831
def assignee(self):
        
        if self.api and self.assignee_id:
            return self.api._get_user(self.assignee_id)
724307
def get_user_token():
    """"""
    if not hasattr(stack.top, 'current_user'):
        return ''
    current_user = stack.top.current_user
    return current_user.get('token', '')
496040
def options(self):
        """"""
        roles = db.Role.all()

        return self.make_response({
            'roles': roles,
            'authSystems': list(current_app.available_auth_systems.keys()),
            'activeAuthSystem': current_app.active_auth_system.name
        })
39500
def get(self, user_id):
        """"""
        path = '/'.join(['person', user_id])
        return self.rachio.get(path)
1070470
def get_user(self, username):
        """"""
        ret = {}
        tmp = self._get_user(self._byte_p2(username), ALL_ATTRS)
        if tmp is None:
            raise UserDoesntExist(username, self.backend_name)
        attrs_tmp = tmp[1]
        for attr in attrs_tmp:
            value_tmp = attrs_tmp[attr]
            if len(value_tmp) == 1:
                ret[attr] = value_tmp[0]
            else:
                ret[attr] = value_tmp
        return ret
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
1138534
def user(self, extra_params=None):
        
        if self.get('assigned_to_id', None):
            users = self.space.users(
                id=self['assigned_to_id'],
                extra_params=extra_params
            )
            if users:
                return users[0]
240949
public Enrollment enroll(String user, String secret) throws EnrollmentException, InvalidArgumentException {
        return enroll(user, secret, new EnrollmentRequest());
    }
690984
def get(self, identifier):
        """"""
        for provider in self._providers:
            if provider.identifier == identifier:
                return provider
        return None
898440
def me(self):
        
        self_id = self._state.user.id
        return self.get_member(self_id)
946953
def get_option(self, key, default=None):
        """"""
        if self.synchronizer:
            return self.extra_opts.get(key, self.synchronizer.options.get(key, default))
        return self.extra_opts.get(key, default)
296955
def get(key, default=-1):
        """"""
        if isinstance(key, int):
            return Option(key)
        if key not in Option._member_map_:
            extend_enum(Option, key, default)
        return Option[key]
1321298
public static Optional<String> getCurrentTenant() {
        final UserDetails userDetails = getCurrentUser();
        if (!(userDetails instanceof UserPrincipal)) {
            return Optional.empty();
        }

        final UserPrincipal userPrincipal = (UserPrincipal) userDetails;
        return Optional.of(userPrincipal.getTenant().trim());
    }
997819
def get(self, option, default=None):
        ''''''
        val = self[option]
        return (val is None and default) or val
140079
def get_user(self, idvalue, options=None):
        
        options = options or {}
        data = options.copy()
        data['id'] = idvalue
        return self.api_get('user', data)
1238397
def get_user_from_identifier(settings, identifier):
    """"""
    providers = list(auth.strip() for auth in settings.get('authenticators').split(','))
    identities = Identity.find_all(Identity.provider.in_(providers), Identity.identifier == identifier)
    if identities:
        return sorted(identities, key=lambda x: providers.index(x.provider))[0].user
    for provider in providers:
        try:
            identity_info = multipass.get_identity(provider, identifier)
        except IdentityRetrievalFailed:
            continue
        if identity_info is None:
            continue
        if not identity_info.provider.settings.get('trusted_email'):
            continue
        emails = {email.lower() for email in identity_info.data.getlist('email') if email}
        if not emails:
            continue
        user = User.find_first(~User.is_deleted, User.all_emails.in_(list(emails)))
        if user:
            return user