fix: Auth0 member-id bug

master
Hiroyuki 2021-09-17 23:40:02 +00:00
parent d926a4aba1
commit ffb063b787
1 changed files with 12 additions and 12 deletions

View File

@ -90,37 +90,37 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
if (!pager) continue;
if (pager.num.startsWith('00') && !member.roles.includes('662163685439045632')) {
await client.db.PagerNumber.deleteOne({ num: pager.num });
await client.util.authClient.deleteUser({ id: member.id });
await client.util.authClient.deleteUser({ id: `auth0|${member.id}` });
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
}
if (pager.num.startsWith('01') && !member.roles.includes('701454855952138300')) {
await client.db.PagerNumber.deleteOne({ num: pager.num });
await client.util.authClient.deleteUser({ id: member.id });
await client.util.authClient.deleteUser({ id: `auth0|${member.id}` });
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
}
if (pager.num.startsWith('10') && !member.roles.includes('701454780828221450')) {
await client.db.PagerNumber.deleteOne({ num: pager.num });
await client.util.authClient.deleteUser({ id: member.id });
await client.util.authClient.deleteUser({ id: `auth0|${member.id}` });
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
}
if (pager.num.startsWith('20') && !member.roles.includes('455972169449734144')) {
await client.db.PagerNumber.deleteOne({ num: pager.num });
await client.util.authClient.deleteUser({ id: member.id });
await client.util.authClient.deleteUser({ id: `auth0|${member.id}` });
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
}
if (pager.num.startsWith('21') && !member.roles.includes('453689940140883988')) {
await client.db.PagerNumber.deleteOne({ num: pager.num });
await client.util.authClient.deleteUser({ id: member.id });
await client.util.authClient.deleteUser({ id: `auth0|${member.id}` });
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
}
if (pager.num.startsWith('22') && !member.roles.includes('701481967149121627')) {
await client.db.PagerNumber.deleteOne({ num: pager.num });
await client.util.authClient.deleteUser({ id: member.id });
await client.util.authClient.deleteUser({ id: `auth0|${member.id}` });
client.util.signale.log(`Pager Number '${pager.num}' has been deleted.`);
await client.util.removeUserFromMailingList(pager.emailAddresses[0], 'all-staff');
}
@ -161,7 +161,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
user_id: member.id,
user_id: `auth0|${member.id}`,
connection: 'Staff-Database',
email_verified: true,
app_metadata: {
@ -206,7 +206,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
user_id: member.id,
user_id: `auth0|${member.id}`,
connection: 'Staff-Database',
email_verified: true,
app_metadata: {
@ -252,7 +252,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
user_id: member.id,
user_id: `auth0|${member.id}`,
connection: 'Staff-Database',
email_verified: true,
app_metadata: {
@ -298,7 +298,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
user_id: member.id,
user_id: `auth0|${member.id}`,
connection: 'Staff-Database',
email_verified: true,
app_metadata: {
@ -344,7 +344,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
user_id: member.id,
user_id: `auth0|${member.id}`,
connection: 'Staff-Database',
email_verified: true,
app_metadata: {
@ -390,7 +390,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
user_id: member.id,
user_id: `auth0|${member.id}`,
connection: 'Staff-Database',
email_verified: true,
app_metadata: {