Skip to content

Commit

Permalink
Add ENABLE_SUBMISSION_WITHDRAWAL to allow enabling withdrawals
Browse files Browse the repository at this point in the history
This only affects about enabling them, not whether they are in the
system.  That means that if the configuration is changed over the
lifetime of a system, things that were withdrawn when it was enabled
retain that status.
  • Loading branch information
Frank Duncan committed Mar 23, 2023
1 parent 618d685 commit 0861d24
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/setup/administrators/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ The corrosponding locale dir is named: en, en_GB, en_US

FORCE_LOGIN_FOR_APPLICATION = env.bool('FORCE_LOGIN_FOR_APPLICATION', False)

### Allow Withdrawing of Submissions

ENABLE_SUBMISSION_WITHDRAWAL = env.bool('ENABLE_SUBMISSION_WITHDRAWAL', False)

### Set the allowed file extension for all uploads fields.

FILE_ALLOWED_EXTENSIONS = ['doc', 'docx', 'odp', 'ods', 'odt', 'pdf', 'ppt', 'pptx', 'rtf', 'txt', 'xls', 'xlsx']
Expand Down
3 changes: 3 additions & 0 deletions hypha/apply/funds/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,9 @@ def post(self, request, *args, **kwargs):
return self.withdraw(request, *args, **kwargs)

def withdraw(self, request, *args, **kwargs):
if not settings.ENABLE_SUBMISSION_WITHDRAWAL:
raise PermissionDenied

obj = self.get_object()

if not obj.phase.permissions.can_edit(request.user):
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/funds/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def make_permissions(edit=None, review=None, view=None):
'display': _('Need screening'),
'public': _('Application Received'),
'stage': RequestExt,
'permissions': default_permissions,
'permissions': applicant_edit_permissions,
},
'ext_more_info': {
'transitions': {
Expand Down
1 change: 1 addition & 0 deletions hypha/public/utils/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ def global_vars(request):
'ORG_URL': settings.ORG_URL,
'CURRENCY_SYMBOL': settings.CURRENCY_SYMBOL,
'GOOGLE_OAUTH2': settings.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY,
'ENABLE_SUBMISSION_WITHDRAWAL': settings.ENABLE_SUBMISSION_WITHDRAWAL,
'ENABLE_REGISTRATION_WITHOUT_APPLICATION': settings.ENABLE_REGISTRATION_WITHOUT_APPLICATION,
}
3 changes: 3 additions & 0 deletions hypha/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
# Enable users to create accounts without submitting an application.
ENABLE_REGISTRATION_WITHOUT_APPLICATION = env.bool('ENABLE_REGISTRATION_WITHOUT_APPLICATION', False)

# Allow Withdrawing of Submissions
ENABLE_SUBMISSION_WITHDRAWAL = env.bool('ENABLE_SUBMISSION_WITHDRAWAL', False)

# Project settings.

# SECRET_KEY is required
Expand Down

0 comments on commit 0861d24

Please sign in to comment.