mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 22:04:01 -07:00
added child list function
This commit is contained in:
parent
3013e249ab
commit
7fede99297
4 changed files with 99 additions and 7 deletions
|
@ -166,9 +166,8 @@ U_MAIL_DOMAINS='0'
|
|||
DATE='$V_DATE'" > $V_USERS/$user/user.conf
|
||||
|
||||
# Filling owner config
|
||||
ROLE=$(echo "$role" | tr "[:lower:]" "[:upper:]")
|
||||
if [ "$user" != 'vesta' ]; then
|
||||
echo "$ROLE='$user'" >> $V_USERS/$owner/child.conf
|
||||
echo "USER='$user'" >> $V_USERS/$owner/child.conf
|
||||
increase_user_value "$owner" 'U_CHILDS'
|
||||
fi
|
||||
|
||||
|
|
|
@ -111,6 +111,14 @@ if [ ! -z "$statp" ]; then
|
|||
done
|
||||
fi
|
||||
|
||||
# Deleteing user from parent
|
||||
childc=$(grep -n "USER='$user'" $V_USERS/child.conf |cut -d : -f 1|sort -n -r)
|
||||
if [ ! -z "$childc" ]; then
|
||||
for str in $childc; do
|
||||
sed -i "$str d" $V_USERS/child.conf
|
||||
done
|
||||
fi
|
||||
|
||||
# Removing system user
|
||||
userdel -f $user
|
||||
rm -rf $V_HOME/$user
|
||||
|
|
55
bin/v_list_sys_user_childs
Executable file
55
bin/v_list_sys_user_childs
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/bin/bash
|
||||
# info: listing user childs
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user="$1"
|
||||
format="${2-shell}"
|
||||
limit="${3-1000}"
|
||||
offset="${4-1}"
|
||||
|
||||
# Importing variables
|
||||
source $VESTA/conf/vars.conf
|
||||
source $V_FUNC/shared_func.sh
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '1' "$#" 'user [format] [limit] [offset]'
|
||||
|
||||
# Checking argument format
|
||||
format_validation 'user' 'limit' 'offset'
|
||||
|
||||
# Checking user
|
||||
is_user_valid
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Defining fileds to select
|
||||
fields='$USER'
|
||||
|
||||
# Listing domains
|
||||
case $format in
|
||||
json) childs_json_list ;;
|
||||
shell) childs_shell_list ;;
|
||||
*) check_args '1' '0' 'user [format] [limit] [offset]'
|
||||
esac
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Logging
|
||||
log_event 'system' "$V_EVENT"
|
||||
|
||||
exit $OK
|
Loading…
Add table
Add a link
Reference in a new issue