From 6f06821f0c3d45e3938504bf3476ecb379cf2450 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sun, 29 Nov 2020 14:43:26 -0700 Subject: [PATCH] oputil cannot remove user from group #331 --- WHATSNEW.md | 2 ++ core/oputil/oputil_help.js | 2 +- core/oputil/oputil_user.js | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/WHATSNEW.md b/WHATSNEW.md index 9579c562..f03b6cee 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -11,6 +11,8 @@ This document attempts to track **major** changes and additions in ENiGMA½. For * Added ability to export/download messages. This is enabled in the default menu. See `messageAreaViewPost` in [the default message base template](./misc/menu_templates/message_base.in.hjson) and look for the download options (`@method:addToDownloadQueue`, etc.) for details on adding to your system! * The Gopher server has had a revamp! Standard `gophermap` files are now served along with any other content you configure for your Gopher Hole! A default [gophermap](https://en.wikipedia.org/wiki/Gopher_(protocol)#Source_code_of_a_menu) can be found [in the misc directory](./misc/gophermap) that behaves like the previous implementation. See [Gopher docs](./docs/servers/gopher.md) for more information. * Default file browser up/down/pageUp/pageDown scrolls description (e.g. FILE_ID.DIZ). If you want to expose this on an existing system see the `fileBaseListEntries` in the default `file_base.in.hjson` template. +* File base search has had an improvement to search term handling. +* `./oputil user group -group` to now accepts `~group` removing the need for special handling of the "-" character. #331 ## 0.0.11-beta * Upgraded from `alpha` to `beta` -- The software is far along and mature enough at this point! diff --git a/core/oputil/oputil_help.js b/core/oputil/oputil_help.js index 50bc3b5e..05025cfe 100644 --- a/core/oputil/oputil_help.js +++ b/core/oputil/oputil_help.js @@ -57,7 +57,7 @@ Actions: lock USERNAME Set a user's status to "locked" - group USERNAME [+|-]GROUP Adds (+) or removes (-) user from a group + group USERNAME [+|~]GROUP Adds (+) or removes (~) user from a group list [FILTER] List users with optional FILTER. diff --git a/core/oputil/oputil_user.js b/core/oputil/oputil_user.js index 403c5076..7c71523f 100644 --- a/core/oputil/oputil_user.js +++ b/core/oputil/oputil_user.js @@ -275,7 +275,7 @@ function modUserGroups(user) { let groupName = argv._[argv._.length - 1].toString().replace(/["']/g, ''); // remove any quotes - necessary to allow "-foo" let action = groupName[0]; // + or - - if('-' === action || '+' === action) { + if('-' === action || '+' === action || '~' === action) { groupName = groupName.substr(1); } @@ -286,7 +286,7 @@ function modUserGroups(user) { } // - // Groups are currently arbritary, so do a slight validation + // Groups are currently arbitrary, so do a slight validation // if(!/[A-Za-z0-9]+/.test(groupName)) { process.exitCode = ExitCodes.BAD_ARGS; @@ -303,7 +303,7 @@ function modUserGroups(user) { } const UserGroup = require('../../core/user_group.js'); - if('-' === action) { + if('-' === action || '~' === action) { UserGroup.removeUserFromGroup(user.userId, groupName, done); } else { UserGroup.addUserToGroup(user.userId, groupName, done);