Create a new user

@param {Object} details
@param {String} details.username
@param {String} details.group
@param {Function} done - done(err, user)
189107
function createUser({ username, group="public" }, done) {
  return getGroup(group, function(getGroupErr, theGroup) {
    if (getGroupErr) {
      return done(getGroupErr);
    }

    if (!theGroup) {
      return done(new Error(`group '${group}' not found`));
    }

    theGroup.members.add({ username });
    return theGroup.save(done);
  });
}
564032
function refreshJobDetail(jobId, detail) {
  // Overview parameters.
  var jobParams = $('#detail-params');
  jobParams.empty();

  var status = (detail.active ? 'running' : detail.result_status) || 'unknown';
  $('<li class="status-text">').text(status).appendTo(jobParams);

  $('<li>')
    .append($('<span class="param-key">').text('Elapsed time'))
    .append($('<span>').text(': '))
    .append($('<span class="param-value">').text(getElapsedTimeString(
          detail.start_timestamp_ms, detail.updated_timestamp_ms)))
    .appendTo(jobParams);
  $('<li>')
    .append($('<span class="param-key">').text('Start time'))
    .append($('<span>').text(': '))
    .append($('<span class="param-value">').text(getIso8601String(
          detail.start_timestamp_ms)))
    .appendTo(jobParams);

  $.each(FIXED_JOB_PARAMS, function(index, key) {
    // Skip some parameters or those with no values.
    if (key == 'name') return;
    var value = detail[key];
    if (!value) return;

    $('<li>')
      .append($('<span class="param-key">').text(getNiceParamKey(key)))
      .append($('<span>').text(': '))
      .append($('<span class="param-value">').text('' + value))
      .appendTo(jobParams);
  });

  // User-supplied parameters.
  if (detail.mapper_spec.mapper_params) {
    var sortedKeys = getSortedKeys(detail.mapper_spec.mapper_params);
    $.each(sortedKeys, function(index, key) {
      var value = detail.mapper_spec.mapper_params[key];
      var valueSpan = $('<span class="param-value">');
      renderCollapsableValue(value, valueSpan);
      $('<li>')
        .append($('<span class="user-param-key">').text(key))
        .append($('<span>').text(': '))
        .append(valueSpan)
        .appendTo(jobParams);
    });
  }

  // Graph image.
  var detailGraph = $('#detail-graph');
  detailGraph.empty();
  var chartTitle = 'Processed items per shard';
  if (detail.chart_data) {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Shard');
    data.addColumn('number', 'Count');
    var shards = detail.chart_data.length;
    for (var i = 0; i < shards; i++) {
      data.addRow([i.toString(), detail.chart_data[i]]);
    }
    var log2Shards = Math.log(shards) / Math.log(2);
    var chartWidth = Math.max(Math.max(300, shards * 2), 100 * log2Shards);
    var chartHeight = 200;
    var options = {
        legend: 'none',
        bar: {
            groupWidth: '100%'
        },
        vAxis: {
          minValue: 0
        },
        title: chartTitle,
        chartArea: {
          width: chartWidth,
          height: chartHeight
        },
        width: 80 + chartWidth,
        height: 80 + chartHeight
    };
    var chart = new google.visualization.ColumnChart(detailGraph[0]);
    chart.draw(data, options);
  } else {
    $('<div>').text(chartTitle).appendTo(detailGraph);
    $('<img>')
      .attr('src', detail.chart_url)
      .attr('width', detail.chart_width || 300)
      .attr('height', 200)
      .appendTo(detailGraph);
  }

  // Aggregated counters.
  var aggregatedCounters = $('#aggregated-counters');
  aggregatedCounters.empty();
  var runtimeMs = detail.updated_timestamp_ms - detail.start_timestamp_ms;
  var sortedCounters = getSortedKeys(detail.counters);
  $.each(sortedCounters, function(index, key) {
    var value = detail.counters[key];
    // Round to 2 decimal places.
    var avgRate = Math.round(100.0 * value / (runtimeMs / 1000.0)) / 100.0;
    $('<li>')
      .append($('<span class="param-key">').html(getNiceParamKey(key)))
      .append($('<span>').text(': '))
      .append($('<span class="param-value">').html(value))
      .append($('<span>').text(' '))
      .append($('<span class="param-aux">').text('(' + avgRate + '/sec avg.)'))
      .appendTo(aggregatedCounters);
  });

  // Set up the mapper detail.
  var mapperBody = $('#mapper-shard-status');
  mapperBody.empty();

  $.each(detail.shards, function(index, shard) {
    var row = $('<tr>');

    row.append($('<td>').text(shard.shard_number));

    var status = (shard.active ? 'running' : shard.result_status) || 'unknown';
    row.append($('<td>').text(status));

    // TODO: Set colgroup width for shard description.
    row.append($('<td>').text(shard.shard_description));

    row.append($('<td>').text(shard.last_work_item || 'Unknown'));

    row.append($('<td>').text(getElapsedTimeString(
        detail.start_timestamp_ms, shard.updated_timestamp_ms)));

    row.appendTo(mapperBody);
  });
}
906724
def create(config, name, group, type):
        """"""
        if type not in ('user', 'service'):
            raise click.BadOptionUsage("--type must be 'user' or 'service'")
        client = Client()
        client.prepare_connection()
        user_api = API(client)
        group_api = GroupApi(client)
        user_api.create(name[0], name[1], group, type, group_api)
