Writes user object for a user with a given name.
358527
def WriteGRRUser(self,
                   username,
                   password=None,
                   ui_mode=None,
                   canary_mode=None,
                   user_type=None):
    """"""
    u = self.users.setdefault(username, rdf_objects.GRRUser(username=username))
    if password is not None:
      u.password = password
    if ui_mode is not None:
      u.ui_mode = ui_mode
    if canary_mode is not None:
      u.canary_mode = canary_mode
    if user_type is not None:
      u.user_type = user_type
1039262
def cli(obj, show_userinfo):
    """"""
    client = obj['client']
    userinfo = client.userinfo()
    if show_userinfo:
        for k, v in userinfo.items():
            if isinstance(v, list):
                v = ', '.join(v)
            click.echo('{:20}: {}'.format(k, v))
    else:
        click.echo(userinfo['preferred_username'])
708418
def write_field_repr(self, name, out, visited):
        '''
        
        '''
        field_obj = self.pyop_field(name)
        field_obj.write_repr(out, visited)
353801
def get_user(self, name):
        """"""
        users = self.data['users']
        for user in users:
            if user['name'] == name:
                return user
        raise KubeConfError("user name not found.")
1269698
def _write_object(self, val, outstream):
        '''
        
        '''
        # first attempt using an existing custom serializer
        serializer = self.__lookup_serializer(getattr(val, '__class__'))
        if serializer is not None:
            serializer.serialize(self, val, outstream)
            return
        
        fields = self._fetch_obj_fields(val)
        validfields = [];
        encodedfields = []
        length = 0;
        for f in fields:
            encoded = self._encode_field_name(val, f)
            if encoded:
                encodedfields.append(encoded)
                validfields.append(f)
                length += 1;
        self.write_object_start(length, outstream)
        count = 0;
        if length > 0:
            mappedname = encodedfields[0]
            if mappedname is not None:
                count += 1
                self.write_object_field(mappedname, getattr(val, validfields[0]), outstream)
            idx = 1
            while idx < length:      
                name = validfields[idx]
                mappedname = encodedfields[idx]
                if mappedname is not None:
                    value = getattr(val, name)
                    if count > 0:
                        self.write_object_field_separator(mappedname, value, outstream)
                    self.write_object_field(mappedname, value, outstream)
                    count += 1
                idx += 1
        self.write_object_end(length, outstream)
1357742
def username(anon, obj, field, val):
    
    return anon.faker.user_name(field=field)
962730
def create_user(self, **kwargs):
        """"""
        roles = kwargs.pop('roles', [])
        user = self.user_model(**self._prepare_create_user_args(**kwargs))
        user = self.put(user)
        for role in roles:
            self.add_role_to_user(user, role)
        self.put(user)
        return user
340008
function User(data){
    var self = this;
    Object.keys(data).map(function(k){
      self[k] = data[k];
    });
  }
920600
def _write_user_prefs(self, user_prefs):
        
        with open(self.userPrefs, "w") as f:
            for key, value in user_prefs.items():
                f.write('user_pref("%s", %s);\n' % (key, json.dumps(value)))
159679
def user_update(self, username, data):
        
        url = 'rest/api/2/user?username={0}'.format(username)
        return self.put(url, data=data)
1305510
def add_user(self, **kwargs):
        """"""
        user = self.UserClass(**kwargs)
        if hasattr(user, 'active'):
            user.active = True
        self.db_adapter.add_object(user)
        return user
1112864
def _get_user(self, user):
        """"""
        return ' '.join([user.username, user.first_name, user.last_name])
688304
def user_name_attributes(user, service):
    """"""
    attributes = {}
    attributes['username'] = user.get_username()
    attributes['full_name'] = user.get_full_name()
    attributes['short_name'] = user.get_short_name()
    return attributes
212468
def write(self, obj, resource_id=None):
        
        if resource_id is not None:
            if self.read(resource_id):
                raise ValueError("There are one object already with this id.")
            obj['_id'] = resource_id
        prepared_creation_tx = self.driver.instance.transactions.prepare(
            operation='CREATE',
            signers=self.user.public_key,
            asset={
                'namespace': self.namespace,
                'data': obj
            },
            metadata={
                'namespace': self.namespace,
                'data': obj
            }
        )

        signed_tx = self.driver.instance.transactions.fulfill(
            prepared_creation_tx,
            private_keys=self.user.private_key
        )
        self.logger.debug('bdb::write::{}'.format(signed_tx['id']))
        self.driver.instance.transactions.send_commit(signed_tx)
        return signed_tx
977493
private void writeName(JsonGenerator jsonGenerator, Object entity) throws IOException {
        jsonGenerator.writeFieldName(NAME);
        if (entity instanceof EntitySet) {
            jsonGenerator.writeObject(((EntitySet) entity).getName());
        } else {
            jsonGenerator.writeObject(((Singleton) entity).getName());
        }
    }
813753
def name(username):
    """"""
    if not username:
        click.secho(dtool_config.utils.get_username(CONFIG_PATH))
    else:
        username_str = " ".join(username)
        click.secho(dtool_config.utils.set_username(CONFIG_PATH, username_str))
94707
def add_user(self, user_name, role='user'):
        
        role_uri = self._get_role_uri(role=role)
        return self.api.put(path=role_uri, data={'username': user_name})