Delete or undelete an user account.
331590
def acp_users_delete():
    """"""
    if not current_user.is_admin:
        return error("Not authorized to edit users.", 401)
    if not db:
        return error('The ACP is not available in single-user mode.', 500)

    form = UserDeleteForm()
    if not form.validate():
        return error("Bad Request", 400)
    user = get_user(int(request.form['uid']))
    direction = request.form['direction']
    if not user:
        return error("User does not exist.", 404)
    else:
        for p in PERMISSIONS:
            setattr(user, p, False)
        user.active = direction == 'undel'
        write_user(user)
        return redirect(url_for('acp_users') + '?status={_del}eted'.format(
            _del=direction))
380737
def delete(self, account_id, user_id):
        
        return self.connection.delete('account/access', account_id=account_id, user_id=user_id)
1016791
public static function deleteUser($username)
	{
		if ( ! self::userExists( $username ) ) return false;

		$deleted_user = self::$auth['users'][ $username ];
		unset( self::$auth['users'][ $username ] );

		return $deleted_user;
	}
1288841
def delete(config, username, type):
        """"""
        client = Client()
        client.prepare_connection()
        user_api = API(client)
        user_api.delete(username, type)
1015531
def remove_from_user(self, name, *args):
        
        user = self.get_user(name=name)
        attrs_ = user['user']
        for a in args:
            del attrs_[a]
758541
def delete_database_user(self, username):
        """"""
        url = "db/{0}/users/{1}".format(self._database, username)

        self.request(
            url=url,
            method='DELETE',
            expected_response_code=200
        )

        return True
216302
def delete_user(self, user):
        
        self.project_service.set_auth(self._token_project)
        self.project_service.delete_user(user)
537182
def users_deactivate(user):
    """"""
    user_obj = _datastore.get_user(user)
    if user_obj is None:
        raise click.UsageError('ERROR: User not found.')
    if _datastore.deactivate_user(user_obj):
        click.secho('User "{0}" has been deactivated.'.format(user),
                    fg='green')
    else:
        click.secho('User "{0}" was already deactivated.'.format(user),
                    fg='yellow')
1157122
def user_remove(username, **kwargs):
    '''
    
    '''
    # 'database' argument is mandatory
    if 'database' not in kwargs:
        return False
    try:
        conn = _get_connection(**kwargs)
        conn.autocommit(True)
        cur = conn.cursor()
        cur.execute("DROP USER {0}".format(username))
        conn.autocommit(False)
        conn.close()
        return True
    except Exception as e:
        return 'Could not create the user: {0}'.format(e)
1342962
def delete(self, username, type):
        """"""
        self.client.delete(self.__distinguished_name(type, username=username))
457875
def delete(self, **kwargs):
        

        return self._client['users/*/lists/*'].delete(self.username, self.id, **kwargs)
1225276
def remove(self, username=None):
        """"""
        self._user_list = [user for user in self._user_list if user.name != username]
823350
def Delete(self):
    """"""

    args = user_management_pb2.ApiDeleteGrrUserArgs(username=self.username)
    self._context.SendRequest("DeleteGrrUser", args)
1340586
def delete(self):
        """"""
        params = {"email": self.email_address}
        response = self._delete("/admins.json", params=params)
1132203
def account_delete(request, username,
        template_name=accounts_settings.ACCOUNTS_PROFILE_DETAIL_TEMPLATE,
        extra_context=None, **kwargs):
    
    user = get_object_or_404(get_user_model(),
                             username__iexact=username)
    user.is_active = False
    user.save()

    return redirect(reverse('accounts_admin'))
141339
def delete(self, user):
        """"""
        if user:
            can_delete = yield self.can_delete(user)
        else:
            can_delete = False

        if not can_delete:
            raise exceptions.Unauthorized('User may not delete the resource')

        try:
            parent = yield self.get_parent()
        except couch.NotFound:
            msg = '{}_id {} not found'.format(
                self.parent_resource.resource_type,
                self.parent_id)
            raise exceptions.ValidationError(msg)

        yield parent.delete_subresource(self)
1281969
def delete_user(ctx, yes):
    """"""

    if ctx.obj['username'] is None:
        username = _ask("Please enter username:")
    else:
        username = ctx.obj['username']

    del_user = ctx.obj['db'].objectmodels['user'].find_one({'name': username})
    if yes or _ask('Confirm deletion', default=False, data_type='bool'):
        try:
            del_user.delete()
            log("Done")
        except AttributeError:
            log('User not found', lvl=warn)
    else:
        log("Cancelled")