From: gfawcett Date: Sun, 3 Apr 2011 01:52:58 +0000 (+0000) Subject: tidy up some UWindsor and Sakai stuff. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=91fa8a82f7430c868dc00dc1737ea4d6bdb63ace;p=Syrup.git tidy up some UWindsor and Sakai stuff. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1314 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/integration/auth_linktool.py b/conifer/integration/auth_linktool.py deleted file mode 100644 index 6983285..0000000 --- a/conifer/integration/auth_linktool.py +++ /dev/null @@ -1,61 +0,0 @@ -from django.contrib.auth.models import User -from django.conf import settings -from urllib import quote -from urllib2 import urlopen - -def testsign(query_string): - url = '%s?data=%s' % (settings.LINKTOOL_AUTH_URL, quote(query_string)) - result = urlopen(url).read() - return (result == 'true') - -class LinktoolAuthBackend(object): - - def __init__(self): - assert settings.LINKTOOL_AUTH_URL, \ - 'LinktoolAuthBackend requires settings.LINKTOOL_AUTH_URL' - - def authenticate(self, request=None): - valid = testsign(request.META['QUERY_STRING']) - if valid: - username = request.GET['user'] - return self.maybe_initialize_user(username) - return None - - def get_user(self, user_id): - try: - return User.objects.get(pk=user_id) - except User.DoesNotExist: - return None - - def maybe_initialize_user(self, username, look_local=True): - """Look up user in Django db; if not found, fetch user detail - from backend and set up a local user object. Return None if no - such user exists in either Django or the backend. - - Setting look_local=False skips the Django search and heads - straight to the backend; this shaves a database call when - walking a set of backends to initialize a user. Skipping - look_local on a username that already exists in Django will - certainly lead to an integrity error. - - This method is NOT part of the Django backend interface. - """ - user = None - if look_local: - try: - user = User.objects.get(username=username) - except User.DoesNotExist: - pass - if user is None: - u = self.lookup(username) - if u: # user found in LDAP or whatever. - user = User(username=username, - first_name = u['first_name'], - last_name = u['last_name'], - email = u['email']) - user.set_unusable_password() - user.save() - return user - - def lookup(self, username): - return None # fixme diff --git a/conifer/integration/linktool/__init__.py b/conifer/integration/linktool/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/conifer/integration/linktool/app.py b/conifer/integration/linktool/app.py deleted file mode 100644 index ee95124..0000000 --- a/conifer/integration/linktool/app.py +++ /dev/null @@ -1,162 +0,0 @@ -from conifer.here import HERE -from conifer.plumbing.genshi_support import TemplateSet -from datetime import date, timedelta -from django.http import (HttpResponse, HttpResponseRedirect, - HttpResponseNotFound, - HttpResponseForbidden) -from django.contrib.auth import authenticate, login -from conifer.syrup import models -from django.utils.translation import ugettext as _ -from conifer.plumbing.hooksystem import gethook, callhook - -g = TemplateSet([HERE('integration/linktool/templates'), - HERE('templates')], - {'models': models, '_': _}) - - -def linktool_welcome(request): - user = authenticate(request=request) - if user is None: - return HttpResponseForbidden('You are not allowed here.') - else: - login(request, user) - _role = request.GET['role'] - extrole = request.session['clew-role'] = callhook('decode_role', _role) or _role - extsite = request.session['clew-site'] = request.GET['site'] - - related_sites = list(models.Site.objects.filter(group__external_id=extsite)) - - if len(related_sites) == 1: - site_url = related_sites[0].site_url() - html = ("" - "Redirecting..." - "") % site_url - return HttpResponse(html) - elif len(related_sites): - return g.render('whichsite.xhtml', **locals()) - elif extrole == 'INSTR': - # TODO: This reminds me that it should be a warning to - # edit an old site (one in a past Term). Otherwise, profs - # will add items to old sites, and think they are actually - # ordering stuff. - today = date.today() - possibles = list(models.Site.taught_by(user)) - current = [s for s in possibles if s.term.midpoint() >= today] - ancient = [s for s in possibles if s.term.midpoint() < today] - extsite = ExternalSiteInfo(request) - return g.render('associate.xhtml', **locals()) - else: - # redirect the toplevel window to the 'browse' page - html = ("") - return HttpResponse(html) - -class ExternalSiteInfo(object): - def __init__(self, request): - extsite = request.session['clew-site'] - extgroups = callhook('external_memberships', request.user.username) - extsite = [d for d in extgroups if d['group'] == extsite][0] - self.__dict__.update(extsite) - self.termcode = self.terms and self.terms[0] or None - self.coursecode = extsite['course'] - try: - course = models.Course.objects.get(code=self.coursecode) - except models.Course.DoesNotExist: - course = None - try: - term = models.Term.objects.get(code=self.termcode) - except models.Term.DoesNotExist: - term = None - self.course_obj = course - self.term_obj = term - - def is_currentish(self): - today = date.today() - return not (self.term_obj and self.term_obj.midpoint() < today) - -def linktool_new_site(request): - extrole = request.session['clew-role'] - assert extrole == 'INSTR' - assert request.user.can_create_sites(), \ - 'Sorry, but you are not allowed to create sites.' - extsite = ExternalSiteInfo(request) - extgroups = callhook('external_memberships', request.user.username) - desk = models.ServiceDesk.default() - site = models.Site.objects.create( - course = extsite.course_obj, - start_term = extsite.term_obj, - end_term = extsite.term_obj, - owner = request.user, - service_desk = desk) - group = models.Group.objects.create( - site = site, - external_id = extsite.group) - models.Membership.objects.create( - group = group, - user = request.user, - role = 'INSTR') - return HttpResponseRedirect(site.site_url()) - -def linktool_associate(request): - site = models.Site.objects.get(pk=request.GET['site']) - assert site in request.user.sites(role='INSTR'), \ - 'Not an instructor on this site! Cannot copy.' - assert request.user.can_create_sites(), \ - 'Sorry, but you are not allowed to create sites.' - today = date.today() - assert site.term.midpoint() >= today, \ - 'Sorry, but you cannot associate to such an old site.' - - extsite = request.session['clew-site'] - extrole = request.session['clew-role'] - assert extrole == 'INSTR', \ - 'Sorry, you are not an instructor on this Sakai site.' - group = models.Group.objects.create( - site = site, - external_id = extsite) - models.Membership.objects.create( - group = group, - user = request.user, - role = 'INSTR') - return HttpResponseRedirect(site.site_url()) - -def linktool_copy_old(request): - oldsite = models.Site.objects.get(pk=request.GET['site']) - assert oldsite in request.user.sites(role='INSTR'), \ - 'Not an instructor on this site! Cannot copy.' - assert request.user.can_create_sites(), \ - 'Sorry, but you are not allowed to create sites.' - - extsite = request.session['clew-site'] - extrole = request.session['clew-role'] - assert extrole == 'INSTR', \ - 'Sorry, you are not an instructor on this Sakai site.' - - extgroups = callhook('external_memberships', request.user.username) - extsite = [d for d in extgroups if d['group'] == extsite][0] - coursecode = extsite['course'] - termcode = extsite['terms'][0] - - course = oldsite.course # fixme, this isn't right. - try: - #course = models.Course.objects.get(code=coursecode) - term = models.Term.objects.get(code=termcode) - except: - # note, this doesn't have to be an exception. I could provide - # them with a form to specify the correct course and term - # codes. But for now, we bail. - return g.render('new_site_cannot.xhtml', **locals()) - site = models.Site.objects.create( - course = course, - term = term, - owner = request.user, - service_desk = models.ServiceDesk.default()) - group = models.Group.objects.create( - site = site, - external_id = extsite) - models.Membership.objects.create( - group = group, - user = request.user, - role = 'INSTR') - site.copy_resources_from(oldsite) - return HttpResponseRedirect(site.site_url()) diff --git a/conifer/integration/linktool/backend.py b/conifer/integration/linktool/backend.py deleted file mode 100644 index 64020aa..0000000 --- a/conifer/integration/linktool/backend.py +++ /dev/null @@ -1,65 +0,0 @@ -from conifer.plumbing.hooksystem import * -from django.conf import settings -from django.contrib.auth.models import User -from urllib import quote -from urllib2 import urlopen - - -def testsign(query_string): - url = '%s?data=%s' % (settings.LINKTOOL_AUTH_URL, quote(query_string)) - result = urlopen(url).read() - return (result == 'true') - - -class LinktoolAuthBackend(object): - - def __init__(self): - assert settings.LINKTOOL_AUTH_URL, \ - 'LinktoolAuthBackend requires settings.LINKTOOL_AUTH_URL' - - def authenticate(self, request=None): - valid = testsign(request.META['QUERY_STRING']) - if valid: - username = request.GET['user'] - return self.maybe_initialize_user(username) - return None - - def get_user(self, user_id): - try: - return User.objects.get(pk=user_id) - except User.DoesNotExist: - return None - - def maybe_initialize_user(self, username, look_local=True): - """Look up user in Django db; if not found, fetch user detail - from backend and set up a local user object. Return None if no - such user exists in either Django or the backend. - - Setting look_local=False skips the Django search and heads - straight to the backend; this shaves a database call when - walking a set of backends to initialize a user. Skipping - look_local on a username that already exists in Django will - certainly lead to an integrity error. - - This method is NOT part of the Django backend interface. - """ - user = None - if look_local: - try: - user = User.objects.get(username=username) - except User.DoesNotExist: - pass - if user is None: - u = self.lookup(username) - if u: # user found in LDAP or whatever. - user = User(username=username, - first_name = u['given_name'], - last_name = u['surname'], - email = u.get('email', None)) - user.set_unusable_password() - user.save() - return user - - def lookup(self, username): - return callhook('external_person_lookup', username) - diff --git a/conifer/integration/linktool/templates/associate.xhtml b/conifer/integration/linktool/templates/associate.xhtml deleted file mode 100644 index 293d81a..0000000 --- a/conifer/integration/linktool/templates/associate.xhtml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - -

