From c49c3900bedb4d16abe8615c921d4006cd16cd91 Mon Sep 17 00:00:00 2001 From: Tobias K <6317548+theCalcaholic@users.noreply.github.com> Date: Tue, 3 Mar 2020 02:56:52 +0100 Subject: samba: option to apply only to a NC group (#1048) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobias Knöppler Co-authored-by: nachoparker --- bin/ncp/NETWORKING/samba.sh | 9 ++++++++- changelog.md | 4 +++- etc/ncp-config.d/samba.cfg | 8 +++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bin/ncp/NETWORKING/samba.sh b/bin/ncp/NETWORKING/samba.sh index 0b781a54..c4fff3c3 100644 --- a/bin/ncp/NETWORKING/samba.sh +++ b/bin/ncp/NETWORKING/samba.sh @@ -68,6 +68,14 @@ EOF done < <( ls -d "$DATADIR"/*/files ) for user in ${USERS[@]}; do + # Exclude users not matching group filter (if enabled) + if [[ -n "$FILTER_BY_GROUP" ]] \ + && [[ -z "$(ncc user:info "$user" --output=json | jq ".groups[] | select( . == \"${FILTER_BY_GROUP}\" )")" ]] + then + echo "Omitting user $user (not in group ${FILTER_BY_GROUP})..."; + continue; + fi + echo "adding SAMBA share for user $user" local DIR="$DATADIR/$user/files" [ -d "$DIR" ] || { echo -e "INFO: directory $DIR does not exist."; return 1; } @@ -122,4 +130,3 @@ EOF # along with this script; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, # Boston, MA 02111-1307 USA - diff --git a/changelog.md b/changelog.md index 056cf7e6..c5121de8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ -[v1.22.0](https://github.com/nextcloud/nextcloudpi/commit/bd03e1c) (2020-03-03) Add nc-trusted-proxies (#1094) +[v1.22.1](https://github.com/nextcloud/nextcloudpi/commit/e68d616) (2020-03-03) samba: option to apply only to a NC group (#1048) + +[v1.22.0 ](https://github.com/nextcloud/nextcloudpi/commit/9304c86) (2020-03-03) Add nc-trusted-proxies (#1094) [v1.21.0](https://github.com/nextcloud/nextcloudpi/commit/4a51c1f) (2020-02-28) upgrade to NC18.0.1 diff --git a/etc/ncp-config.d/samba.cfg b/etc/ncp-config.d/samba.cfg index 084a2be4..5ec6c05c 100644 --- a/etc/ncp-config.d/samba.cfg +++ b/etc/ncp-config.d/samba.cfg @@ -2,7 +2,7 @@ "id": "samba", "name": "Samba", "title": "samba", - "description": "SMB/CIFS file server (for Mac/Linux/Windows)", + "description": "SMB/CIFS file server (for Mac/Linux/Windows)\nIf a group filter is given, samba shares will only be set up for users of that group.", "info": "The username will be the Nextcloud username, and the password will be one we setup here.\nIf we intend to modify the data folder through SAMBA,\nthen we have to synchronize NextCloud to make it aware of the changes.\n\nThis can be done manually or automatically using 'nc-scan' and 'nc-scan-auto'", "infotitle": "Instructions for external synchronization", "params": [ @@ -17,6 +17,12 @@ "name": "Password", "value": "ownyourbits", "type": "password" + }, + { + "id": "FILTER_BY_GROUP", + "name": "Filter by NC group", + "value": "", + "suggest": "optional NC group" } ] } -- cgit v1.2.3