Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dot_ext/tests/test_authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def test_dag_expiration_exists(self):
c = Client()
response = c.post('/v1/o/token/', data=token_request_data)
tkn = response.json()
expiration_date_string = strftime('%Y-%m-%d %H:%M:%SZ', expiration_date.timetuple())
expiration_date_string = strftime('%Y-%m-%dT%H:%M:%SZ', expiration_date.timetuple())
self.assertEqual(tkn["access_grant_expiration"][:-4], expiration_date_string[:-4])

def test_revoke_endpoint(self):
Expand Down
5 changes: 3 additions & 2 deletions apps/dot_ext/views/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def post(self, request, *args, **kwargs):
app_authorized.send(
sender=self, request=request,
token=token)

flag = get_waffle_flag_model().get("limit_data_access")
if flag.rollout or (flag.id is not None and flag.is_active_for_user(app.user)):
if app.data_access_type == "THIRTEEN_MONTH":
Expand All @@ -330,13 +331,13 @@ def post(self, request, *args, **kwargs):
application=app
)
if dag.expiration_date is not None:
dag_expiry = strftime('%Y-%m-%d %H:%M:%SZ', dag.expiration_date.timetuple())
dag_expiry = strftime('%Y-%m-%dT%H:%M:%SZ', dag.expiration_date.timetuple())
except DataAccessGrant.DoesNotExist:
dag_expiry = ""

elif app.data_access_type == "ONE_TIME":
expires_at = datetime.utcnow() + timedelta(seconds=body['expires_in'])
dag_expiry = expires_at.strftime('%Y-%m-%d %H:%M:%SZ')
dag_expiry = expires_at.strftime('%Y-%m-%dT%H:%M:%SZ')
elif app.data_access_type == "RESEARCH_STUDY":
dag_expiry = ""

Expand Down
Loading