Skip to content

Commit

Permalink
kamctl: use VERIFY_USER variable to control if user check is done
Browse files Browse the repository at this point in the history
- help automating some commands such as acl grant
  • Loading branch information
miconda committed Dec 14, 2017
1 parent 49a1267 commit 28f107d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
36 changes: 20 additions & 16 deletions utils/kamctl/kamctl
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,16 @@ acl() {
case $1 in
show)
if [ $# -eq 2 ] ; then
is_user $2
if [ $? -ne 0 ] ; then
mecho "Non-existent user '$2'. Still proceeding? [Y|N] "
read answer
if [ "$answer" = "y" -o "$answer" = "Y" ] ; then
minfo "Proceeding with non-local user"
else
exit 1
if [ $VERIFY_USER -eq 1 ] ; then
is_user $2
if [ $? -ne 0 ] ; then
mecho "Non-existent user '$2'. Still proceeding? [Y|N] "
read answer
if [ "$answer" = "y" -o "$answer" = "Y" ] ; then
minfo "Proceeding with non-local user"
else
exit 1
fi
fi
fi
set_user $2
Expand All @@ -338,14 +340,16 @@ acl() {
usage
exit 1
fi
is_user $2
if [ $? -ne 0 ] ; then
mecho "Non-existent user '$2'. Still proceeding? [Y|N] "
read answer
if [ "$answer" = "y" -o "$answer" = "Y" ] ; then
minfo "Proceeding with non-local user"
else
exit 1
if [ $VERIFY_USER -eq 1 ] ; then
is_user $2
if [ $? -ne 0 ] ; then
mecho "Non-existent user '$2'. Still proceeding? [Y|N] "
read answer
if [ "$answer" = "y" -o "$answer" = "Y" ] ; then
minfo "Proceeding with non-local user"
else
exit 1
fi
fi
fi
set_user $2
Expand Down
3 changes: 3 additions & 0 deletions utils/kamctl/kamctl.base
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ fi
if [ -z "$ACL_GROUPS" ] ; then
ACL_GROUPS="local ld int voicemail free-pstn"
fi
if [ -z "$VERIFY_USER" ] ; then
VERIFY_USER=1
fi

##### ----------------------------------------------- #####
#### Defined values
Expand Down
4 changes: 4 additions & 0 deletions utils/kamctl/kamctlrc
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@
## are accepted
# ACL_GROUPS="local ld int voicemail free-pstn"

## check if user exists (used by some commands such as acl);
## - default on (1); off (0)
# VERIFY_USER=1

## verbose - debug purposes - default '0'
# VERBOSE=1

Expand Down

0 comments on commit 28f107d

Please sign in to comment.