657397
def handle_details(self, username):
        
        try:
            user = User.objects.get(username=username)
        except User.DoesNotExist:
            raise CommandError("Unable to find user '%s'" % username)

        self.stdout.write("username    : %s" % username)
        self.stdout.write("is_active   : %s" % user.is_active)
        self.stdout.write("is_staff    : %s" % user.is_staff)
        self.stdout.write("is_superuser: %s" % user.is_superuser)
        groups = [g.name for g in user.groups.all().order_by("name")]
        self.stdout.write("groups      : [%s]" % ", ".join(groups))
25244
def create_user(ctx):
    """"""

    try:
        new_user = _create_user(ctx)

        new_user.save()
        log("Done")
    except KeyError:
        log('User already exists', lvl=warn)
646593
def add_user_to_group(self, user, group_name):
        
        group, _ = Group.objects.get_or_create(name = group_name)
        group.user_set.add(user)
1146137
def record_set_details(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs)
619001
function(details, callback) {
        var self = this;

        // Required arguments
        var lb = {
            name: details.name,
            nodes: details.nodes,
            protocol: details.protocol ? details.protocol.name : '',
            port: details.protocol ? details.protocol.port : '',
            virtualIps: details.virtualIps
        };

        if (details.accessList) {
            lb.accessList = details.accessList;
        }

        if (details.algorithm) {
            lb.algorithm = details.algorithm;
        }

        if (details.connectionLogging) {
            lb.connectionLogging = details.connectionLogging;
        }

        if (details.connectionThrottle) {
            lb.connectionThrottle = details.connectionThrottle;
        }

        if (details.healthMonitor) {
            lb.healthMonitor = details.healthMonitor;
        }

        if (details.metadata) {
            lb.metadata = details.metadata;
        }

        if (details.timeout) {
            lb.timeout = details.timeout;
        }

        if (details.sessionPersistence) {
            lb.sessionPersistence = details.sessionPersistence;
        }

        var validationErrors = validateLbInputs(lb);

        if (validationErrors) {
            callback(validationErrors);
            return;
        }

        var requestOptions = {
            uri: '/loadbalancers',
            method: 'POST',
            data: {
                loadBalancer: lb
            },
            endpoint: rackspace.Endpoints.CloudLoadBalancer
        };

        self.authorizedRequest(requestOptions, function(err, res, body) {
            if (err || !body.loadBalancer) {
                callback(err ? err : body);
                return;
            }

            callback(err, new rackspace.LoadBalancer(self, body.loadBalancer));
        });
    }
1227590
function(details) {
        var self = this;

        this.id = details.id;
        this.name = details.name;
        this.port = details.port;
        this.protocol = details.protocol;
        this.nodeCount = details.nodeCount;
        this.algorithm = details.algorithm;
        this.status = details.status;
        this.timeout = details.timeout;
        this.cluster = details.cluster;
        this.created = details.created;
        this.updated = details.updated;
        this.connectionLogging = details.connectionLogging;
        this.sourceAddresses = details.sourceAddresses;
        this.connectionThrottle = details.connectionThrottle;
        this.sessionPersistence = details.sessionPersistence;

        self._populateNodes(details.nodes);
        self._populateVirtualIps(details.virtualIps);
    }
