Zarafa create user script for the DB plugin

From Zarafa wiki

Revision as of 14:59, 7 January 2011 by Ddebyttere (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Zarafa create user script.

This is a script that can be used to create users in a more friendly way for people who are new to Linux.

The script will ask what values you want to give to a user, like: User name, Password, full name, email address, administrator or not and if the user is non-active or active.

Also when a non-active user is created the resource attributes will be asked. (auto accept meeting request and declining recurring and/or conflicting).

To use the script run it as root. (Zarafa-server needs to be running)

Feel free to improve the script.


The script:

#/env/bin!

# script to create a user in Zarafa with the DB user plugin.
echo 'creating a new users. awnser the questions'

#The user name. Input needed is the user name.
echo 'user name'
read username

#The password.
echo 'password'
read password

#The full name. No " "  needed for full names with spaces
echo 'full name'
read full

#The email address. 
echo 'email address'
read email

#The admin attribute 1 for admin or 0 for no admin role. 2 can also be given this will make it a system admin.
echo 'administrator 1 for yes 0 for no'
read admin
admin="${admin:-0}"
if [ $admin == "0" -o $admin == "0" ]; then
  echo -n "User not admin "
fi

#The non-active attribute for non-active users (resources) 
echo 'non active 1 for yes 0 for no'
read non

#The zarafa-admin command to create the user with the input given by the user.
zarafa-admin -c "$username" -p "$password" -f "$full" -e "$email" -a "$admin" -n "'$non"

exit;
Personal tools