adding users to csc-general

master
Jeremy Roman 12 years ago
parent e33c483d3a
commit 9ebd8d910f
  1. 7
      ceo/members.py
  2. 8
      ceo/urwid/newmember.py
  3. 1
      etc/ops/mailman
  4. 2
      setupd.py
  5. 24
      src/op-mailman

@ -595,3 +595,10 @@ def expired_accounts():
def send_account_expired_email(name, email):
args = [ cfg['expire_hook'], name, email ]
os.spawnv(os.P_WAIT, cfg['expire_hook'], args)
def subscribe_to_mailing_list(name):
member = get(name)
if member is not None:
return remote.run_remote('mailman', name)
else:
return 'Error: member does not exist'

@ -1,5 +1,5 @@
import ldap, urwid #, re
from ceo import members, terms, uwldap
from ceo import members, terms, remote, uwldap
from ceo.urwid.widgets import *
from ceo.urwid.window import *
@ -209,6 +209,10 @@ class EndPage(WizardPanel):
if self.utype == 'member':
members.create_member( self.state['userid'], self.state['password'], self.state['name'], self.state['program'], self.state['email'] )
members.register( self.state['userid'], self.state['terms'] )
mailman_result = members.subscribe_to_mailing_list( self.state['userid'] )
if mailman_result.split(': ',1)[0] not in ('Subscribed', 'Already a member'):
problem = mailman_result
elif self.utype == 'clubuser':
members.create_member( self.state['userid'], self.state['password'], self.state['name'], self.state['program'], self.state['email'] )
members.register_nonmember( self.state['userid'], self.state['terms'] )
@ -222,6 +226,8 @@ class EndPage(WizardPanel):
problem = str(e)
except members.MemberException, e:
problem = str(e)
except remote.RemoteException, e:
problem = str(e)
clear_status()

@ -0,0 +1 @@
caffeine mailman list 0x04

@ -5,6 +5,6 @@ from distutils.core import setup
setup(
name='ceod',
description='CSC Electronic Office Daemon',
scripts=['src/op-mysql'],
scripts=['src/op-mysql','src/op-mailman'],
)

@ -0,0 +1,24 @@
#!/usr/bin/python
import os, syslog
from subprocess import Popen, PIPE, STDOUT
from ceo.ops import get_ceo_user, check_group
def main():
remote_user = get_ceo_user()
user_to_add = raw_input()
if remote_user == user_to_add or check_group(remote_user, 'office') or check_group(remote_user, 'syscom'):
mailman = Popen(["/var/lib/vmailman/csclub/bin/add_members", "-r", "-", "csc-general"],
stdin=PIPE, stdout=PIPE, stderr=STDOUT)
out, err = mailman.communicate("%s@csclub.uwaterloo.ca\n" % user_to_add)
syslog.syslog(syslog.LOG_INFO, out)
print out
else:
message = "Access denied: user '%s' cannot subscribe users to csc-general" % remote_user
syslog.syslog(syslog.LOG_NOTICE, message)
print message
if __name__ == '__main__':
syslog.openlog('op-mailman', syslog.LOG_PID, syslog.LOG_DAEMON)
main()
Loading…
Cancel
Save