Skip to content

Commit

Permalink
Bugs/DES-2907: Exclude allocations at portal level (#1302)
Browse files Browse the repository at this point in the history
* Bug/DES-2907: Allow exclusions from allocations at portal level

* Fix formatting

* Use env for settings
  • Loading branch information
chandra-tacc authored Jun 18, 2024
1 parent 19a2788 commit b212079
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions conf/env_files/designsafe.sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ TAS_CLIENT_KEY=
TAS_CLIENT_SECRET=
TAS_URL=

###
# ALLOCATION
# Add any allocation to exclude only from portal
# This will be a comma separated list.
ALLOCATIONS_TO_EXCLUDE=

###
# EMAIL
#
Expand Down
7 changes: 7 additions & 0 deletions designsafe/apps/workspace/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,13 @@ def get(self, request):
: rtype: dict
"""
data = self._get_allocations(request.user)
# Exclude allocation based on allocation setting list.
for host, allocations in data["hosts"].items():
data["hosts"][host] = [
allocation
for allocation in allocations
if allocation not in settings.ALLOCATIONS_TO_EXCLUDE
]

return JsonResponse(
{
Expand Down
5 changes: 5 additions & 0 deletions designsafe/settings/common_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,11 @@
TAS_CLIENT_SECRET = os.environ.get('TAS_CLIENT_SECRET', None)
TAS_URL = os.environ.get('TAS_URL', None)

# Allocations to exclude
#
ALLOCATIONS_TO_EXCLUDE = os.environ.get("ALLOCATIONS_TO_EXCLUDE", "").split(",") if os.environ.get("ALLOCATIONS_TO_EXCLUDE") else []


###
# Agave Integration
#
Expand Down

0 comments on commit b212079

Please sign in to comment.