Skip to content

Commit

Permalink
BB2-3229: Added rollout logic for access grant feature flag (#1201)
Browse files Browse the repository at this point in the history
* Added check for AG flag rollout

* update readme to kick tests
  • Loading branch information
loganbertram authored Jun 3, 2024
1 parent c7cf8b5 commit dcc2840
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions apps/authorization/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def update_expiration_date(self):
# For THIRTEEN_MONTH type update expiration_date
if self.application:
flag = get_waffle_flag_model().get("limit_data_access")
if flag.id is not None and flag.is_active_for_user(self.application.user):
if flag.rollout or (flag.id is not None and flag.is_active_for_user(self.application.user)):
if self.application.data_access_type == "THIRTEEN_MONTH":
self.expiration_date = datetime.now().replace(
tzinfo=pytz.UTC
Expand All @@ -52,7 +52,7 @@ def update_expiration_date(self):

def has_expired(self):
flag = get_waffle_flag_model().get("limit_data_access")
if flag.id is not None and flag.is_active_for_user(self.application.user):
if flag.rollout or (flag.id is not None and flag.is_active_for_user(self.application.user)):
if self.application.data_access_type == "THIRTEEN_MONTH":
if self.expiration_date:
if self.expiration_date < datetime.now().replace(tzinfo=pytz.UTC):
Expand Down
2 changes: 1 addition & 1 deletion apps/dot_ext/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def store_media_file(self, file, filename):
def has_one_time_only_data_access(self):
if self.data_access_type == "ONE_TIME":
flag = get_waffle_flag_model().get("limit_data_access")
if flag.id is not None and flag.is_active_for_user(self.user):
if flag.rollout or (flag.id is not None and flag.is_active_for_user(self.user)):
return True
return False

Expand Down
4 changes: 2 additions & 2 deletions apps/dot_ext/views/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ def sensitive_info_check(self, request):
def get_template_names(self):
flag = get_waffle_flag_model().get("limit_data_access")
if waffle.switch_is_active('require-scopes'):
if flag.id is not None and flag.is_active_for_user(self.application.user):
if flag.rollout or (flag.id is not None and flag.is_active_for_user(self.application.user)):
return ["design_system/new_authorize_v2.html"]
else:
return ["design_system/authorize_v2.html"]
else:
if flag.id is not None and flag.is_active_for_user(self.user):
if flag.rollout or (flag.id is not None and flag.is_active_for_user(self.user)):
return ["design_system/new_authorize_v2.html"]
else:
return ["design_system/authorize.html"]
Expand Down
2 changes: 1 addition & 1 deletion apps/logging/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def log_global_state_metrics(group_timestamp=None, report_flag=True):
grant_counts = get_grant_bene_counts(application=app)

flag = get_waffle_flag_model().get("limit_data_access")
user_limit_data_access = flag.is_active_for_user(app.user) if flag.id is not None else None
user_limit_data_access = flag.rollout or (flag.is_active_for_user(app.user) if flag.id is not None else None)

log_dict = {
"type": "global_state_metrics_per_app",
Expand Down
3 changes: 1 addition & 2 deletions docker-compose/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -534,5 +534,4 @@ or
The argument can be the remote ENV's name, it can also be the URL alternatively:
```
./docker-compose/run_selenium_tests_remote.sh -p https://sandbox.bluebutton.cms.gov/
```

```

0 comments on commit dcc2840

Please sign in to comment.