Delete a user

    CLI Example:

    .. code-block:: bash

        salt dell drac.delete_user [USERNAME] [UID - optional]
        salt dell drac.delete_user diana 4
975713
def delete_user(username, uid=None):
    '''
    
    '''
    if uid is None:
        user = list_users()
        uid = user[username]['index']

    if uid:
        return __execute_cmd('config -g cfgUserAdmin -o \
                              cfgUserAdminUserName -i {0} ""'.format(uid))

    else:
        log.warning('\'%s\' does not exist', username)
        return False

    return True
292997
def delete_user(name, runas=None):
    '''
    
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'delete_user', name],
        reset_system_locale=False,
        python_shell=False,
        runas=runas)
    msg = 'Deleted'

    return _format_response(res, msg)
683131
def delete_user(self, user):
        
        name = utils.get_name(user)
        self._user_manager.delete(name)
372236
def delete(user_id):
        '''
        
        '''
        try:
            del_count = TabMember.delete().where(TabMember.uid == user_id)
            del_count.execute()
            return True
        except:
            return False
902727
def delete(self, user_name: str):
        
        user = self._get_or_abort(user_name)
        session.delete(user)
        session.commit()
        return '', 204
912344
def user_to_uid(user):
    '''
    
    '''
    if user is None:
        user = salt.utils.user.get_user()

    return salt.utils.win_dacl.get_sid_string(user)
656282
function deleteUser(username, done) {
  return getUser(username, function(getUserErr, user) {
    if (getUserErr) {
      return done(getUserErr);
    }

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

    user.tokens.forEach((token) => token.destroy());
    user.groups.forEach((group) => { group.members.remove(user.id); group.save(); });
    user.leading.forEach((group) => { group.leaders.remove(user.id); group.save(); });
    user.destroy(done);
  });
}
829337
def delete_user(email, profile="splunk"):
    '''
    
    '''

    client = _get_splunk(profile)

    user = list_users(profile).get(email)

    if user:
        try:
            client.users.delete(user.name)
        except (AuthenticationError, HTTPError) as e:
            log.info('Exception: %s', e)
            return False
    else:
        return False

    return user.name not in client.users
655695
def delete_user_action(model, request):
    
    try:
        users = model.parent.backend
        uid = model.model.name
        del users[uid]
        users()
        model.parent.invalidate()
        localizer = get_localizer(request)
        message = localizer.translate(_(
            'delete_user_from_database',
            default="Deleted user '${uid}' from database.",
            mapping={'uid': uid}
        ))
        return {
            'success': True,
            'message': message
        }
    except Exception as e:
        return {
            'success': False,
            'message': str(e)
        }
674629
def delete_user(self, user_id):
        
        api = self._get_api(iam.AccountAdminApi)
        api.delete_user(user_id)
        return
738751
def cli(ctx, group, user):
    
    return ctx.gi.users.remove_from_group(group, user)
1345353
def remove_user(username):
    '''
    
    '''
    try:
        sendline('config terminal')
        user_line = 'no username {0}'.format(username)
        ret = sendline(user_line)
        sendline('end')
        sendline('copy running-config startup-config')
        return '\n'.join([user_line, ret])
    except TerminalException as e:
        log.error(e)
        return 'Failed to set password'
535448
def remove_user(self, username):
        

        sql = '''DELETE FROM user WHERE username = ?'''
        try:
            self._db_curs.execute(sql, (username, ))
            self._db_conn.commit()
        except (sqlite3.OperationalError, sqlite3.IntegrityError) as error:
            raise AuthError(error)
        return self._db_curs.rowcount
1311170
def drop_user(self, username):
        
        text = "DROP USER {0}".format(quote_ident(username), method="POST")
        self.query(text, method="POST")
1343844
def prj_remove_user(self, *args, **kwargs):
        
        if not self.cur_prj:
            return
        i = self.prj_user_tablev.currentIndex()
        item = i.internalPointer()
        if item:
            user = item.internal_data()
            log.debug("Removing user %s.", user.username)
            item.set_parent(None)
            self.cur_prj.users.remove(user)
211036
def delete_by_user_name(user_name):
        '''
        
        '''
        try:
            del_count = TabMember.delete().where(TabMember.user_name == user_name)
            del_count.execute()
            return True
        except:
            return False
912795
def delete_user(username,
                token_manager=None,
                app_url=defaults.APP_URL):
    
    account_id = get_account_id(username,
                                token_manager=token_manager,
                                app_url=app_url)

    headers = token_manager.get_access_token_headers()
    auth_url = environment.get_auth_url(app_url=app_url)
    url = "%s/api/v1/accounts/%s" % (auth_url, account_id)
    response = requests.delete(url, headers=headers)

    if response.status_code == 204:
        return response.text

    else:
        raise JutException('Error %s; %s' % (response.status_code, response.text))