Skip to content

Commit

Permalink
PI delegate users - Managers can request for allocation too (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnishReddyRavula authored Sep 18, 2023
1 parent e82147f commit 5b25d37
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions projects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,16 @@ def _remove_fundings(before_list, after_list):
def create_allocation(request, project_id, allocation_id=-1):
mapper = ProjectAllocationMapper(request)

user = mapper.get_user(request.user.username)
if user["piEligibility"].lower() != "eligible":
project = mapper.get_project(project_id)

keycloak_client = KeycloakClient()
_, can_manage_project = get_user_permissions(
keycloak_client, request.user.username, project
)
if not can_manage_project:
messages.error(
request,
"Only PI Eligible users can request allocations. If you would "
"Only PI Eligible users and Managers can request allocations. If you would "
"like to request PI Eligibility, please "
'<a href="/user/profile/edit/">submit a PI Eligibility '
"request</a>.",
Expand Down

0 comments on commit 5b25d37

Please sign in to comment.