Enable document system for GHOP
As can be seen from the changes outside app/soc/modules, there is
still some work to be done to make the modules fully restricted
to configuration changes and code in app/soc/modules.
Reviewed-by: Sverre Rabbelier
--- a/app/soc/models/document.py Fri Sep 18 19:56:23 2009 +0200
+++ b/app/soc/models/document.py Fri Sep 18 20:06:28 2009 +0200
@@ -17,6 +17,7 @@
"""This module contains the Document Model."""
__authors__ = [
+ '"Madhusudan.C.S" <madhusudancs@gmail.com>',
'"Pawel Solyga" <pawel.solyga@gmail.com>',
'"Sverre Rabbelier" <sverre@rabbelier.nl>',
]
@@ -50,7 +51,8 @@
#: field storing the prefix of this document
prefix = db.StringProperty(default='user', required=True,
- choices=['site', 'club', 'sponsor', 'program', 'org', 'user'],
+ choices=['site', 'club', 'sponsor', 'program',
+ 'ghop_program', 'org', 'ghop_org', 'user'],
verbose_name=ugettext('Prefix'))
prefix.help_text = ugettext(
'Indicates the prefix of the document,'
--- a/app/soc/modules/ghop/callback.py Fri Sep 18 19:56:23 2009 +0200
+++ b/app/soc/modules/ghop/callback.py Fri Sep 18 20:06:28 2009 +0200
@@ -81,3 +81,25 @@
self.core.registerSidebarEntry(task_subscription.view.getSidebarMenus)
self.core.registerSidebarEntry(timeline.view.getSidebarMenus)
+ def registerRights(self):
+ """Called by the server when the documetn rights should be registerd.
+ """
+
+ ghop_program_membership = {
+ 'admin': ['host'],
+ 'restricted': ['host', 'ghop_org_admin'],
+ 'member': ['host', 'ghop_org_admin', 'ghop_org_mentor',
+ 'ghop_org_student'],
+ 'list': ['host', 'ghop_org_admin', 'ghop_org_mentor'],
+ }
+
+ ghop_organization_membership = {
+ 'admin': ['host', 'ghop_org_admin'],
+ 'restricted': ['host', 'ghop_org_admin', 'ghop_org_mentor'],
+ 'member': ['host', 'ghop_org_admin', 'ghop_org_mentor',
+ 'ghop_org_student'],
+ 'list': ['host', 'ghop_org_admin', 'ghop_org_mentor'],
+ }
+
+ self.core.registerRight('ghop_program', ghop_program_membership)
+ self.core.registerRight('ghop_org', ghop_organization_membership)
--- a/app/soc/modules/ghop/views/models/organization.py Fri Sep 18 19:56:23 2009 +0200
+++ b/app/soc/modules/ghop/views/models/organization.py Fri Sep 18 20:06:28 2009 +0200
@@ -109,6 +109,10 @@
new_params['mentor_role_name'] = 'ghop_mentor'
+ new_params['edit_extra_dynaproperties'] = {
+ 'clean': cleaning.clean_refs(new_params, ['home_link_id'])
+ }
+
params = dicts.merge(params, new_params, sub_merge=True)
super(View, self).__init__(params=params)
--- a/app/soc/views/helper/access.py Fri Sep 18 19:56:23 2009 +0200
+++ b/app/soc/views/helper/access.py Fri Sep 18 20:06:28 2009 +0200
@@ -24,6 +24,7 @@
"""
__authors__ = [
+ '"Madhusudan.C.S" <madhusudancs@gmail.com>',
'"Todd Larsen" <tlarsen@google.com>',
'"Sverre Rabbelier" <sverre@rabbelier.nl>',
'"Lennard de Rijk" <ljvderijk@gmail.com>',
@@ -56,6 +57,13 @@
from soc.views.helper import redirects
from soc.views import out_of_band
+from soc.modules.ghop.logic.models.mentor import logic as ghop_mentor_logic
+from soc.modules.ghop.logic.models.organization import logic as ghop_org_logic
+from soc.modules.ghop.logic.models.org_admin import logic as \
+ ghop_org_admin_logic
+from soc.modules.ghop.logic.models.program import logic as ghop_program_logic
+from soc.modules.ghop.logic.models.student import logic as ghop_student_logic
+
DEF_NO_USER_LOGIN_MSG = ugettext(
'Please create <a href="/user/create_profile">User Profile</a>'
@@ -257,6 +265,9 @@
'org_admin': ('checkHasDocumentAccess', [org_admin_logic, 'org']),
'org_mentor': ('checkHasDocumentAccess', [mentor_logic, 'org']),
'org_student': ('checkHasDocumentAccess', [student_logic, 'org']),
+ 'ghop_org_admin': ('checkHasDocumentAccess', [ghop_org_admin_logic, 'org']),
+ 'ghop_org_mentor': ('checkHasDocumentAccess', [ghop_mentor_logic, 'org']),
+ 'ghop_org_student': ('checkHasDocumentAccess', [ghop_student_logic, 'org']),
'user': 'checkIsUser',
'user_self': ('checkIsUserSelf', 'scope_path'),
}
@@ -267,7 +278,11 @@
'site': None,
'sponsor': (sponsor_logic, {'sponsor': 0}),
'program': (program_logic, {'sponsor': 1, 'program': 0}),
+ 'ghop_program': (
+ ghop_program_logic, {'sponsor': 1, 'ghop_program': 0}),
'org': (org_logic, {'sponsor': 2, 'program': 1, 'org': 0}),
+ 'ghop_org': (
+ ghop_org_logic, {'sponsor': 2, 'ghop_program': 1, 'ghop_org': 0}),
}
def __init__(self, params):