__nextcloud_user: add --quota paramter

This commit is contained in:
matze 2020-10-31 11:44:31 +01:00
parent 82283d0b1c
commit 30205b38ae
4 changed files with 32 additions and 9 deletions

View File

@ -1,7 +1,10 @@
#!/bin/sh -e
# __nextcloud_user/explorer/user
# Outputs the raw nextcloud command output of the given user
# Outputs the raw nextcloud command output of the given user.
#
# The output is extended by the following fields (in the same syntax):
# 1. quota_param which outputs the real quota value instead of resolved values
# Parameters
@ -32,7 +35,10 @@ cd '$cloud'
if php -r 'define("OC_CONSOLE",1); require_once(__DIR__."/lib/base.php");
exit(\\OC::\$server->getUserSession()->getManager()->userExists("$user") ? 0 : 1);'
then
php occ --no-interaction --no-ansi --output=plain user:info '$user'
php occ --no-warnings --no-interaction --no-ansi --output=plain user:info '$user'
# also output the quota parameter
printf " - quota_parm: %s\n" \
"\$(php occ --no-warnings --no-interaction --no-ansi user:setting '$user' files quota)"
fi
SU
fi

View File

@ -12,7 +12,7 @@ occ() {
# will not use -q as it supresses errors, too
cat << SHELL
su -s /bin/sh -l "$www_user" -- -e <<'SU'
cd '$cloud' && php occ --no-interaction --no-ansi $@
cd '$cloud' && php occ --no-warnings --no-interaction --no-ansi $@
SU
SHELL
}
@ -51,6 +51,9 @@ SHELL
occ user:setting -- "'$user'" settings email "'$(cat "$__object/parameter/email")'"
fi
# add the set quota - the default value don't hurt if it's explicitly set
occ user:setting -- "'$user'" files quota "'$(cat "$__object/parameter/quota")'"
# save that use user will be created and no further steps are required
ignore_config="yes"
}
@ -193,6 +196,14 @@ SHELL
fi
fi
if ! [ -f "$__object/parameter/keep-quota" ]; then
# Handle the qouta
# the parameter is always set cause of the default value
quota="$(cat "$__object/parameter/quota")"
if ! match_param quota_param "$quota"; then
occ user:setting -- "'$user'" files quota "'$quota'"
fi
fi
if ! [ -f "$__object/parameter/keep-groups" ]; then
# Handle the user groups

View File

@ -65,7 +65,7 @@ password
parameter and set the parameter `--keep-password`.
quota
TBA.
The quota the Nextcloud user have to store it data. Defaults to `default`.
group
Multiple group names which the Nextcloud user belongs to. If not set, the
@ -82,27 +82,32 @@ keep-displayname
Do not touch the display name of the user if he is already set up. This
will avoid to delete the user-set value because it does not match with the
predefined state. If the parameter `--displayname` is set despite of this
parameter, it will be used in the user setup if he does not already exist.
parameter, it will only be used in the user setup if he does not already
exist.
keep-email
Do not touch the email attributes of the user if he is already set up. This
will avoid to delete the user-set value because it does not match with the
predefined state. If the parameter `--email` is set despite of this
parameter, it will be used in the user setup if he does not already exist.
parameter, it will only be used in the user setup if he does not already
exist.
keep-password
Do not touch the password if the user is already set up. This will avoid to
delete user-set passwords because they do not match with the predefined
state. If the parameter `--password` is set despite of this parameter, it
will be used in the user setup if he does not already exists.
will only be used in the user setup if he does not already exists.
keep-quota
TBA.
Do not touch the user quota if he is already set up. This will avoid to
delete the configuration set by an administrator. If the parameter `--quota`
is set despite of this parameter, it will only be used in the user setup if
he does not already exist.
keep-groups
Do not touch the user groups if the user is already set up. This will avoid
to delete group assosiactions not defined via cdist. If the parameter
`--group` is set despite of this parameter, it will be used in the user
`--group` is set despite of this parameter, it will only be used in the user
setup if he does not already exists.

View File

@ -0,0 +1 @@
default