mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 02:28:03 -07:00
replaced underscore with dash in api syscalls
This commit is contained in:
parent
7ed705cee7
commit
b6b7eacadb
283 changed files with 438 additions and 412 deletions
66
bin/v-change-user-ns
Executable file
66
bin/v-change-user-ns
Executable file
|
@ -0,0 +1,66 @@
|
|||
#!/bin/bash
|
||||
# info: change user nameservers
|
||||
# options: user ns1 ns2 [ns3] [ns4]
|
||||
#
|
||||
# The function for changing default nameservers for speciefic user.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user=$1
|
||||
ns1=$(echo $2 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||
ns2=$(echo $3 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||
ns3=$4
|
||||
ns4=$5
|
||||
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking args
|
||||
check_args '3' "$#" 'user ns1 ns2 [ns3] [ns4]'
|
||||
|
||||
# Checking argument format
|
||||
validate_format 'user' 'ns1' 'ns2'
|
||||
if [ ! -z "$ns3" ]; then
|
||||
ns3=$(echo $4 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||
validate_format 'ns3'
|
||||
fi
|
||||
if [ ! -z "$ns4" ]; then
|
||||
ns4=$(echo $5 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||
validate_format 'ns4'
|
||||
fi
|
||||
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Merging values
|
||||
ns="$ns1,$ns2,$ns3,$ns4"
|
||||
ns=$(echo "$ns"|sed -e "s/,,//g" -e "s/,$//")
|
||||
|
||||
# Changing ns values
|
||||
update_user_value "$user" '$NS' "$ns"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Logging
|
||||
log_history "changed user nameservers to $ns1, $ns2"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue