@rfany/rf 0.19.0 → 0.19.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/rf.mjs +16 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rfany/rf",
3
- "version": "0.19.0",
3
+ "version": "0.19.2",
4
4
  "description": "rollforward's command line for people: what its page does, from a shell or a desktop agent, as you",
5
5
  "license": "MIT",
6
6
  "repository": { "type": "git", "url": "git+https://github.com/spoj/rollforward.git", "directory": "cli" },
package/rf.mjs CHANGED
@@ -159,11 +159,10 @@ rf connection remove NAME
159
159
  rf brand [--text TEXT] [--logo FILE] [--clear] the deployment's text and logo, a .png, .jpg, .gif, .webp or .svg, which top
160
160
  the sidebar and are the page's title and icon; --clear goes back to the plain look, and with
161
161
  no option it prints them
162
- rf can [CAP [EMAIL|GROUP,...] [--clear]] what users may do beyond the rest, as admins may: publish, push skills;
163
- create, make workspaces; and keepalive, keep their website logins alive for up to a
164
- week as they sign in; a list grants CAP to those
165
- emails and Entra group ids in place of whom it had, --clear to no one, and with neither it
166
- prints whom each is granted to${vpn ? '\n vpn, using client VPNs, needs an explicit grant even for admins' : ''}${vpn && admin ? '\nrf vpn add NAME fortinet HOST:PORT [--servercert pin-sha256:HASH] admins with vpn add a client VPN definition, which each\n person signs in to on the page; --servercert pins the gateway key, as a refusal names it\nrf vpn remove NAME admins with vpn remove a client VPN definition' : ''}`;
162
+ rf can [CAP [EMAIL|GROUP,... | --add EMAIL|GROUP,... | --remove EMAIL|GROUP,... | --clear]]
163
+ grants to emails and Entra group ids. A bare list replaces the grants; --add and --remove
164
+ change only the named grantees; --clear grants to no one. With no change it lists them.
165
+ publish, create and keepalive are implicit for admins; wake-check needs an explicit grant${vpn ? '\n vpn, using client VPNs, needs an explicit grant even for admins' : ''}${vpn && admin ? '\nrf vpn add NAME fortinet HOST:PORT [--servercert pin-sha256:HASH] admins with vpn add a client VPN definition, which each\n person signs in to on the page; --servercert pins the gateway key, as a refusal names it\nrf vpn remove NAME admins with vpn remove a client VPN definition' : ''}`;
167
166
  return (c && all.split(/\n(?=\S)/).map(e => e.trimEnd()).filter(e => e.split(/\s/)[1] === c).join('\n')) || all;
168
167
  };
169
168
 
@@ -1052,8 +1051,18 @@ else if (cmd === 'kill' && args.length === 1 && /^\d+$/.test(args[0])) {
1052
1051
  console.log(flags.json ? JSON.stringify(brand) : text || logo ? `${text ?? 'no text'}, ${logo ? 'with a logo' : 'no logo'}` : 'no brand: the plain look');
1053
1052
  }
1054
1053
  } else if (cmd === 'can' && args.length <= 2) {
1055
- const [cap, list] = args, people = flags.clear ? [] : list?.split(',').map(p => p.trim()).filter(Boolean);
1056
- const all = await (await (people ? post('/capabilities', { cap, people }, 'PUT') : api('/capabilities'))).json();
1054
+ const [cap, list] = args, edits = [list, flags.add, flags.remove, flags.clear].filter(x => x !== undefined);
1055
+ if (edits.length > 1 || (edits.length && !cap)) {
1056
+ console.error(usage(cmd));
1057
+ process.exit(2);
1058
+ }
1059
+ const people = flags.clear ? [] : String(edits[0] ?? '').split(',').map(p => p.trim()).filter(Boolean);
1060
+ if ((flags.add !== undefined || flags.remove !== undefined) && !people.length) {
1061
+ console.error(usage(cmd));
1062
+ process.exit(2);
1063
+ }
1064
+ const key = flags.add !== undefined ? 'add' : flags.remove !== undefined ? 'remove' : 'people';
1065
+ const all = await (await (edits.length ? post('/capabilities', { cap, [key]: people }, 'PUT') : api('/capabilities'))).json();
1057
1066
  if (flags.json) console.log(JSON.stringify(all, null, 1));
1058
1067
  else for (const [c, who] of Object.entries(all)) if (!cap || c === cap) console.log(`${c}: ${who.join(', ') || (c === 'vpn' || c === 'wake-check' ? 'no one' : 'admins only')}`);
1059
1068
  } else if (cmd === 'user' && args.length >= 2) {