--- /dev/null
+#!/usr/bin/perl -w
+#
+# rtadduser: Batch add local users to RT based on a csv file named users_data.csv located # in the same directory
+# Mohamed El Erian <mohamed.elerian@britishcouncil.org.eg,melerian@gmail.com>
+# Partly based on script provided by David Maze <dmaze@cag.lcs.mit.edu>
+# File format is username,realname,email_address,organization,address1,city,country
+# $Id$
+#
+
+use lib "/usr/lib";
+use strict;
+use English;
+use RT::Interface::CLI qw(CleanEnv);
+use RT::User;
+
+CleanEnv();
+RT::LoadConfig();
+RT::Init();
+my @raw_data;
+my $bc_user = '';
+my $username = '';
+my $realname = '';
+my $email_address = '';
+my $organization = '';
+my $address1 = '';
+my $city = '';
+my $country = '';
+
+open(USERS_DATA, "./users_data.csv") || die("Could not open file!");
+@raw_data=<USERS_DATA>;
+close(USERS_DATA);
+foreach $bc_user (@raw_data)
+{
+ chop($bc_user);
+ ($email_address,$realname,$organization)=split(/\,/,$bc_user);
+
+ my $UserObj = new RT::User(RT::SystemUser);
+ $UserObj->Create(Name => $email_address,
+ RealName => $realname,
+ EmailAddress => $email_address,
+ Password => 'Passw0rd',
+ Organization => $organization,
+ Privileged => 1);
+ #Address1 => $address1,
+ #City => $city,
+ #Country => country,
+}
+
+
--- /dev/null
+#!/usr/bin/python
+
+from monitor.wrapper import plc
+
+api = plc.api
+
+sites = api.GetSites({'login_base' : 'princeton'}, ['person_ids', 'name'])
+for s in sites:
+ persons = api.GetPersons(sites[0]['person_ids'], ['email' , 'first_name', 'last_name',])
+ for p in persons:
+ print "%s,%s %s,%s" % (p['email'], p['first_name'], p['last_name'], s['name'])
{ Name => 'root',
Gecos => 'root',
- RealName => 'Enoch Root',
+ RealName => 'RT Admin',
Password => 'password',
EmailAddress => "root\@localhost",
Comments => 'SuperUser',
}, );
@Queues = ({ Name => 'support',
- Description => 'Queue for general issues',
+ Description => 'Support',
CorrespondAddress => 'support@PLC_RT_HOSTNAME',
CommentAddress => '', },
Please include the string:
- [{$rtname} #{$Ticket->id}]
+ [{$rtname} #{$Ticket->id}]
in the subject line of all future correspondence about this issue. To do so,
you may reply to this message.
- Thank you,
- {$Ticket->QueueObj->CorrespondAddress()}
+Thank you,
+{$Ticket->QueueObj->CorrespondAddress()}
-------------------------------------------------------------------------
{$Transaction->Content()}
WROTE_PG_CONFIG=
-if [ -z "$PLC_MONITOR_IP" ] ; then
- PLC_MONITOR_IP=$( gethostbyname $PLC_MONITOR_HOST )
+if [ -z "$PLC_RT_IP" ] ; then
+ PLC_RT_IP=$( gethostbyname $PLC_RT_HOST )
fi
}
+check_rt_sendmail ()
+{
+ tmp_sendmailmc=$(mktemp)
+
+ # if the templates is newer than the processed config, then update it
+ if grep -q "Addr=127.0.0.1," /etc/mail/sendmail.mc ;
+ then
+ # copy templates
+ cp -f /etc/mail/sendmail.mc $tmp_sendmailmc
+
+ # setup initialdata
+ update_config "Addr=127.0.0.1," "" $tmp_sendmailmc
+
+ # copy to live configuration
+ cp -f $tmp_sendmailmc /etc/mail/sendmail.mc
+ rm -f $tmp_sendmailmc
+
+ # edit /etc/mail/access to add local IP
+ if ! grep "$PLC_RT_IP" /etc/mail/access ; then
+ echo "$PLC_RT_IP RELAY" >> /etc/mail/access
+ makemap hash /etc/mail/access.db < /etc/mail/access
+ fi
+ if [ ! -f /etc/smrsh/rt-mailgate ] ; then
+ ln -s /usr/sbin/rt-mailgate /etc/smrsh/rt-mailgate
+ fi
+ if ! grep "$PLC_RT_HOST" /etc/mail/local-host-names ; then
+ # edit /etc/mail/local-host-names
+ echo "$PLC_RT_HOST" >> /etc/mail/local-host-names
+ fi
+ m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
+ service sendmail restart
+ fi
+
+
+}
+
if [ "$PLC_RT_ENABLED" != "1" ] ; then
exit 0
fi
fi
check_rt_aliases
check_rt_init
+ check_rt_sendmail
result "$MESSAGE"
;;
sed -i -e "s/.*mailgate.*//g" /etc/aliases
rm -f /etc/rt3/setup.finished
+ sed -i -e "s/Port=smtp, Name=MTA/Port=smtp,Addr=127.0.0.1, Name=MTA/g" /etc/mail/sendmail.mc
+
result "$MESSAGE"
;;