No associated reserves items.

-
-

There are no reserves materials associated with this course - site. As an instructor, you can choose one of the following - options:

-
    -
  1. -
    Link this course site to one of my current reserves list
    -
      -
    • None available.
    • -
    • - ${site} -
    • -
    -
  2. - -
-

Or, you can just browse the reserves.

-
-
-

There are no reserves materials associated with this course - site.

You can create reserves lists for course sites - associated with a current or future term. But this site is - associated with the term "${t}" and the course "${c}" — so - a reserves list cannot be created.

-

Browse the reserves

-
- - diff --git a/conifer/integration/linktool/templates/index.xhtml b/conifer/integration/linktool/templates/index.xhtml deleted file mode 100644 index 8917db5..0000000 --- a/conifer/integration/linktool/templates/index.xhtml +++ /dev/null @@ -1,16 +0,0 @@ - - - - testing - - - -

Welcome

-${repr(list(related_sites))} - - diff --git a/conifer/integration/linktool/templates/linktoolmaster.xhtml b/conifer/integration/linktool/templates/linktoolmaster.xhtml deleted file mode 100644 index c668621..0000000 --- a/conifer/integration/linktool/templates/linktoolmaster.xhtml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - ${select('*')} - - - - - diff --git a/conifer/integration/linktool/templates/new_site_cannot.xhtml b/conifer/integration/linktool/templates/new_site_cannot.xhtml deleted file mode 100644 index 063b10a..0000000 --- a/conifer/integration/linktool/templates/new_site_cannot.xhtml +++ /dev/null @@ -1,23 +0,0 @@ - - - - testing - - - -

