Creates a User object when requested.
357951
def user(self):
        """"""
        try:
            return self._user
        except AttributeError:
            self._user = MatrixUser(self.mxid, self.Api(identity=self.mxid))
            return self._user
1241109
def adduser(app, username, password):
    """"""
    with app.app_context():
        create_user(username=username, password=password)
        click.echo('user created!')
1199958
def create_user(post_data):
        '''
        
        '''
        out_dic = {'success': False, 'code': '00'}

        if not tools.check_username_valid(post_data['user_name']):
            out_dic['code'] = '11'
            return out_dic

        if not tools.check_email_valid(post_data['user_email']):
            out_dic['code'] = '21'
            return out_dic

        try:
            TabMember.create(uid=tools.get_uuid(),
                             user_name=post_data['user_name'],
                             user_pass=tools.md5(post_data['user_pass']),
                             user_email=post_data['user_email'],
                             role='1000',  # ‘1000' as default role.
                             time_create=tools.timestamp(),
                             time_update=tools.timestamp(),
                             time_reset_passwd=tools.timestamp(),
                             time_login=tools.timestamp(),
                             time_email=tools.timestamp())

            out_dic['success'] = True
        except:
            out_dic['code'] = '91'
        return out_dic
115984
def create_object(self, text):
        '''  '''

        if self.create_field == 'name':
            if text.startswith('Location_'):
                this_id = text[len('Location_'):]
                this_loc = Location.objects.get(id=this_id)
                return self.get_queryset().get_or_create(
                    name=this_loc.name,location=this_loc
                )[0]
            elif text.startswith('StaffMember_'):
                this_id = text[len('StaffMember_'):]
                this_member = StaffMember.objects.get(id=this_id)
                return self.get_queryset().get_or_create(
                    name=this_member.fullName,staffMember=this_member,
                    defaults={'user': getattr(this_member,'userAccount',None)}
                )[0]
            elif text.startswith('User_'):
                this_id = text[len('User_'):]
                this_user = User.objects.get(id=this_id)
                return self.get_queryset().get_or_create(
                    name=this_user.get_full_name(),user=this_user,
                    defaults={'staffMember': getattr(this_user,'staffmember',None)}
                )[0]
            else:
                return self.get_queryset().get_or_create(
                    name=text,staffMember=None,user=None,location=None
                )[0]
        else:
            return super(TransactionPartyAutoComplete,self).create_object(text)
228762
function (req, res) {
    User.create({ firstName: req.body.firstName, lastName: req.body.lastName}).exec(function (err, user) {
      if(err) return res.json({ err: err }, 500);
      else res.json(user);
    });
  }
428586
def im_create(self, username, **kwargs):
        """"""
        return self.__call_api_post('im.create', username=username, kwargs=kwargs)
225003
async def create(self, **kwargs):
        '''  '''
        return await super(EntryResource, self).create(user=self.request['user'])
537688
async def create(cls, user_id: Union[int, str],
                     is_active: bool = True,
                     is_admin: bool = False,
                     resource_policy: str = None,
                     rate_limit: int = None,
                     fields: Iterable[str] = None) -> dict:
        '''
        
        '''
        if fields is None:
            fields = ('access_key', 'secret_key')
        uid_type = 'Int!' if isinstance(user_id, int) else 'String!'
        q = 'mutation($user_id: {0}, $input: KeyPairInput!) {{'.format(uid_type) + \
            '  create_keypair(user_id: $user_id, props: $input) {' \
            '    ok msg keypair { $fields }' \
            '  }' \
            '}'
        q = q.replace('$fields', ' '.join(fields))
        variables = {
            'user_id': user_id,
            'input': {
                'is_active': is_active,
                'is_admin': is_admin,
                'resource_policy': resource_policy,
                'rate_limit': rate_limit,
            },
        }
        rqst = Request(cls.session, 'POST', '/admin/graphql')
        rqst.set_json({
            'query': q,
            'variables': variables,
        })
        async with rqst.fetch() as resp:
            data = await resp.json()
            return data['create_keypair']
1064256
def perform_create(self, serializer):
        """"""
        with transaction.atomic():
            instance = serializer.save()

            # Assign all permissions to the object contributor.
            assign_contributor_permissions(instance)
1171087
public function actionCreate()
    {
        $user = new User();
        $this->readValue($user, 'username');
        $this->readValue($user, 'email');
        $user->setPassword($this->prompt('Password:', [
            'required' => true,
            'pattern'  => '#^.{6,255}$#i',
            'error'    => 'More than 6 symbols',
        ]));
        $user->generateAuthKey();
        $user->status = User::STATUS_ACTIVE;
        $this->log($this->repository->save($user));
    }
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
922687
private void createUser(Session session, UserImpl user, boolean broadcast) throws Exception
   {
      Node userStorageNode = utils.getUsersStorageNode(session);
      Node userNode = userStorageNode.addNode(user.getUserName());

      if (user.getCreatedDate() == null)
      {
         Calendar calendar = Calendar.getInstance();
         user.setCreatedDate(calendar.getTime());
      }
      user.setInternalId(userNode.getUUID());

      if (broadcast)
      {
         preSave(user, true);
      }

      writeUser(user, userNode);
      session.save();

      putInCache(user);

      if (broadcast)
      {
         postSave(user, true);
      }
   }
152923
def prj_create_user(self, *args, **kwargs):
        
        if not self.cur_prj:
            return
        user = self.create_user(projects=[self.cur_prj])
        if user:
            userdata = djitemdata.UserItemData(user)
            treemodel.TreeItem(userdata, self.prj_user_model.root)
1035217
def get_or_create_user(self, provider, access, info):
        ""
        digest = hashlib.sha1(smart_bytes(access)).digest()
        # Base 64 encode to get below 30 characters
        # Removed padding characters
        username = force_text(base64.urlsafe_b64encode(digest)).replace('=', '')
        User = get_user_model()
        kwargs = {
            User.USERNAME_FIELD: username,
            'email': '',
            'password': None
        }
        return User.objects.create_user(**kwargs)
1136335
def _create_user(ctx):
    """"""

    username, passhash = _get_credentials(ctx.obj['username'],
                                          ctx.obj['password'],
                                          ctx.obj['db'])

    if ctx.obj['db'].objectmodels['user'].count({'name': username}) > 0:
        raise KeyError()

    new_user = ctx.obj['db'].objectmodels['user']({
        'uuid': str(uuid4()),
        'created': std_now()
    })

    new_user.name = username
    new_user.passhash = passhash

    return new_user
228482
def allow_user(user):
    """"""
    def processor(action, argument):
        db.session.add(
            ActionUsers.allow(action, argument=argument, user_id=user.id)
        )
    return processor
1191207
def create_lazy_user(self):
        
        user_class = self.model.get_user_class()
        username = self.generate_username(user_class)
        user = user_class.objects.create_user(username, '')
        self.create(user=user)
        return user, username