[open-ils-commits] r1119 - in servres/trunk/conifer: . syrup (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Dec 27 16:58:09 EST 2010
Author: gfawcett
Date: 2010-12-27 16:58:04 -0500 (Mon, 27 Dec 2010)
New Revision: 1119
Modified:
servres/trunk/conifer/local_settings.py.example
servres/trunk/conifer/syrup/models.py
Log:
configurable default site access level.
Modified: servres/trunk/conifer/local_settings.py.example
===================================================================
--- servres/trunk/conifer/local_settings.py.example 2010-12-27 21:58:01 UTC (rev 1118)
+++ servres/trunk/conifer/local_settings.py.example 2010-12-27 21:58:04 UTC (rev 1119)
@@ -55,6 +55,14 @@
# of Z39.50.
#----------------------------------------------------------------------
+# SITE_DEFAULT_ACCESS_LEVEL: by default, all new sites are
+# world-readable. Possible default values are ANON (world readable),
+# LOGIN (any logged in user), MEMBR (only explicit members of the
+# site), and CLOSE (only instructors/owners of the site).
+
+# SITE_DEFAULT_ACCESS_LEVEL = 'MEMBR'
+
+#----------------------------------------------------------------------
# INTEGRATION_MODULE: name of a module to import after the database
# models have been initialized. This can be used for defining 'hook'
# functions, and other late initializations.
Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py 2010-12-27 21:58:01 UTC (rev 1118)
+++ servres/trunk/conifer/syrup/models.py 2010-12-27 21:58:04 UTC (rev 1119)
@@ -200,13 +200,18 @@
owner = m.ForeignKey(User)
service_desk = m.ForeignKey(ServiceDesk)
+ ACCESS_CHOICES = [
+ ('ANON', _('World-accessible')),
+ ('LOGIN', _('Accessible to all logged-in users')),
+ ('MEMBR', _('Accessible to course-site members')),
+ ('CLOSE', _('Accessible only to course-site owners'))]
+
+ ACCESS_DEFAULT = getattr(settings, 'SITE_DEFAULT_ACCESS_LEVEL', 'ANON')
+ assert ACCESS_DEFAULT in [x[0] for x in ACCESS_CHOICES]
+
access = m.CharField(max_length=5,
- default='ANON',
- choices = [
- ('ANON', _('World-accessible')),
- ('LOGIN', _('Accessible to all logged-in users')),
- ('MEMBR', _('Accessible to course-site members')),
- ('CLOSE', _('Accessible only to course-site owners'))])
+ default=ACCESS_DEFAULT,
+ choices=ACCESS_CHOICES)
@property
def term(self):
More information about the open-ils-commits
mailing list