Skip to content

Commit

Permalink
samba: option to apply only to a NC group (#1048)
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Knöppler

Co-authored-by: nachoparker <nacho@ownyourbits.com>
  • Loading branch information
theCalcaholic and nachoparker committed Mar 16, 2020
1 parent 9304c86 commit c49c390
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 8 additions & 1 deletion bin/ncp/NETWORKING/samba.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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

4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 7 additions & 1 deletion etc/ncp-config.d/samba.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -17,6 +17,12 @@
"name": "Password",
"value": "ownyourbits",
"type": "password"
},
{
"id": "FILTER_BY_GROUP",
"name": "Filter by NC group",
"value": "",
"suggest": "optional NC group"
}
]
}

0 comments on commit c49c390

Please sign in to comment.