8000 🚀 Feature: Delete all users with one command · Issue #5171 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

🚀 Feature: Delete all users with one command #5171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
anasfik opened this issue Feb 27, 2023 · 4 comments
Open
2 tasks done

🚀 Feature: Delete all users with one command #5171

anasfik opened this issue Feb 27, 2023 · 4 comments
Labels
product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.

Comments

@anasfik
Copy link
anasfik commented Feb 27, 2023

🔖 Feature description

the feature is about deleting all users and collecting documents simultaneously with a simple server SDK method or an appwrite cli command.

For example, for deleting users from cli:

appwrite users deleteAll

for confirmation on such commands, a confirmation with (Y/n) style or re-inputting the password will be fair for not executing randomly and for security.

🎤 Pitch

Well, this might be personal, but this is why I downloaded the CLI to check if such commands exist.

while developing an app using appwrite, developers will definitely create test accounts, collections, documents while implementing a feature, especially a related feature such as:

  • creating user
  • creating user extra information document

and this task can be done repetitively for developing purposes, then after the feature is implemented, we find a lot of user accounts and documents, and running a command to delete them is better than doing it manually to move to another project.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@stnguyen90 stnguyen90 added the product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services. label Feb 27, 2023
@stnguyen90
Copy link
Contributor
stnguyen90 commented Feb 27, 2023

@anasfik, thanks for creating this issue! 🙏🏼 For now, I recommend creating a script or a function that uses the server SDK to perform this action.

Related:

@stnguyen90 stnguyen90 changed the title 🚀 Feature: users, collection documents deletion with one command 🚀 Feature: Delete all users with one command Feb 27, 2023
@singhbhaskar
Copy link
Contributor

Hey @stnguyen90 ,
I looked at the issue and gone through user controller. Then implemented a basic delete all route. Can I work on this issue?

@stnguyen90
Copy link
Contributor

@singhbhaskar we're hesitant to introduce this right now so it's probably not a good thing for you to work on right now. That said, if you'd like to contribute, you could create an Appwrite Function that wipes users and submit a PR, in our examples repo.

@ashuvssut
Copy link
ashuvssut commented May 26, 2023

@stnguyen90 I did not have a appwrite function. But, I already had a vercel serveless function that does this users cleanup job.

Appwrite function logic is exactly similar to this:-

import { NextResponse } from "next/server";
import { Client, Users } from "node-appwrite";

export async function POST(req: Request, res: Response) {
	const client = new Client()
		.setEndpoint(process.env.APPWRITE_ENDPOINT!)
		.setProject(process.env.APPWRITE_PROJECT_ID!)
		.setKey(process.env.APPWRITE_SERVER_KEY!);

	const users = new Users(client);

	try {
		const userListObj = await users.list();
		const userList = userListObj.users;
		userList.forEach(async user => {
			await users.delete(user.$id);
		});
		return NextResponse.json({ success: true });
	} catch (e: any) {
		console.error(e);
		return NextResponse.json({ error: e.message });
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.
Projects
None yet
Development

No branches or pull requests

4 participants
0