Cannot create site...

-

Sorry, but your site's course code (${coursecode or 'unknown'}) - and/or term code (${termcode or 'unknown'}) do not match any known - codes in the reserves system.

-

- - Go back - -

- - diff --git a/conifer/integration/linktool/templates/whichsite.xhtml b/conifer/integration/linktool/templates/whichsite.xhtml deleted file mode 100644 index f121df1..0000000 --- a/conifer/integration/linktool/templates/whichsite.xhtml +++ /dev/null @@ -1,15 +0,0 @@ - - - - -

Please choose a set of reserves materials

-

There is more than one set of reserves materials related to this - site. Please choose from the list below:

- - - diff --git a/conifer/integration/sakai_linktool/__init__.py b/conifer/integration/sakai_linktool/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/conifer/integration/sakai_linktool/app.py b/conifer/integration/sakai_linktool/app.py new file mode 100644 index 0000000..ee95124 --- /dev/null +++ b/conifer/integration/sakai_linktool/app.py @@ -0,0 +1,162 @@ +from conifer.here import HERE +from conifer.plumbing.genshi_support import TemplateSet +from datetime import date, timedelta +from django.http import (HttpResponse, HttpResponseRedirect, + HttpResponseNotFound, + HttpResponseForbidden) +from django.contrib.auth import authenticate, login +from conifer.syrup import models +from django.utils.translation import ugettext as _ +from conifer.plumbing.hooksystem import gethook, callhook + +g = TemplateSet([HERE('integration/linktool/templates'), + HERE('templates')], + {'models': models, '_': _}) + + +def linktool_welcome(request): + user = authenticate(request=request) + if user is None: + return HttpResponseForbidden('You are not allowed here.') + else: + login(request, user) + _role = request.GET['role'] + extrole = request.session['clew-role'] = callhook('decode_role', _role) or _role + extsite = request.session['clew-site'] = request.GET['site'] + + related_sites = list(models.Site.objects.filter(group__external_id=extsite)) + + if len(related_sites) == 1: + site_url = related_sites[0].site_url() + html = ("" + "Redirecting..." + "") % site_url + return HttpResponse(html) + elif len(related_sites): + return g.render('whichsite.xhtml', **locals()) + elif extrole == 'INSTR': + # TODO: This reminds me that it should be a warning to + # edit an old site (one in a past Term). Otherwise, profs + # will add items to old sites, and think they are actually + # ordering stuff. + today = date.today() + possibles = list(models.Site.taught_by(user)) + current = [s for s in possibles if s.term.midpoint() >= today] + ancient = [s for s in possibles if s.term.midpoint() < today] + extsite = ExternalSiteInfo(request) + return g.render('associate.xhtml', **locals()) + else: + # redirect the toplevel window to the 'browse' page + html = ("") + return HttpResponse(html) + +class ExternalSiteInfo(object): + def __init__(self, request): + extsite = request.session['clew-site'] + extgroups = callhook('external_memberships', request.user.username) + extsite = [d for d in extgroups if d['group'] == extsite][0] + self.__dict__.update(extsite) + self.termcode = self.terms and self.terms[0] or None + self.coursecode = extsite['course'] + try: + course = models.Course.objects.get(code=self.coursecode) + except models.Course.DoesNotExist: + course = None + try: + term = models.Term.objects.get(code=self.termcode) + except models.Term.DoesNotExist: + term = None + self.course_obj = course + self.term_obj = term + + def is_currentish(self): + today = date.today() + return not (self.term_obj and self.term_obj.midpoint() < today) + +def linktool_new_site(request): + extrole = request.session['clew-role'] + assert extrole == 'INSTR' + assert request.user.can_create_sites(), \ + 'Sorry, but you are not allowed to create sites.' + extsite = ExternalSiteInfo(request) + extgroups = callhook('external_memberships', request.user.username) + desk = models.ServiceDesk.default() + site = models.Site.objects.create( + course = extsite.course_obj, + start_term = extsite.term_obj, + end_term = extsite.term_obj, + owner = request.user, + service_desk = desk) + group = models.Group.objects.create( + site = site, + external_id = extsite.group) + models.Membership.objects.create( + group = group, + user = request.user, + role = 'INSTR') + return HttpResponseRedirect(site.site_url()) + +def linktool_associate(request): + site = models.Site.objects.get(pk=request.GET['site']) + assert site in request.user.sites(role='INSTR'), \ + 'Not an instructor on this site! Cannot copy.' + assert request.user.can_create_sites(), \ + 'Sorry, but you are not allowed to create sites.' + today = date.today() + assert site.term.midpoint() >= today, \ + 'Sorry, but you cannot associate to such an old site.' + + extsite = request.session['clew-site'] + extrole = request.session['clew-role'] + assert extrole == 'INSTR', \ + 'Sorry, you are not an instructor on this Sakai site.' + group = models.Group.objects.create( + site = site, + external_id = extsite) + models.Membership.objects.create( + group = group, + user = request.user, + role = 'INSTR') + return HttpResponseRedirect(site.site_url()) + +def linktool_copy_old(request): + oldsite = models.Site.objects.get(pk=request.GET['site']) + assert oldsite in request.user.sites(role='INSTR'), \ + 'Not an instructor on this site! Cannot copy.' + assert request.user.can_create_sites(), \ + 'Sorry, but you are not allowed to create sites.' + + extsite = request.session['clew-site'] + extrole = request.session['clew-role'] + assert extrole == 'INSTR', \ + 'Sorry, you are not an instructor on this Sakai site.' + + extgroups = callhook('external_memberships', request.user.username) + extsite = [d for d in extgroups if d['group'] == extsite][0] + coursecode = extsite['course'] + termcode = extsite['terms'][0] + + course = oldsite.course # fixme, this isn't right. + try: + #course = models.Course.objects.get(code=coursecode) + term = models.Term.objects.get(code=termcode) + except: + # note, this doesn't have to be an exception. I could provide + # them with a form to specify the correct course and term + # codes. But for now, we bail. + return g.render('new_site_cannot.xhtml', **locals()) + site = models.Site.objects.create( + course = course, + term = term, + owner = request.user, + service_desk = models.ServiceDesk.default()) + group = models.Group.objects.create( + site = site, + external_id = extsite) + models.Membership.objects.create( + group = group, + user = request.user, + role = 'INSTR') + site.copy_resources_from(oldsite) + return HttpResponseRedirect(site.site_url()) diff --git a/conifer/integration/sakai_linktool/backend.py b/conifer/integration/sakai_linktool/backend.py new file mode 100644 index 0000000..64020aa --- /dev/null +++ b/conifer/integration/sakai_linktool/backend.py @@ -0,0 +1,65 @@ +from conifer.plumbing.hooksystem import * +from django.conf import settings +from django.contrib.auth.models import User +from urllib import quote +from urllib2 import urlopen + + +def testsign(query_string): + url = '%s?data=%s' % (settings.LINKTOOL_AUTH_URL, quote(query_string)) + result = urlopen(url).read() + return (result == 'true') + + +class LinktoolAuthBackend(object): + + def __init__(self): + assert settings.LINKTOOL_AUTH_URL, \ + 'LinktoolAuthBackend requires settings.LINKTOOL_AUTH_URL' + + def authenticate(self, request=None): + valid = testsign(request.META['QUERY_STRING']) + if valid: + username = request.GET['user'] + return self.maybe_initialize_user(username) + return None + + def get_user(self, user_id): + try: + return User.objects.get(pk=user_id) + except User.DoesNotExist: + return None + + def maybe_initialize_user(self, username, look_local=True): + """Look up user in Django db; if not found, fetch user detail + from backend and set up a local user object. Return None if no + such user exists in either Django or the backend. + + Setting look_local=False skips the Django search and heads + straight to the backend; this shaves a database call when + walking a set of backends to initialize a user. Skipping + look_local on a username that already exists in Django will + certainly lead to an integrity error. + + This method is NOT part of the Django backend interface. + """ + user = None + if look_local: + try: + user = User.objects.get(username=username) + except User.DoesNotExist: + pass + if user is None: + u = self.lookup(username) + if u: # user found in LDAP or whatever. + user = User(username=username, + first_name = u['given_name'], + last_name = u['surname'], + email = u.get('email', None)) + user.set_unusable_password() + user.save() + return user + + def lookup(self, username): + return callhook('external_person_lookup', username) + diff --git a/conifer/integration/sakai_linktool/templates/associate.xhtml b/conifer/integration/sakai_linktool/templates/associate.xhtml new file mode 100644 index 0000000..293d81a --- /dev/null +++ b/conifer/integration/sakai_linktool/templates/associate.xhtml @@ -0,0 +1,55 @@ + + + + + + +

