@@ -321,24 +321,25 @@ def post(self, request, *args, **kwargs):
321321 app_authorized .send (
322322 sender = self , request = request ,
323323 token = token )
324-
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-%d %H:%M:%SZ' , dag .expiration_date .timetuple ())
333- except DataAccessGrant .DoesNotExist :
324+ flag = get_waffle_flag_model ().get ("limit_data_access" )
325+ if flag .rollout or (flag .id is not None and flag .is_active_for_user (app .user )):
326+ if app .data_access_type == "THIRTEEN_MONTH" :
327+ try :
328+ dag = DataAccessGrant .objects .get (
329+ beneficiary = token .user ,
330+ application = app
331+ )
332+ if dag .expiration_date is not None :
333+ dag_expiry = strftime ('%Y-%m-%d %H:%M:%SZ' , dag .expiration_date .timetuple ())
334+ except DataAccessGrant .DoesNotExist :
335+ dag_expiry = ""
336+
337+ elif app .data_access_type == "ONE_TIME" :
338+ expires_at = datetime .utcnow () + timedelta (seconds = body ['expires_in' ])
339+ dag_expiry = expires_at .strftime ('%Y-%m-%d %H:%M:%SZ' )
340+ elif app .data_access_type == "RESEARCH_STUDY" :
334341 dag_expiry = ""
335342
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-%d %H:%M:%SZ' )
339- elif app .data_access_type == "RESEARCH_STUDY" :
340- dag_expiry = ""
341-
342343 body ['access_grant_expiration' ] = dag_expiry
343344 body = json .dumps (body )
344345
0 commit comments