| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #!/bin/bash
- # info: addding ip to user
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Argument defenition
- user="$1"
- ip="$2"
- ip_status="${3-exclusive}"
- # Importing variables
- source $VESTA/conf/vars.conf
- source $V_FUNC/shared_func.sh
- source $V_FUNC/ip_func.sh
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- # Checking arg number
- check_args '2' "$#" 'user ip [ip_status]'
- # Checking argument format
- format_validation 'user' 'ip' 'ip_status'
- # Checking user
- is_user_valid
- # Checking user is active
- is_user_suspended
- # Checking system ip
- is_sys_ip_valid
- # Checking webdomains on ip
- is_ip_key_empty '$U_WEB_DOMAINS'
- # Checking users on ip
- is_ip_key_empty '$U_SYS_USERS'
- # Checking ip owner
- is_ip_key_empty '$OWNER'
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Adding ip to user
- update_sys_ip_value '$OWNER' "$user"
- update_sys_ip_value '$STATUS' "$ip_status"
- #----------------------------------------------------------#
- # Vesta #
- #----------------------------------------------------------#
- # Updating user conf
- increase_user_value "$user" '$IP_OWNED'
- # Logging
- log_event 'system' "$V_EVENT"
- exit $OK
|