Force option on user removal
This commit is contained in:
parent
91ae203b8e
commit
b8c0bce0f1
|
@ -212,7 +212,7 @@ do
|
||||||
retval=$(add_user_${app_name} "$ADD_USERNAME" "$NEW_USER_PASSWORD")
|
retval=$(add_user_${app_name} "$ADD_USERNAME" "$NEW_USER_PASSWORD")
|
||||||
if [[ $retval != '0' ]]; then
|
if [[ $retval != '0' ]]; then
|
||||||
echo $"Failed with error code ${retval}"
|
echo $"Failed with error code ${retval}"
|
||||||
${PROJECT_NAME}-rmuser $ADD_USERNAME
|
${PROJECT_NAME}-rmuser $ADD_USERNAME --force
|
||||||
exit 672392
|
exit 672392
|
||||||
fi
|
fi
|
||||||
if ! grep -q "${app_name}_${ADD_USERNAME}" $APP_USERS_FILE; then
|
if ! grep -q "${app_name}_${ADD_USERNAME}" $APP_USERS_FILE; then
|
||||||
|
|
|
@ -51,6 +51,7 @@ done
|
||||||
read_config_param MY_USERNAME
|
read_config_param MY_USERNAME
|
||||||
|
|
||||||
REMOVE_USERNAME=$1
|
REMOVE_USERNAME=$1
|
||||||
|
REMOVE_OPTIONS="$2"
|
||||||
|
|
||||||
if [ ! $REMOVE_USERNAME ]; then
|
if [ ! $REMOVE_USERNAME ]; then
|
||||||
echo $'Please specify a username to remove'
|
echo $'Please specify a username to remove'
|
||||||
|
@ -93,12 +94,16 @@ if [[ $REMOVE_USERNAME == $ADMIN_USERNAME ]]; then
|
||||||
exit 8
|
exit 8
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$REMOVE_OPTIONS" != '-f' && "$REMOVE_OPTIONS" != '-y' && "$REMOVE_OPTIONS" != '--force' ]]; then
|
||||||
echo $'>>> REMOVE USER <<<'
|
echo $'>>> REMOVE USER <<<'
|
||||||
read -p $"Do you really wish to remove the user '$REMOVE_USERNAME' (y/n) ?" yn
|
read -p $"Do you really wish to remove the user '$REMOVE_USERNAME' (y/n) ?" yn
|
||||||
if [[ $yn != 'y' && $yn != 'Y' && $yn != 'yes' && $yn != 'Yes' && $yn != 'YES' ]]; then
|
if [[ $yn != 'y' && $yn != 'Y' && $yn != 'yes' && $yn != 'Yes' && $yn != 'YES' ]]; then
|
||||||
echo $"User $REMOVE_USERNAME was not removed"
|
echo $"User $REMOVE_USERNAME was not removed"
|
||||||
exit 9
|
exit 9
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo $"Forced removal of user $REMOVE_USERNAME"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f /etc/nginx/.htpasswd ]; then
|
if [ -f /etc/nginx/.htpasswd ]; then
|
||||||
if grep "${REMOVE_USERNAME}:" /etc/nginx/.htpasswd; then
|
if grep "${REMOVE_USERNAME}:" /etc/nginx/.htpasswd; then
|
||||||
|
|
Loading…
Reference in New Issue