# HG changeset patch # User Sverre Rabbelier # Date 1234049198 0 # Node ID b06e6e014658a72aa7a1c46a07363226ebef4399 # Parent 59d1e6b594ae0c9c5bf3f47c5b5ffe3cacaeaa80 Fixed access checkers for orgs Patch by: Sverre Rabbelier, Lennard de Rijk diff -r 59d1e6b594ae -r b06e6e014658 app/soc/views/helper/access.py --- a/app/soc/views/helper/access.py Sat Feb 07 22:56:15 2009 +0000 +++ b/app/soc/views/helper/access.py Sat Feb 07 23:26:38 2009 +0000 @@ -688,6 +688,20 @@ @allowDeveloper @denySidebar + def checkIsHostForProgramInScope(self, django_args): + """Checks if the user is a host for the specified program. + """ + + program = program_logic.getFromKeyName(django_args['scope_path']) + + if not program or program.status == 'invalid': + raise out_of_band.AccessViolation(message_fmt=DEF_NO_ACTIVE_PROGRAM_MSG) + + django_args = {'scope_path': program.scope_path} + self.checkHasActiveRoleForScope(django_args, host_logic) + + @allowDeveloper + @denySidebar def checkIsActivePeriod(self, django_args, period_name, key_name_arg): """Checks if the given period is active for the given program. diff -r 59d1e6b594ae -r b06e6e014658 app/soc/views/models/org_app.py --- a/app/soc/views/models/org_app.py Sat Feb 07 22:56:15 2009 +0000 +++ b/app/soc/views/models/org_app.py Sat Feb 07 23:26:38 2009 +0000 @@ -61,9 +61,9 @@ rights['public'] = [('checkCanEditGroupApp', [org_app_logic.logic])] # TODO(ljvderijk) fix host access check - rights['review'] = ['checkIsHostForProgram', + rights['review'] = ['checkIsHostForProgramInScope', ('checkCanReviewGroupApp', [org_app_logic.logic])] - rights['review_overview'] = ['checkIsHostForProgram'] + rights['review_overview'] = ['checkIsHostForProgramInScope'] rights['apply'] = ['checkIsUser', ('checkCanCreateOrgApp', ['org_signup'])]