MCPcopy Index your code
hub / github.com/nodeSolidServer/node-solid-server / deleteUsers

Function deleteUsers

bin/lib/invalidUsernames.mjs:67–83  ·  view source on GitHub ↗
(usernames, accountManager, config, host)

Source from the content-addressed store, hash-verified

65}
66
67async function deleteUsers (usernames, accountManager, config, host) {
68 const oidcManager = fromServerConfig({ ...config, host })
69 const deletingUsers = usernames.map(async username => {
70 try {
71 const user = accountManager.userAccountFrom({ username })
72 await oidcManager.users.deleteUser(user)
73 } catch (error) {
74 if (error.message !== 'No email given') {
75 throw error
76 }
77 }
78 const userDirectory = accountManager.accountDirFor(username)
79 await fs.remove(userDirectory)
80 })
81 await Promise.all(deletingUsers)
82 console.info(`Deleted ${deletingUsers.length} users succeeded`)
83}
84
85function getInvalidUsernames (config) {
86 const usernames = loadUsernames(config)

Callers 1

Calls 4

fromServerConfigFunction · 0.90
userAccountFromMethod · 0.80
accountDirForMethod · 0.80
removeMethod · 0.80

Tested by

no test coverage detected