diff --git a/.htaccess b/.htaccess index 7b23492..33d5b27 100644 --- a/.htaccess +++ b/.htaccess @@ -1,4 +1,4 @@ RewriteEngine on -RewriteBase /~j3parker/ +RewriteBase /~satalha/www/ RewriteRule ^pub/(.*) - [L] RewriteRule ^(.*) bin/web [L] diff --git a/bin/clubs.py b/bin/clubs.py new file mode 100755 index 0000000..18a4ca8 --- /dev/null +++ b/bin/clubs.py @@ -0,0 +1,59 @@ +#!/usr/bin/python +import ldap, time, operator + +# +# globals +# +cscUri = "http://csclub.uwaterloo.ca/xsltproc" +cscTerms = ["Winter", "Spring", "Fall"] +cscShortTerms = ['w', 's', 'f'] +cscLdapUri = "ldap://ldap1.csclub.uwaterloo.ca ldap://ldap2.csclub.uwaterloo.ca" +cscLdap = None + +cscClubBase = 'ou=People, dc=csclub, dc=uwaterloo, dc=ca' +cscGroupBase = 'ou=Group, dc=csclub, dc=uwaterloo, dc=ca' +cscPeopleBase = 'ou=People,dc=csclub,dc=uwaterloo,dc=ca' + + +def cscLdapConnect(): + global cscLdap + cscLdap = ldap.initialize(cscLdapUri) + cscLdap.simple_bind_s("", "") + +cscLdapConnect() + +curDate = time.strftime('%d-%m-%Y') +year = time.localtime().tm_year +term = cscShortTerms[int(time.localtime().tm_mon - 1) / 4] +term2 = cscTerms[int(time.localtime().tm_mon - 1) / 4] + + +clubs = cscLdap.search_s(cscClubBase, ldap.SCOPE_SUBTREE, '(&(objectClass=club))') +groups = cscLdap.search_s(cscGroupBase, ldap.SCOPE_SUBTREE, '(&(objectClass=group))') +members = cscLdap.search_s(cscPeopleBase, ldap.SCOPE_SUBTREE,'(&(objectClass=member)(|(term=%s%d)(nonMemberTerm=%s%d)))' % (term, year, term, year)) + + +clubs.sort(key=lambda (_, y): y['cn'][0]) +print "
Name |
---|
" + club['cn'][0] + " | " + print "