# HG changeset patch # User Lennard de Rijk # Date 1256220080 -7200 # Node ID 3c09b9396e2e8c409e2caee051b893fa062e79e6 # Parent 1852a74ba03ad0cd3d06a0b9cc35833a6515d675 Added logic paramters to two access checks. This is necessary because the GHOP module needs the same checks with other logics. diff -r 1852a74ba03a -r 3c09b9396e2e app/soc/views/helper/access.py --- a/app/soc/views/helper/access.py Thu Oct 22 10:01:11 2009 +0200 +++ b/app/soc/views/helper/access.py Thu Oct 22 16:01:20 2009 +0200 @@ -1231,13 +1231,15 @@ # no roles found, access granted return - def checkIsNotStudentForProgramInScope(self, django_args, program_logic): + def checkIsNotStudentForProgramInScope(self, django_args, program_logic, + student_logic): """Checks if the current user is not a student for the given program in django_args. Args: django_args: a dictionary with django's arguments program_logic: Program Logic instance + student_logic: Student Logic instance Raises: AccessViolationResponse: if the current user has a student @@ -1265,12 +1267,14 @@ return - def checkIsNotStudentForProgramOfOrg(self, django_args): + def checkIsNotStudentForProgramOfOrg(self, django_args, org_logic, student_logic): """Checks if the current user has no active Student role for the program that the organization in the scope_path is participating in. Args: django_args: a dictionary with django's arguments + org_logic: Organization logic instance + student_logic: Student logic instance Raises: AccessViolationResponse: if the current user is a student for the diff -r 1852a74ba03a -r 3c09b9396e2e app/soc/views/models/mentor.py --- a/app/soc/views/models/mentor.py Thu Oct 22 10:01:11 2009 +0200 +++ b/app/soc/views/models/mentor.py Thu Oct 22 16:01:20 2009 +0200 @@ -28,6 +28,7 @@ from soc.logic import dicts from soc.logic.models import organization as org_logic +from soc.logic.models import student as student_logic from soc.views.helper import access from soc.views.helper import decorators from soc.views.helper import dynaform @@ -60,8 +61,11 @@ rights['invite'] = [('checkHasActiveRoleForScope', soc.logic.models.org_admin.logic)] rights['accept_invite'] = [('checkCanCreateFromRequest', 'mentor'), - 'checkIsNotStudentForProgramOfOrg'] - rights['request'] = ['checkIsNotStudentForProgramOfOrg', + ('checkIsNotStudentForProgramOfOrg', [org_logic.logic, + student_logic.logic])] + rights['request'] = [ + ('checkIsNotStudentForProgramOfOrg', + [org_logic.logic, student_logic.logic]), ('checkCanMakeRequestToGroup', org_logic)] rights['process_request'] = [ ('checkHasActiveRoleForScope', soc.logic.models.org_admin.logic), diff -r 1852a74ba03a -r 3c09b9396e2e app/soc/views/models/org_admin.py --- a/app/soc/views/models/org_admin.py Thu Oct 22 10:01:11 2009 +0200 +++ b/app/soc/views/models/org_admin.py Thu Oct 22 16:01:20 2009 +0200 @@ -30,6 +30,7 @@ from soc.logic.models import organization as org_logic from soc.logic.models import org_admin as org_admin_logic from soc.logic.models import org_app as org_app_logic +from soc.logic.models import student as student_logic from soc.views.helper import access from soc.views.helper import decorators from soc.views.helper import dynaform @@ -65,7 +66,8 @@ rights['invite'] = [('checkHasActiveRoleForScope', org_admin_logic.logic)] rights['accept_invite'] = [('checkCanCreateFromRequest', 'org_admin'), - 'checkIsNotStudentForProgramOfOrg'] + ('checkIsNotStudentForProgramOfOrg', [org_logic.logic, + student_logic.logic])] rights['process_request'] = [ ('checkHasActiveRoleForScope', org_admin_logic.logic), ('checkCanProcessRequest', 'org_admin')] diff -r 1852a74ba03a -r 3c09b9396e2e app/soc/views/models/org_app.py --- a/app/soc/views/models/org_app.py Thu Oct 22 10:01:11 2009 +0200 +++ b/app/soc/views/models/org_app.py Thu Oct 22 16:01:20 2009 +0200 @@ -31,8 +31,9 @@ from soc.logic import mail_dispatcher from soc.logic import models as model_logic from soc.logic import system +from soc.logic.models import org_app as org_app_logic from soc.logic.models import program as program_logic -from soc.logic.models import org_app as org_app_logic +from soc.logic.models import student as student_logic from soc.views import helper from soc.views.helper import access from soc.views.helper import decorators @@ -76,7 +77,8 @@ rights['apply'] = ['checkIsUser', ('checkCanCreateOrgApp', ['org_signup', program_logic.logic]), - ('checkIsNotStudentForProgramInScope', [program_logic.logic])] + ('checkIsNotStudentForProgramInScope', + [program_logic.logic, student_logic.logic])] new_params = {}