@velaro/cli 1.4.86 → 1.4.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/velaro.js +2 -0
- package/lib/commands/linked-identity.js +41 -0
- package/package.json +1 -1
package/bin/velaro.js
CHANGED
|
@@ -29,6 +29,7 @@ import { aiConfigCommand } from '../lib/commands/ai-config.js';
|
|
|
29
29
|
import { deploymentCommand } from '../lib/commands/deployment.js';
|
|
30
30
|
import { updateCommand } from '../lib/commands/update.js';
|
|
31
31
|
import { agentCommand } from '../lib/commands/agent.js';
|
|
32
|
+
import { linkedIdentityCommand } from '../lib/commands/linked-identity.js';
|
|
32
33
|
import { notificationsCommand } from '../lib/commands/notifications.js';
|
|
33
34
|
import { articleCommand } from '../lib/commands/article.js';
|
|
34
35
|
import { sharepointCommand } from '../lib/commands/sharepoint.js';
|
|
@@ -153,6 +154,7 @@ await yargs(hideBin(process.argv))
|
|
|
153
154
|
.command(deploymentCommand)
|
|
154
155
|
.command(updateCommand)
|
|
155
156
|
.command(agentCommand)
|
|
157
|
+
.command(linkedIdentityCommand)
|
|
156
158
|
.command(notificationsCommand)
|
|
157
159
|
.command(articleCommand)
|
|
158
160
|
.command(sharepointCommand)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { messagingGet, messagingDel } from '../api.js';
|
|
2
|
+
import { runCommand } from '../run.js';
|
|
3
|
+
|
|
4
|
+
function fmtDate(value) {
|
|
5
|
+
if (!value) return '—';
|
|
6
|
+
const d = new Date(value);
|
|
7
|
+
return Number.isNaN(d.getTime()) ? String(value) : d.toISOString().replace('T', ' ').slice(0, 16) + 'Z';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const linkedIdentityCommand = {
|
|
11
|
+
command: 'linked-identity <subcommand>',
|
|
12
|
+
describe: 'See and remove the Google / Microsoft / company sign-in methods linked to your site\'s users',
|
|
13
|
+
builder: (yargs) => yargs
|
|
14
|
+
.command({
|
|
15
|
+
command: 'list',
|
|
16
|
+
describe: 'List linked sign-in methods. Use when offboarding: disabling a person does not stop a linked Google sign-in.',
|
|
17
|
+
handler: runCommand(async () => {
|
|
18
|
+
const rows = await messagingGet('/admin/security/linked-identities');
|
|
19
|
+
if (!Array.isArray(rows) || rows.length === 0) {
|
|
20
|
+
console.log('No linked sign-in methods.');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const emailW = Math.max(...rows.map(r => (r.userEmail ?? '').length), 5);
|
|
24
|
+
for (const r of rows) {
|
|
25
|
+
console.log(`[${String(r.id).padStart(4)}] ${(r.userEmail ?? '—').padEnd(emailW)} ${(r.method ?? r.idpKind).padEnd(24)} linked ${fmtDate(r.linkedAt)} last used ${fmtDate(r.lastLoginAt)}`);
|
|
26
|
+
}
|
|
27
|
+
console.log(`\n${rows.length} linked sign-in method(s)`);
|
|
28
|
+
}),
|
|
29
|
+
})
|
|
30
|
+
.command({
|
|
31
|
+
command: 'remove <id>',
|
|
32
|
+
describe: 'Remove one linked sign-in method by id (from `list`). The person keeps any other way they can sign in.',
|
|
33
|
+
builder: (y) => y.positional('id', { describe: 'Link id from `linked-identity list`', type: 'number' }),
|
|
34
|
+
handler: runCommand(async (argv) => {
|
|
35
|
+
if (!Number.isInteger(argv.id) || argv.id <= 0) throw new Error('id must be a positive whole number.');
|
|
36
|
+
await messagingDel(`/admin/security/linked-identities/${argv.id}`);
|
|
37
|
+
console.log(`Removed linked sign-in method ${argv.id}.`);
|
|
38
|
+
}),
|
|
39
|
+
})
|
|
40
|
+
.demandCommand(1),
|
|
41
|
+
};
|
package/package.json
CHANGED