diff --git a/type/__nextcloud_user/explorer/user b/type/__nextcloud_user/explorer/user index ab97a1f..bf2c475 100755 --- a/type/__nextcloud_user/explorer/user +++ b/type/__nextcloud_user/explorer/user @@ -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 diff --git a/type/__nextcloud_user/gencode-remote b/type/__nextcloud_user/gencode-remote index dd0c715..bd986f5 100644 --- a/type/__nextcloud_user/gencode-remote +++ b/type/__nextcloud_user/gencode-remote @@ -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 diff --git a/type/__nextcloud_user/man.rst b/type/__nextcloud_user/man.rst index f68a092..43aefc8 100644 --- a/type/__nextcloud_user/man.rst +++ b/type/__nextcloud_user/man.rst @@ -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. diff --git a/type/__nextcloud_user/parameter/default/quota b/type/__nextcloud_user/parameter/default/quota new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/type/__nextcloud_user/parameter/default/quota @@ -0,0 +1 @@ +default