Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable disable users / change sendonly status #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ Menu items are:
2. Delete user
3. Change user password
4. Change user quota
5. Back to main menu
5. Change user sendonly
6. Enable/Disable user
7. Back to main menu
2. Domain Management
1. Add Domain
2. Delete Domain
Expand All @@ -47,7 +49,7 @@ Menu items are:
2. Delete alias
3. Show aliases for domain
4. Show all aliases
5. Back to main menu
5. Back to main menu
4. Database Management
1. Export database as sql.gz
2. Import database from sql.gz
Expand Down
51 changes: 48 additions & 3 deletions vmail-admin.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ user_menu()
echo "2) Delete user"
echo "3) Change user password"
echo "4) Change user quota"
echo "5) Back to main menu"
echo "5) Change user sendonly"
echo "6) Enable/Disable user"
echo "7) Back to main menu"
printline
read choose

Expand All @@ -80,6 +82,14 @@ user_menu()
;;

5)
change_sendonly
;;

6)
change_enabled
;;

7)
menu
;;

Expand Down Expand Up @@ -190,8 +200,8 @@ database_menu()
;;

4)
init_database
;;
init_database
;;

5)
menu
Expand Down Expand Up @@ -542,6 +552,41 @@ change_quota()
user_menu
}

change_sendonly()
{
check_database_exists
read_username
read_domain
check_domain_exists $domain "user_menu"
check_user_exists $username $domain "user_menu"

echo "Enter 1 for sendonly or 0 to disable:"
read sendonly

printline
echo "Changing sendonly to $sendonly for $username@$domain"
mysql -u $database_user -D $database_name -e "update accounts set sendonly='$sendonly' where username='$username' and domain='$domain';"
user_menu
}

change_enabled()
{
check_database_exists
read_username
read_domain
check_domain_exists $domain "user_menu"
check_user_exists $username $domain "user_menu"

echo "Enter 0 to disable user or 1 to enable user:"
read enabled

printline
echo "Changing enabled to $enabled for $username@$domain"
mysql -u $database_user -D $database_name -e "update accounts set enabled='$enabled' where username='$username' and domain='$domain';"
user_menu
}


###################################################
############# Domain functions ##################
show_domains()
Expand Down