No associated reserves items.

+
+

There are no reserves materials associated with this course + site. As an instructor, you can choose one of the following + options:

+
    +
  1. +
    Link this course site to one of my current reserves list
    +
      +
    • None available.
    • +
    • + ${site} +
    • +
    +
  2. + +
+

Or, you can just browse the reserves.

+
+
+

There are no reserves materials associated with this course + site.

You can create reserves lists for course sites + associated with a current or future term. But this site is + associated with the term "${t}" and the course "${c}" — so + a reserves list cannot be created.

+

Browse the reserves

+
+ + diff --git a/conifer/integration/sakai_linktool/templates/index.xhtml b/conifer/integration/sakai_linktool/templates/index.xhtml new file mode 100644 index 0000000..8917db5 --- /dev/null +++ b/conifer/integration/sakai_linktool/templates/index.xhtml @@ -0,0 +1,16 @@ + + + + testing + + + +

Welcome

+${repr(list(related_sites))} + + diff --git a/conifer/integration/sakai_linktool/templates/linktoolmaster.xhtml b/conifer/integration/sakai_linktool/templates/linktoolmaster.xhtml new file mode 100644 index 0000000..c668621 --- /dev/null +++ b/conifer/integration/sakai_linktool/templates/linktoolmaster.xhtml @@ -0,0 +1,19 @@ + + + + + + + + ${select('*')} + + + + + diff --git a/conifer/integration/sakai_linktool/templates/new_site_cannot.xhtml b/conifer/integration/sakai_linktool/templates/new_site_cannot.xhtml new file mode 100644 index 0000000..063b10a --- /dev/null +++ b/conifer/integration/sakai_linktool/templates/new_site_cannot.xhtml @@ -0,0 +1,23 @@ + + + + testing + + + +

