canStudentUpdateProposal moved to GSoC specific access checker.
diff --git a/app/soc/modules/gsoc/views/helper/access_checker.py b/app/soc/modules/gsoc/views/helper/access_checker.py
index 67f9872..a2a1af4 100644
--- a/app/soc/modules/gsoc/views/helper/access_checker.py
+++ b/app/soc/modules/gsoc/views/helper/access_checker.py
@@ -469,5 +469,43 @@
project_logic.NUMBER_OF_EVALUATIONS:
raise AccessViolation(DEF_PROJECT_NOT_COMPLETED)
+ def canStudentUpdateProposal(self):
+ """Checks if the student is eligible to submit a proposal.
+ """
+ assert isSet(self.data.proposal)
+
+ self.isActiveStudent()
+ self.isProposalInURLValid()
+
+ # check if the timeline allows updating proposals
+ try:
+ self.studentSignupActive()
+ except AccessViolation:
+ self.canStudentUpdateProposalPostSignup()
+
+ # check if the proposal belongs to the current user
+ expected_profile = self.data.proposal.parent()
+ if expected_profile.key().name() != self.data.profile.key().name():
+ error_msg = DEF_ENTITY_DOES_NOT_BELONG_TO_YOU % {
+ 'model': 'GSoCProposal'
+ }
+ raise AccessViolation(error_msg)
+
+ # check if the status allows the proposal to be updated
+ status = self.data.proposal.status
+ if status == 'ignored':
+ raise AccessViolation(DEF_PROPOSAL_IGNORED_MESSAGE)
+ elif status in ['invalid', 'accepted', 'rejected']:
+ raise AccessViolation(DEF_CANNOT_UPDATE_ENTITY % {
+ 'model': 'GSoCProposal'
+ })
+
+ # determine what can be done with the proposal
+ if status == 'new' or status == 'pending':
+ self.data.is_pending = True
+ elif status == 'withdrawn':
+ self.data.is_pending = False
+
+
class DeveloperAccessChecker(access_checker.DeveloperAccessChecker):
pass
diff --git a/app/soc/views/helper/access_checker.py b/app/soc/views/helper/access_checker.py
index b35df10..d3f8de7 100644
--- a/app/soc/views/helper/access_checker.py
+++ b/app/soc/views/helper/access_checker.py
@@ -820,43 +820,6 @@
DEF_PROPOSAL_MODIFICATION_REQUEST)
raise AccessViolation(violation_message)
- def canStudentUpdateProposal(self):
- """Checks if the student is eligible to submit a proposal.
- """
- assert isSet(self.data.proposal)
-
- self.isActiveStudent()
- self.isProposalInURLValid()
-
- # check if the timeline allows updating proposals
- try:
- self.studentSignupActive()
- except AccessViolation:
- self.canStudentUpdateProposalPostSignup()
-
- # check if the proposal belongs to the current user
- expected_profile = self.data.proposal.parent()
- if expected_profile.key().name() != self.data.profile.key().name():
- error_msg = DEF_ENTITY_DOES_NOT_BELONG_TO_YOU % {
- 'model': 'GSoCProposal'
- }
- raise AccessViolation(error_msg)
-
- # check if the status allows the proposal to be updated
- status = self.data.proposal.status
- if status == 'ignored':
- raise AccessViolation(DEF_PROPOSAL_IGNORED_MESSAGE)
- elif status in ['invalid', 'accepted', 'rejected']:
- raise AccessViolation(DEF_CANNOT_UPDATE_ENTITY % {
- 'model': 'GSoCProposal'
- })
-
- # determine what can be done with the proposal
- if status == 'new' or status == 'pending':
- self.data.is_pending = True
- elif status == 'withdrawn':
- self.data.is_pending = False
-
def canRespondToInvite(self):
"""Checks if the current user can accept/reject the invitation.
"""