samba: option to apply only to a NC group (#1048)

Signed-off-by: Tobias Knöppler

Co-authored-by: nachoparker <nacho@ownyourbits.com>
This commit is contained in:
Tobias K 2020-03-03 02:56:52 +01:00 committed by nachoparker
parent 9304c86a03
commit c49c3900be
3 changed files with 18 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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"
}
]
}