__nextcloud_user: add --quota paramter
This commit is contained in:
parent
82283d0b1c
commit
30205b38ae
4 changed files with 32 additions and 9 deletions
|
@ -1,7 +1,10 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
# __nextcloud_user/explorer/user
|
# __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
|
# Parameters
|
||||||
|
@ -32,7 +35,10 @@ cd '$cloud'
|
||||||
if php -r 'define("OC_CONSOLE",1); require_once(__DIR__."/lib/base.php");
|
if php -r 'define("OC_CONSOLE",1); require_once(__DIR__."/lib/base.php");
|
||||||
exit(\\OC::\$server->getUserSession()->getManager()->userExists("$user") ? 0 : 1);'
|
exit(\\OC::\$server->getUserSession()->getManager()->userExists("$user") ? 0 : 1);'
|
||||||
then
|
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
|
fi
|
||||||
SU
|
SU
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -12,7 +12,7 @@ occ() {
|
||||||
# will not use -q as it supresses errors, too
|
# will not use -q as it supresses errors, too
|
||||||
cat << SHELL
|
cat << SHELL
|
||||||
su -s /bin/sh -l "$www_user" -- -e <<'SU'
|
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
|
SU
|
||||||
SHELL
|
SHELL
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,9 @@ SHELL
|
||||||
occ user:setting -- "'$user'" settings email "'$(cat "$__object/parameter/email")'"
|
occ user:setting -- "'$user'" settings email "'$(cat "$__object/parameter/email")'"
|
||||||
fi
|
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
|
# save that use user will be created and no further steps are required
|
||||||
ignore_config="yes"
|
ignore_config="yes"
|
||||||
}
|
}
|
||||||
|
@ -193,6 +196,14 @@ SHELL
|
||||||
fi
|
fi
|
||||||
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
|
if ! [ -f "$__object/parameter/keep-groups" ]; then
|
||||||
# Handle the user groups
|
# Handle the user groups
|
||||||
|
|
|
@ -65,7 +65,7 @@ password
|
||||||
parameter and set the parameter `--keep-password`.
|
parameter and set the parameter `--keep-password`.
|
||||||
|
|
||||||
quota
|
quota
|
||||||
TBA.
|
The quota the Nextcloud user have to store it data. Defaults to `default`.
|
||||||
|
|
||||||
group
|
group
|
||||||
Multiple group names which the Nextcloud user belongs to. If not set, the
|
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
|
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
|
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
|
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
|
keep-email
|
||||||
Do not touch the email attributes of the user if he is already set up. This
|
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
|
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
|
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
|
keep-password
|
||||||
Do not touch the password if the user is already set up. This will avoid to
|
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
|
delete user-set passwords because they do not match with the predefined
|
||||||
state. If the parameter `--password` is set despite of this parameter, it
|
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
|
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
|
keep-groups
|
||||||
Do not touch the user groups if the user is already set up. This will avoid
|
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
|
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.
|
setup if he does not already exists.
|
||||||
|
|
||||||
|
|
||||||
|
|
1
type/__nextcloud_user/parameter/default/quota
Normal file
1
type/__nextcloud_user/parameter/default/quota
Normal file
|
@ -0,0 +1 @@
|
||||||
|
default
|
Loading…
Reference in a new issue