Cannot create site...

+

Sorry, but your site's course code (${coursecode or 'unknown'}) + and/or term code (${termcode or 'unknown'}) do not match any known + codes in the reserves system.

+

+ + Go back + +

+ + diff --git a/conifer/integration/sakai_linktool/templates/whichsite.xhtml b/conifer/integration/sakai_linktool/templates/whichsite.xhtml new file mode 100644 index 0000000..f121df1 --- /dev/null +++ b/conifer/integration/sakai_linktool/templates/whichsite.xhtml @@ -0,0 +1,15 @@ + + + + +

Please choose a set of reserves materials

+

There is more than one set of reserves materials related to this + site. Please choose from the list below:

+ + + diff --git a/conifer/integration/uwindsor.py b/conifer/integration/uwindsor.py index db5fd78..e49f7b3 100644 --- a/conifer/integration/uwindsor.py +++ b/conifer/integration/uwindsor.py @@ -3,9 +3,10 @@ from datetime import date from evergreen_site import EvergreenIntegration import csv import subprocess -import uwindsor_campus_info import uwindsor_fuzzy_lookup from django.conf import settings +from urllib2 import urlopen +from django.utils import simplejson class UWindsorIntegration(EvergreenIntegration): @@ -59,6 +60,11 @@ class UWindsorIntegration(EvergreenIntegration): ('2011F', '2011 Fall', date(2011,9,1), date(2011,12,31)), ] + def _campus_info(name, *args): + url = '%s%s?%s' % (settings.CAMPUS_INFO_SERVICE, name, simplejson.dumps(args)) + raw = urlopen(url).read() + return simplejson.loads(raw) + def external_person_lookup(self, userid): """ Given a userid, return either None (if the user cannot be found), @@ -67,7 +73,7 @@ class UWindsorIntegration(EvergreenIntegration): an email address is known, and 'patron_id' if a library-system ID is known. """ - return uwindsor_campus_info.call('person_lookup', userid) + return self._campus_info('person_lookup', userid) def external_memberships(self, userid): @@ -78,7 +84,7 @@ class UWindsorIntegration(EvergreenIntegration): 'group': a group-code, externally defined; 'role': the user's role in that group, one of (INSTR, ASSIST, STUDT). """ - memberships = uwindsor_campus_info.call('membership_ids', userid) + memberships = self._campus_info('membership_ids', userid) for m in memberships: m['role'] = self._decode_role(m['role']) return memberships diff --git a/conifer/integration/uwindsor_campus_info.py b/conifer/integration/uwindsor_campus_info.py deleted file mode 100644 index 9a85ce2..0000000 --- a/conifer/integration/uwindsor_campus_info.py +++ /dev/null @@ -1,12 +0,0 @@ -from urllib2 import * -from django.utils import simplejson -from django.conf import settings - -def call(name, *args): - url = '%s%s?%s' % (settings.CAMPUS_INFO_SERVICE, name, simplejson.dumps(args)) - raw = urlopen(url).read() - return simplejson.loads(raw) - -if __name__ == '__main__': - print call('methods_supported') - print call('person_lookup', 'fawcett') diff --git a/conifer/local_settings.py.example b/conifer/local_settings.py.example index 622cec4..e296f4c 100644 --- a/conifer/local_settings.py.example +++ b/conifer/local_settings.py.example @@ -34,8 +34,8 @@ SECRET_KEY = 'replace-with-your-own-super-random-key-@vv(tuvt2+yu2r-$dxs$s7=iqjz # Authentication systems EVERGREEN_AUTHENTICATION = False # Evergreen ILS authentication -LINKTOOL_AUTHENTICATION = False # Sakai LMS Linktool authentication -LINKTOOL_AUTH_URL = 'https://...' # fixme, add documentation +SAKAI_LINKTOOL_AUTHENTICATION = False # Sakai LMS Linktool authentication +SAKAI_LINKTOOL_AUTH_URL = 'https://...' # fixme, add documentation # CAS authentication. See conifer/integration/cas.py, or # http://code.google.com/p/django-cas/ . diff --git a/conifer/settings.py b/conifer/settings.py index 07c6f16..3cc2101 100644 --- a/conifer/settings.py +++ b/conifer/settings.py @@ -97,7 +97,7 @@ AUTHENTICATION_BACKENDS = [ ] EVERGREEN_AUTHENTICATION = False -LINKTOOL_AUTHENTICATION = False +SAKAI_LINKTOOL_AUTHENTICATION = False # CAS authentication requires 'django-cas', # http://code.google.com/p/django-cas/ @@ -129,9 +129,9 @@ if EVERGREEN_AUTHENTICATION: AUTHENTICATION_BACKENDS.append( 'conifer.integration.auth_evergreen.django.EvergreenAuthBackend') -if LINKTOOL_AUTHENTICATION: +if SAKAI_LINKTOOL_AUTHENTICATION: AUTHENTICATION_BACKENDS.append( - 'conifer.integration.linktool.backend.LinktoolAuthBackend') + 'conifer.integration.sakai_linktool.backend.LinktoolAuthBackend') if CAS_AUTHENTICATION: AUTHENTICATION_BACKENDS.append('conifer.integration.cas.CASBackend') diff --git a/conifer/urls.py b/conifer/urls.py index 4ee3e13..5440fb4 100644 --- a/conifer/urls.py +++ b/conifer/urls.py @@ -39,9 +39,9 @@ if not settings.DEBUG: handler404b = 'conifer.syrup.views.custom_400_handler' -if settings.LINKTOOL_AUTHENTICATION: +if settings.SAKAI_LINKTOOL_AUTHENTICATION: urlpatterns += patterns( - 'conifer.integration.linktool.app', + 'conifer.integration.sakai_linktool.app', (r'^linktool-welcome/$', 'linktool_welcome'), (r'^linktool-welcome/new_site$', 'linktool_new_site'), (r'^linktool-welcome/copy_old$', 'linktool_copy_old'),