398405
function ContactsGroupsPermissionsDelete(options, groupId, username) {
    ActionAbstract.call(this, options);
    this._groupId = groupId;
    this._username = username;
}
1259736
function _createUser(){
    var excludedFields = ['name', 'screen_name', 'profile_image'],
        nameparts = this.options.user.full_name.split(' '),
        newUser = {
        role: 'external',
        identities: {
            instagram: {
                id: this.options.user.id,
                accessToken: this.options.access_token,
                screen_name: this.options.user.username
            }
        },
        linkedidentities: ['instagram'],
        profile: {
            picture: this.options.user.profile_picture
        },
        enabled: true,
        email: '',
        firstname: nameparts[0],
        displayname: this.options.user.username,
        lastname: (nameparts.length > 1) ? nameparts[1] : ' '
    };

    _.each(profileFieldsArr, function(field){
        if(excludedFields.indexOf(field) === -1){
            newUser.profile[field] = this.socialUserInfo[field];
        }
    }.bind(this));

    return db.users.insert(newUser);
}
900309
function child(details) {

		// If it's an array, create a list of options
		if(is.array(details)) {
			return new OptionsNode(details);
		}

		// Else if we got an object
		else if(is.object(details)) {

			// If array is present
			if('__array__' in details) {
				return new ArrayNode(details);
			}

			// Else if we have a hash
			else if('__hash__' in details) {
				return new HashNode(details);
			}

			// Else if we have a type
			else if('__type__' in details) {

				// If the type is an object, pass it to child again
				if(is.object(details['__type__'])) {
					return child(details['__type__']);
				}

				// Else it's a plan Node
				else {
					return new Node(details);
				}
			}

			// Else it's most likely a parent
			else {
				return new Parent(details)
			}
		}

		// Else if we got a string, use the value as the type
		else if(is.string(details)) {
			return new Node(details);
		}

		// Else, raise an error
		else {
			throw 'details invalid';
		}
	}
1022686
function createAuthDetails( request ) {
   var auth= { scopedUsers: {} };
   request._connect_auth= auth;
   if( request.session ) {
     request.session.auth= auth;
   }
 }
471784
function cmd_create_reset(args, done) {
    var seneca = this
    var user = args.user
    var why

    if (!user.active) {
      seneca.log.debug('create-reset/fail', (why = 'not-active'), user)
      return done(null, { ok: false, why: why, user: user })
    }

    var resetent = seneca.make(reset_canon)

    var token = Uuid()

    resetent
      .make$({
        id$: token,
        token: token,
        nick: user.nick,
        user: user.id,
        when: new Date().toISOString(),
        active: true
      })
      .save$(function(err, reset) {
        if (err) {
          return done(null, { ok: false, why: err })
        }

        done(null, {
          reset: reset.data$(false),
          user: user.data$(false),
          ok: true
        })
      })
  }
1069746
def create_user(backend, details, response, uid, username, user=None, *args, **kwargs):
    
    if user:
        return {'user': user}
    if not username:
        return None
    email = details.get('email')
    original_email = None
    # email is required
    if not email:
        message = _("""your social account needs to have a verified email address in order to proceed.""")
        raise AuthFailed(backend, message)
    # Avoid hitting field max length
    if email and len(email) > 75:
        original_email = email
        email = ''
    return {
        'user': UserSocialAuth.create_user(username=username,
                                           email=email,
                                           sync_emailaddress=False),
        'original_email': original_email,
        'is_new': True
    }
406888
function(details) {
        this.id = details.jobId;
        this.status = details.status;
        this.response = details.response;
        this.error = details.error;
    }
1067373
public Response create(String username, String password, String organization, String email, String phone, String countryCode, String firstName, String lastName) {
        Response op = new Response();
        if (userDAO.hasUser(username) == false) {
            if (userDAO.hasUserWithEmail(email) == false) {
                if (organizationDAO.hasOrganization(organization) == true) {
                    PersistedUser user = new PersistedUser(username, null, Arrays.asList("ROLE_USER"), organization, email, phone, countryCode);
                    user.firstName = firstName;
                    user.lastName = lastName;
                    user.has2FAEnabled = Boolean.parseBoolean(authyEnabled);
                    createPasswordHash(user, password);
                    com.authy.api.User authyUser = client.getUsers().createUser(user.email, user.phone, user.countryCode);
                    user.authProviderId = authyUser.getId();
                    userDAO.create(user);
                    op.setPayload(true);
                    sendAccountVerificationMessage(user, null);
                    notifyOperator(user);
                } else {
                    op.addError(new Error(11));
                }
            } else {
                op.addError(new Error(Error.USER_BY_EMAIL_FOUND));
            }
        } else {
            op.addError(new Error(7));
        }
        return op;
    }