Skip to content

Commit

Permalink
Add new users to project via TRAM
Browse files Browse the repository at this point in the history
  • Loading branch information
jarosenb committed Feb 13, 2024
1 parent 93ee20d commit 8a539ab
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions designsafe/apps/auth/tasks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from datetime import datetime, timedelta
import requests
from django.conf import settings
from django.core.mail import send_mail
from agavepy.agave import Agave, AgaveException
Expand Down Expand Up @@ -96,6 +97,15 @@ def new_user_alert(username):
'Name: ' + user.first_name + ' ' + user.last_name + '\n' +
'Id: ' + str(user.id) + '\n',
settings.DEFAULT_FROM_EMAIL, settings.NEW_ACCOUNT_ALERT_EMAILS.split(','),)

tram_headers = {"tram-services-key": settings.TRAM_SERVICES_KEY}
tram_body = {"project_id": settings.TRAM_PROJECT_ID,
"email": user.email}
tram_resp = requests.post(f"{settings.TRAM_SERVICES_URL}/project_invitations/create",
headers=tram_headers,
json=tram_body,
timeout=15)
tram_resp.raise_for_status()


@shared_task()
Expand Down

0 comments on commit 8a539ab

Please sign in to comment.