v_change_sys_user_name 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. # info: changing user nameservers
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user="$1"
  8. fname="$2"
  9. lname="$3"
  10. # Importing variables
  11. source $VESTA/conf/vars.conf
  12. source $V_FUNC/shared_func.sh
  13. #----------------------------------------------------------#
  14. # Verifications #
  15. #----------------------------------------------------------#
  16. # Checking args
  17. check_args '3' "$#" 'user fname lname'
  18. # Checking argument format
  19. format_validation 'user' 'fname' 'lname'
  20. # Checking user
  21. is_user_valid
  22. # Checking user is active
  23. is_user_suspended
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Get old values
  28. old_fname=$(get_user_value '$FNAME')
  29. old_lname=$(get_user_value '$LNAME')
  30. # Changing ns values
  31. update_user_value "$user" '$FNAME' "$fname"
  32. update_user_value "$user" '$LNAME' "$lname"
  33. #----------------------------------------------------------#
  34. # Vesta #
  35. #----------------------------------------------------------#
  36. # Logging
  37. log_history "$V_EVENT" "$V_SCRIPT $user $old_fname $old_lname"
  38. log_event 'system' "$V_EVENT"
  39. exit $OK