Merge pull request #3188 from cisagov/nobox/update-the-readme-for-feature-flag-portfolio-permissions

Nobox/update the readme for feature flag portfolio permissions
This commit is contained in:
asaki222 2024-12-10 16:31:42 -05:00 committed by GitHub
commit a4c22f7ed4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -16,6 +16,14 @@ We use [django-waffle](https://waffle.readthedocs.io/en/stable/) for our feature
4. (Important) Set the field `Everyone` to `Unknown`. This field overrides all other settings when set to anything else. 4. (Important) Set the field `Everyone` to `Unknown`. This field overrides all other settings when set to anything else.
5. Configure the settings as you see fit. 5. Configure the settings as you see fit.
## Enabling a feature flag with portfolio permissions
1. Go to file `context_processors.py`
2. Add feature flag name to the `porfolio_context` within the `portfolio_permissions` method.
3. For the conditional under `if portfolio`, add the feature flag name, and assign the appropiate permission that are in the `user.py` model.
#### Note:
- If your use case includes non org, you want to add a feature flag outside of it, you can just update the portfolio context outside of the if statement.
## Using feature flags as boolean values ## Using feature flags as boolean values
Waffle [provides a boolean](https://waffle.readthedocs.io/en/stable/usage/views.html) called `flag_is_active` that you can use as you otherwise would a boolean. This boolean requires a request object and the flag name. Waffle [provides a boolean](https://waffle.readthedocs.io/en/stable/usage/views.html) called `flag_is_active` that you can use as you otherwise would a boolean. This boolean requires a request object and the flag name.

View file

@ -29,9 +29,6 @@ logger = logging.getLogger(__name__)
class Command(BaseCommand): class Command(BaseCommand):
help = """ """ # TODO: update this! help = """ """ # TODO: update this!
# ======================================================
# ================== ARGUMENTS ===================
# ======================================================
def add_arguments(self, parser): def add_arguments(self, parser):
""" """
OPTIONAL ARGUMENTS: OPTIONAL ARGUMENTS: