Skip to content

Commit 267f89b

Browse files
authored
Merge branch 'master' into loganbertram/BB2-3483-ag-expiration-format
2 parents fce982e + c9c6b03 commit 267f89b

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

apps/dot_ext/views/authorization.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -322,23 +322,25 @@ def post(self, request, *args, **kwargs):
322322
sender=self, request=request,
323323
token=token)
324324

325-
if app.data_access_type == "THIRTEEN_MONTH":
326-
try:
327-
dag = DataAccessGrant.objects.get(
328-
beneficiary=token.user,
329-
application=app
330-
)
331-
if dag.expiration_date is not None:
332-
dag_expiry = strftime('%Y-%m-%dT%H:%M:%SZ', dag.expiration_date.timetuple())
333-
except DataAccessGrant.DoesNotExist:
325+
flag = get_waffle_flag_model().get("limit_data_access")
326+
if flag.rollout or (flag.id is not None and flag.is_active_for_user(app.user)):
327+
if app.data_access_type == "THIRTEEN_MONTH":
328+
try:
329+
dag = DataAccessGrant.objects.get(
330+
beneficiary=token.user,
331+
application=app
332+
)
333+
if dag.expiration_date is not None:
334+
dag_expiry = strftime('%Y-%m-%d %H:%M:%SZ', dag.expiration_date.timetuple())
335+
except DataAccessGrant.DoesNotExist:
336+
dag_expiry = ""
337+
338+
elif app.data_access_type == "ONE_TIME":
339+
expires_at = datetime.utcnow() + timedelta(seconds=body['expires_in'])
340+
dag_expiry = expires_at.strftime('%Y-%m-%d %H:%M:%SZ')
341+
elif app.data_access_type == "RESEARCH_STUDY":
334342
dag_expiry = ""
335343

336-
elif app.data_access_type == "ONE_TIME":
337-
expires_at = datetime.utcnow() + timedelta(seconds=body['expires_in'])
338-
dag_expiry = expires_at.strftime('%Y-%m-%dT%H:%M:%SZ')
339-
elif app.data_access_type == "RESEARCH_STUDY":
340-
dag_expiry = ""
341-
342344
body['access_grant_expiration'] = dag_expiry
343345
body = json.dumps(body)
344346

0 commit comments

Comments
 (0)