fixed issue when user where already exist
This commit is contained in:
@@ -86,10 +86,19 @@ function backtrace
|
||||
# Execute command outside of error control, echoes ouput error code
|
||||
noerror()
|
||||
{
|
||||
if [[ $1 == "--noout" ]]; then
|
||||
local noout=true
|
||||
shift
|
||||
fi
|
||||
|
||||
set +o errexit
|
||||
trap - ERR
|
||||
|
||||
if [[ -n $noout ]]; then
|
||||
$@ > /dev/null 2>&1
|
||||
else
|
||||
$@
|
||||
fi
|
||||
local code=$?
|
||||
|
||||
trap "error ${LINENO}" ERR
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# * LOCAL_USERS: List of local users to create
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
export VER_authnz=0.1.1
|
||||
export VER_authnz=0.1.2
|
||||
|
||||
# Users (from Ldap)
|
||||
add_remote_user()
|
||||
@@ -27,7 +27,11 @@ add_remote_user()
|
||||
# Create a local user
|
||||
create_user()
|
||||
{
|
||||
if [[ $(noerror --noouut id $1) != 0 ]]; then
|
||||
useradd -Um $1
|
||||
else
|
||||
prnt W "L'utilisateur $1 existe déjà. Rien à faire..."
|
||||
fi
|
||||
}
|
||||
|
||||
# Authentication
|
||||
|
||||
Reference in New Issue
Block a user