recess-cli 3.56.0 → 3.57.0
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/dist/cli.js +4 -0
- package/dist/commands/host-multiple.js +43 -0
- package/dist/help.js +11 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -26,6 +26,7 @@ import { runFamilyCommand, runKidCommand, runMeCommand, } from "./commands/famil
|
|
|
26
26
|
import { runStudentsTextsCommand, runUsersPhoneCommand, runUsersTextCommand, runStudentsTextParentCommand, } from "./commands/phone-and-texts.js";
|
|
27
27
|
import { hasCommunityHour, runUsersCommunityHourCommand, } from "./commands/community-hour.js";
|
|
28
28
|
import { runUsersBirthdayCommand } from "./commands/birthday.js";
|
|
29
|
+
import { runUsersHostMultipleCommand } from "./commands/host-multiple.js";
|
|
29
30
|
import { runTuitionPlansCommand } from "./commands/tuition-plans.js";
|
|
30
31
|
import { runTuitionCommand } from "./commands/tuition.js";
|
|
31
32
|
import { runReportsCommand } from "./commands/reports.js";
|
|
@@ -3527,6 +3528,9 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3527
3528
|
if (noun === "users" && verb === "community-hour") {
|
|
3528
3529
|
return runUsersCommunityHourCommand({ parsed, api, writeCommand });
|
|
3529
3530
|
}
|
|
3531
|
+
if (noun === "users" && verb === "host-multiple") {
|
|
3532
|
+
return runUsersHostMultipleCommand({ parsed, api, writeCommand });
|
|
3533
|
+
}
|
|
3530
3534
|
if (noun === "users" && verb === "get") {
|
|
3531
3535
|
const userId = positional(parsed, 2, "user ID");
|
|
3532
3536
|
return unwrap(await api.client.GET("/admin/users/{userId}", {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { unwrap } from "../api.js";
|
|
2
|
+
import { CliError } from "../errors.js";
|
|
3
|
+
import { positional } from "./shared.js";
|
|
4
|
+
const HOST_MULTIPLE_ROLE = "recess:host-multiple";
|
|
5
|
+
/**
|
|
6
|
+
* `users host-multiple get|grant|revoke` — whether someone may host more than
|
|
7
|
+
* one group at a time (the `recess:host-multiple` access role). One person per
|
|
8
|
+
* run; the server's PATCH is a set-to, so a rerun is harmless.
|
|
9
|
+
*/
|
|
10
|
+
export async function runUsersHostMultipleCommand({ parsed, api, writeCommand, }) {
|
|
11
|
+
const action = positional(parsed, 2, "users host-multiple action");
|
|
12
|
+
if (!["get", "grant", "revoke"].includes(action)) {
|
|
13
|
+
throw new CliError("invalid_arguments", "Use users host-multiple get|grant|revoke.");
|
|
14
|
+
}
|
|
15
|
+
const userId = positional(parsed, 3, "user ID");
|
|
16
|
+
const { user } = unwrap(await api.client.GET("/admin/users/{userId}", {
|
|
17
|
+
params: { path: { userId } },
|
|
18
|
+
}));
|
|
19
|
+
const current = {
|
|
20
|
+
userId: user.id,
|
|
21
|
+
name: [user.firstName, user.lastName].filter(Boolean).join(" "),
|
|
22
|
+
role: user.role,
|
|
23
|
+
canHostMultiple: (user.accessRoles ?? []).some((role) => role.name === HOST_MULTIPLE_ROLE),
|
|
24
|
+
};
|
|
25
|
+
if (action === "get")
|
|
26
|
+
return current;
|
|
27
|
+
const enabled = action === "grant";
|
|
28
|
+
return writeCommand(parsed, {
|
|
29
|
+
action: enabled
|
|
30
|
+
? "let this person host more than one group at a time on Events. Their other access and restrictions are unchanged"
|
|
31
|
+
: "put this person back on the one-group-at-a-time limit on Events. Groups they already posted stay up; their other access and restrictions are unchanged",
|
|
32
|
+
target: { userId: user.id },
|
|
33
|
+
request: { enabled },
|
|
34
|
+
details: { current, canHostMultipleAfter: enabled },
|
|
35
|
+
}, async () => {
|
|
36
|
+
unwrap(await api.client.PATCH("/admin/users/{userId}/host-multiple", {
|
|
37
|
+
params: { path: { userId: user.id } },
|
|
38
|
+
body: { enabled },
|
|
39
|
+
}));
|
|
40
|
+
return { ...current, canHostMultiple: enabled };
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=host-multiple.js.map
|
package/dist/help.js
CHANGED
|
@@ -61,6 +61,9 @@ Usage:
|
|
|
61
61
|
recess [--json] users community-hour get <kid-id>
|
|
62
62
|
recess [--json] users community-hour unlock <kid-id> [--confirm]
|
|
63
63
|
recess [--json] users community-hour lock <kid-id> [--confirm]
|
|
64
|
+
recess [--json] users host-multiple get <user-id>
|
|
65
|
+
recess [--json] users host-multiple grant <user-id> [--confirm]
|
|
66
|
+
recess [--json] users host-multiple revoke <user-id> [--confirm]
|
|
64
67
|
recess [--json] users disable <user-id> [--whole-family] [--allow-billing] [--confirm]
|
|
65
68
|
recess [--json] users restore <user-id> --role kid|guardian|guide|program [--confirm]
|
|
66
69
|
recess [--json] users tier list-tiers
|
|
@@ -937,6 +940,11 @@ room; the Village picks the change up within about 30 seconds. "users unlock"
|
|
|
937
940
|
does not grant it and "users lock" removes it. "users community-hour get" (or
|
|
938
941
|
"users get": accessRoles contains recess:participant) is the read.
|
|
939
942
|
|
|
943
|
+
"users host-multiple grant|revoke" sets whether one person may host more than
|
|
944
|
+
one group at a time on Events (the recess:host-multiple access role). Without
|
|
945
|
+
it a kid or parent hosts one group until it ends; staff and Sparks are never
|
|
946
|
+
limited. One person per run. "users host-multiple get" is the read.
|
|
947
|
+
|
|
940
948
|
"users disable" is the harder stop, and a different mechanism: it sets
|
|
941
949
|
User.role to DISABLED, so the account stops resolving in every dashboard,
|
|
942
950
|
search, chat, and todo query at the database layer, and its coherent-feed
|
|
@@ -1353,6 +1361,9 @@ export const COMMAND_SUMMARIES = {
|
|
|
1353
1361
|
"users community-hour get": "Show whether a kid can join Community Hour.",
|
|
1354
1362
|
"users community-hour unlock": "Let a kid join Community Hour and enter the Village.",
|
|
1355
1363
|
"users community-hour lock": "Stop a kid joining Community Hour or the Village.",
|
|
1364
|
+
"users host-multiple get": "Show whether someone may host more than one group at a time.",
|
|
1365
|
+
"users host-multiple grant": "Let someone host more than one group at a time.",
|
|
1366
|
+
"users host-multiple revoke": "Put someone back on one group at a time.",
|
|
1356
1367
|
"users lock": "Lock a kid's account with their guardians (removes Community Hour).",
|
|
1357
1368
|
"users unlock": "Unlock a kid's account with guardians (not Community Hour); rerun = refresh.",
|
|
1358
1369
|
"users disable": "Soft-disable an account or whole family (reversible; refuses live billing).",
|