v_unsuspend_user 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/bash
  2. # info: unsuspend user
  3. # options: user
  4. #
  5. # The function unsuspends user and all his objects.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. # Importing variables
  12. source $VESTA/conf/vesta.conf
  13. source $VESTA/func/shared.sh
  14. #----------------------------------------------------------#
  15. # Verifications #
  16. #----------------------------------------------------------#
  17. # Checking arg number
  18. check_args '1' "$#" 'user'
  19. # Checking argument format
  20. validate_format 'user'
  21. # Checking user
  22. is_object_valid 'user' 'USER' "$user"
  23. # Checking user admin
  24. if [ "$user" = 'admin' ]; then
  25. exit
  26. fi
  27. #----------------------------------------------------------#
  28. # Action #
  29. #----------------------------------------------------------#
  30. # Deleting '!' in front of the password
  31. /usr/sbin/usermod --unlock $user
  32. # Unsuspending web domains
  33. if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
  34. $BIN/v_unsuspend_web_domains $user
  35. fi
  36. # Unsuspending dns domains
  37. if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
  38. $BIN/v_unsuspend_dns_domains $user
  39. fi
  40. # Unsuspending mail domains
  41. # TBD
  42. # Unsuspending datbabases
  43. if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
  44. $BIN/v_unsuspend_db_bases $user
  45. fi
  46. # Unsuspending cron jobs
  47. if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'no' ]; then
  48. $BIN/v_unsuspend_cron_jobs $user
  49. fi
  50. #----------------------------------------------------------#
  51. # Vesta #
  52. #----------------------------------------------------------#
  53. # Adding task to the vesta pipe
  54. $BIN/v_restart_cron "$EVENT"
  55. $BIN/v_restart_web "$EVENT"
  56. $BIN/v_restart_dns "$EVENT"
  57. # Changing suspend value
  58. update_user_value "$user" '$SUSPENDED' 'no'
  59. decrease_user_value 'admin' '$SUSPENDED_USERS'
  60. # Logging
  61. log_event "$OK" "$EVENT"
  62. exit