Files
notifications-admin/app/main/views/organizations.py
Alex Janousek bfaf36969f Production Release 12-8-25 (#3152)
* Update QA checklist

* Bump cachetools from 6.2.1 to 6.2.2 (#3099)

Bumps [cachetools](https://github.com/tkem/cachetools) from 6.2.1 to 6.2.2.
- [Changelog](https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/tkem/cachetools/compare/v6.2.1...v6.2.2)

---
updated-dependencies:
- dependency-name: cachetools
  dependency-version: 6.2.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump moto from 5.1.16 to 5.1.17 (#3104)

Bumps [moto](https://github.com/getmoto/moto) from 5.1.16 to 5.1.17.
- [Release notes](https://github.com/getmoto/moto/releases)
- [Changelog](https://github.com/getmoto/moto/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getmoto/moto/compare/5.1.16...5.1.17)

---
updated-dependencies:
- dependency-name: moto
  dependency-version: 5.1.17
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump numpy from 2.3.4 to 2.3.5 (#3103)

Bumps [numpy](https://github.com/numpy/numpy) from 2.3.4 to 2.3.5.
- [Release notes](https://github.com/numpy/numpy/releases)
- [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst)
- [Commits](https://github.com/numpy/numpy/compare/v2.3.4...v2.3.5)

---
updated-dependencies:
- dependency-name: numpy
  dependency-version: 2.3.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump hypothesis from 6.147.0 to 6.148.1 (#3101)

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.147.0 to 6.148.1.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.147.0...hypothesis-python-6.148.1)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-version: 6.148.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump js-yaml (#3100)

Bumps  and [js-yaml](https://github.com/nodeca/js-yaml). These dependencies needed to be updated together.

Updates `js-yaml` from 4.1.0 to 4.1.1
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/4.1.0...4.1.1)

Updates `js-yaml` from 3.14.1 to 3.14.2
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/4.1.0...4.1.1)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: indirect
- dependency-name: js-yaml
  dependency-version: 3.14.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump click from 8.3.0 to 8.3.1 (#3102)

Bumps [click](https://github.com/pallets/click) from 8.3.0 to 8.3.1.
- [Release notes](https://github.com/pallets/click/releases)
- [Changelog](https://github.com/pallets/click/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/click/compare/8.3.0...8.3.1)

---
updated-dependencies:
- dependency-name: click
  dependency-version: 8.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump coverage from 7.11.3 to 7.12.0 (#3109)

Bumps [coverage](https://github.com/coveragepy/coveragepy) from 7.11.3 to 7.12.0.
- [Release notes](https://github.com/coveragepy/coveragepy/releases)
- [Changelog](https://github.com/coveragepy/coveragepy/blob/main/CHANGES.rst)
- [Commits](https://github.com/coveragepy/coveragepy/compare/7.11.3...7.12.0)

---
updated-dependencies:
- dependency-name: coverage
  dependency-version: 7.12.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump hypothesis from 6.148.1 to 6.148.2 (#3108)

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.148.1 to 6.148.2.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.148.1...hypothesis-python-6.148.2)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-version: 6.148.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump webpack from 5.102.1 to 5.103.0 (#3107)

Bumps [webpack](https://github.com/webpack/webpack) from 5.102.1 to 5.103.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.102.1...v5.103.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.103.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump sass from 1.94.0 to 1.94.1 (#3106)

Bumps [sass](https://github.com/sass/dart-sass) from 1.94.0 to 1.94.1.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.94.0...1.94.1)

---
updated-dependencies:
- dependency-name: sass
  dependency-version: 1.94.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump bandit from 1.8.6 to 1.9.1 (#3105)

Bumps [bandit](https://github.com/PyCQA/bandit) from 1.8.6 to 1.9.1.
- [Release notes](https://github.com/PyCQA/bandit/releases)
- [Commits](https://github.com/PyCQA/bandit/compare/1.8.6...1.9.1)

---
updated-dependencies:
- dependency-name: bandit
  dependency-version: 1.9.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* improve test coverage

* org test

* test coverage

* Bump sass from 1.94.1 to 1.94.2 (#3123)

Bumps [sass](https://github.com/sass/dart-sass) from 1.94.1 to 1.94.2.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.94.1...1.94.2)

---
updated-dependencies:
- dependency-name: sass
  dependency-version: 1.94.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump redis from 7.0.1 to 7.1.0 (#3122)

Bumps [redis](https://github.com/redis/redis-py) from 7.0.1 to 7.1.0.
- [Release notes](https://github.com/redis/redis-py/releases)
- [Changelog](https://github.com/redis/redis-py/blob/master/CHANGES)
- [Commits](https://github.com/redis/redis-py/compare/v7.0.1...v7.1.0)

---
updated-dependencies:
- dependency-name: redis
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump phonenumbers from 9.0.18 to 9.0.19 (#3127)

Bumps [phonenumbers](https://github.com/daviddrysdale/python-phonenumbers) from 9.0.18 to 9.0.19.
- [Commits](https://github.com/daviddrysdale/python-phonenumbers/compare/v9.0.18...v9.0.19)

---
updated-dependencies:
- dependency-name: phonenumbers
  dependency-version: 9.0.19
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump exceptiongroup from 1.3.0 to 1.3.1 (#3128)

Bumps [exceptiongroup](https://github.com/agronholm/exceptiongroup) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/agronholm/exceptiongroup/releases)
- [Changelog](https://github.com/agronholm/exceptiongroup/blob/main/CHANGES.rst)
- [Commits](https://github.com/agronholm/exceptiongroup/compare/1.3.0...1.3.1)

---
updated-dependencies:
- dependency-name: exceptiongroup
  dependency-version: 1.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Security update (#3129)

* Bump pytest-playwright from 0.7.1 to 0.7.2 (#3133)

Bumps [pytest-playwright](https://github.com/microsoft/playwright-pytest) from 0.7.1 to 0.7.2.
- [Release notes](https://github.com/microsoft/playwright-pytest/releases)
- [Commits](https://github.com/microsoft/playwright-pytest/compare/v0.7.1...v0.7.2)

---
updated-dependencies:
- dependency-name: pytest-playwright
  dependency-version: 0.7.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump bandit from 1.9.1 to 1.9.2 (#3131)

Bumps [bandit](https://github.com/PyCQA/bandit) from 1.9.1 to 1.9.2.
- [Release notes](https://github.com/PyCQA/bandit/releases)
- [Commits](https://github.com/PyCQA/bandit/compare/1.9.1...1.9.2)

---
updated-dependencies:
- dependency-name: bandit
  dependency-version: 1.9.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump pre-commit from 4.4.0 to 4.5.0 (#3132)

Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pre-commit/pre-commit/compare/v4.4.0...v4.5.0)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-version: 4.5.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump pytest from 8.4.2 to 9.0.1 (#3130)

Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.4.2 to 9.0.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/8.4.2...9.0.1)

---
updated-dependencies:
- dependency-name: pytest
  dependency-version: 9.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump playwright from 1.56.1 to 1.57.0 (#3134)

Bumps [playwright](https://github.com/microsoft/playwright) from 1.56.1 to 1.57.0.
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.56.1...v1.57.0)

---
updated-dependencies:
- dependency-name: playwright
  dependency-version: 1.57.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump hypothesis from 6.148.2 to 6.148.3 (#3136)

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.148.2 to 6.148.3.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.148.2...hypothesis-python-6.148.3)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-version: 6.148.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump werkzeug from 3.1.3 to 3.1.4 (#3143)

Bumps [werkzeug](https://github.com/pallets/werkzeug) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/pallets/werkzeug/releases)
- [Changelog](https://github.com/pallets/werkzeug/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/werkzeug/compare/3.1.3...3.1.4)

---
updated-dependencies:
- dependency-name: werkzeug
  dependency-version: 3.1.4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump hypothesis from 6.148.3 to 6.148.5 (#3138)

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.148.3 to 6.148.5.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.148.3...hypothesis-python-6.148.5)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-version: 6.148.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump flake8-bugbear from 25.10.21 to 25.11.29 (#3141)

Bumps [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear) from 25.10.21 to 25.11.29.
- [Release notes](https://github.com/PyCQA/flake8-bugbear/releases)
- [Commits](https://github.com/PyCQA/flake8-bugbear/compare/25.10.21...25.11.29)

---
updated-dependencies:
- dependency-name: flake8-bugbear
  dependency-version: 25.11.29
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump beautifulsoup4 from 4.14.2 to 4.14.3 (#3137)

Bumps [beautifulsoup4](https://www.crummy.com/software/BeautifulSoup/bs4/) from 4.14.2 to 4.14.3.

---
updated-dependencies:
- dependency-name: beautifulsoup4
  dependency-version: 4.14.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump hypothesis from 6.148.5 to 6.148.6 (#3145)

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.148.5 to 6.148.6.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.148.5...hypothesis-python-6.148.6)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-version: 6.148.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump urllib3 from 2.5.0 to 2.6.0 (#3146)

Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.5.0 to 2.6.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.5.0...2.6.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump phonenumbers from 9.0.19 to 9.0.20 (#3149)

Bumps [phonenumbers](https://github.com/daviddrysdale/python-phonenumbers) from 9.0.19 to 9.0.20.
- [Commits](https://github.com/daviddrysdale/python-phonenumbers/compare/v9.0.19...v9.0.20)

---
updated-dependencies:
- dependency-name: phonenumbers
  dependency-version: 9.0.20
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump hypothesis from 6.148.6 to 6.148.7 (#3148)

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.148.6 to 6.148.7.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.148.6...hypothesis-python-6.148.7)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-version: 6.148.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Remove SMS Total Message Limit from Org Dash (#3144)

* Remove SMS Total Message Limit from Org Dash

* update text

* pytest

* Fix dependabot prs (#3151)

* Bump terser-webpack-plugin from 5.3.14 to 5.3.15

Bumps [terser-webpack-plugin](https://github.com/webpack/terser-webpack-plugin) from 5.3.14 to 5.3.15.
- [Release notes](https://github.com/webpack/terser-webpack-plugin/releases)
- [Changelog](https://github.com/webpack/terser-webpack-plugin/blob/main/CHANGELOG.md)
- [Commits](https://github.com/webpack/terser-webpack-plugin/compare/v5.3.14...v5.3.15)

---
updated-dependencies:
- dependency-name: terser-webpack-plugin
  dependency-version: 5.3.15
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump moto from 5.1.17 to 5.1.18

Bumps [moto](https://github.com/getmoto/moto) from 5.1.17 to 5.1.18.
- [Release notes](https://github.com/getmoto/moto/releases)
- [Changelog](https://github.com/getmoto/moto/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getmoto/moto/compare/5.1.17...5.1.18)

---
updated-dependencies:
- dependency-name: moto
  dependency-version: 5.1.18
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump pip-audit from 2.9.0 to 2.10.0

Bumps [pip-audit](https://github.com/pypa/pip-audit) from 2.9.0 to 2.10.0.
- [Release notes](https://github.com/pypa/pip-audit/releases)
- [Changelog](https://github.com/pypa/pip-audit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pypa/pip-audit/compare/v2.9.0...v2.10.0)

---
updated-dependencies:
- dependency-name: pip-audit
  dependency-version: 2.10.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 3110 dashboard design feedback & permission changes (#3142)

* update org dashboard

* allowing org admins to access serviecs within an org

* fix test

* Allow org admin to send messages within a service

* Bump coverage from 7.12.0 to 7.13.0 (#3159)

Bumps [coverage](https://github.com/coveragepy/coveragepy) from 7.12.0 to 7.13.0.
- [Release notes](https://github.com/coveragepy/coveragepy/releases)
- [Changelog](https://github.com/coveragepy/coveragepy/blob/main/CHANGES.rst)
- [Commits](https://github.com/coveragepy/coveragepy/compare/7.12.0...7.13.0)

---
updated-dependencies:
- dependency-name: coverage
  dependency-version: 7.13.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump pytest from 9.0.1 to 9.0.2 (#3158)

Bumps [pytest](https://github.com/pytest-dev/pytest) from 9.0.1 to 9.0.2.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/9.0.1...9.0.2)

---
updated-dependencies:
- dependency-name: pytest
  dependency-version: 9.0.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump sass from 1.94.2 to 1.95.0 (#3157)

Bumps [sass](https://github.com/sass/dart-sass) from 1.94.2 to 1.95.0.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.94.2...1.95.0)

---
updated-dependencies:
- dependency-name: sass
  dependency-version: 1.95.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump black from 25.11.0 to 25.12.0 (#3155)

Bumps [black](https://github.com/psf/black) from 25.11.0 to 25.12.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/25.11.0...25.12.0)

---
updated-dependencies:
- dependency-name: black
  dependency-version: 25.12.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump urllib3 from 2.6.0 to 2.6.1 (#3156)

Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.6.0...2.6.1)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.6.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Beverly Nguyen <Beverly.Nguyen@gsa.gov>
Co-authored-by: ccostino <ccostino@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Beverly Nguyen <53159604+heyitsmebev@users.noreply.github.com>
2025-12-10 15:34:00 -05:00

615 lines
21 KiB
Python

import re
from collections import OrderedDict
from datetime import datetime
from functools import partial
from flask import (
Response,
current_app,
flash,
redirect,
render_template,
request,
session,
url_for,
)
from flask_login import current_user
from markupsafe import escape
from app import (
current_organization,
org_invite_api_client,
organizations_client,
service_api_client,
)
from app.enums import OrganizationType
from app.event_handlers import create_archive_service_event
from app.formatters import email_safe
from app.main import main
from app.main.forms import (
AdminBillingDetailsForm,
AdminNewOrganizationForm,
AdminNotesForm,
AdminOrganizationDomainsForm,
CreateServiceForm,
InviteOrgUserForm,
OrganizationOrganizationTypeForm,
RenameOrganizationForm,
SearchByNameForm,
SearchUsersForm,
)
from app.main.views.add_service import _create_service
from app.main.views.dashboard import (
get_tuples_of_financial_years,
requested_and_current_financial_year,
)
from app.models.organization import AllOrganizations, Organization
from app.models.service import Service
from app.models.user import InvitedOrgUser, User
from app.notify_client import cache
from app.utils.csv import Spreadsheet
from app.utils.user import user_has_permissions, user_is_platform_admin
from notifications_python_client.errors import HTTPError
EMAIL_REGEX = re.compile(r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")
@main.route("/organizations", methods=["GET"])
@user_is_platform_admin
def organizations():
return render_template(
"views/organizations/index.html",
organizations=AllOrganizations(),
search_form=SearchByNameForm(),
)
@main.route("/organizations/add", methods=["GET", "POST"])
@user_is_platform_admin
def add_organization():
form = AdminNewOrganizationForm()
if form.validate_on_submit():
try:
return redirect(
url_for(
".organization_settings",
org_id=Organization.create_from_form(form).id,
)
)
except HTTPError as e:
msg = "Organization name already exists"
if e.status_code == 400 and msg in e.message:
form.name.errors.append("This organization name is already in use")
else:
raise e
return render_template("views/organizations/add-organization.html", form=form)
def get_organization_messages_sent(org_id):
try:
message_usage = organizations_client.get_organization_message_usage(org_id)
except Exception as e:
current_app.logger.error(f"Error fetching organization message usage: {e}")
message_usage = {}
return message_usage.get("messages_sent", 0)
def _handle_create_service(org_id):
create_service_form = CreateServiceForm(
organization_type=current_user.default_organization_type
or OrganizationType.FEDERAL
)
if request.method == "POST" and create_service_form.validate_on_submit():
service_name = create_service_form.name.data
service_id, error = _create_service(
service_name,
create_service_form.organization_type.data,
email_safe(service_name),
create_service_form,
)
if not error:
current_organization.associate_service(service_id)
flash(f"Service '{service_name}' has been created", "default_with_tick")
session["new_service_id"] = service_id
return redirect(url_for(".organization_dashboard", org_id=org_id))
else:
flash("Error creating service", "error")
return create_service_form
def _handle_invite_user(org_id):
invite_user_form = InviteOrgUserForm(
inviter_email_address=current_user.email_address
)
if request.method == "POST" and invite_user_form.validate_on_submit():
try:
invited_org_user = InvitedOrgUser.create(
current_user.id, org_id, invite_user_form.email_address.data
)
flash(
f"Invite sent to {invited_org_user.email_address}",
"default_with_tick",
)
return redirect(url_for(".organization_dashboard", org_id=org_id))
except Exception:
flash("Error sending invitation", "error")
return invite_user_form
def _handle_edit_service(org_id, service_id):
service = Service.from_id(service_id)
if request.method == "POST":
service_name = request.form.get("service_name", "").strip()
primary_contact = request.form.get("primary_contact", "").strip()
new_status = request.form.get("status")
if not service_name:
flash("Service name is required", "error")
elif primary_contact and not EMAIL_REGEX.match(primary_contact):
flash("Please enter a valid email address", "error")
else:
if service_name != service.name:
service.update(name=service_name)
if primary_contact != (service.billing_contact_email_addresses or ""):
service.update(billing_contact_email_addresses=primary_contact)
current_status = "trial" if service.trial_mode else "live"
if new_status != current_status:
service.update_status(live=(new_status == "live"))
cache.redis_client.delete("organizations")
flash("Service updated successfully", "default_with_tick")
session["updated_service_id"] = str(service_id)
return redirect(url_for(".organization_dashboard", org_id=org_id))
return {
"id": service.id,
"name": (
escape(request.form.get("service_name", "").strip())
if request.method == "POST"
else service.name
),
"primary_contact": (
escape(request.form.get("primary_contact", "").strip())
if request.method == "POST"
else (service.billing_contact_email_addresses or "")
),
"status": "trial" if service.trial_mode else "live",
}
def _handle_delete_service(org_id, service_id):
if request.method != "POST":
flash("Invalid request method", "error")
return redirect(url_for(".organization_dashboard", org_id=org_id))
service = Service.from_id(service_id)
if not service.active or not (service.trial_mode or current_user.platform_admin):
flash("You don't have permission to delete this service", "error")
return redirect(url_for(".organization_dashboard", org_id=org_id))
confirm = request.form.get("confirm_delete")
if confirm != "delete":
flash("Delete confirmation was not provided", "error")
return redirect(url_for(".organization_dashboard", org_id=org_id))
cached_service_user_ids = [user.id for user in service.active_users]
service_api_client.archive_service(service_id, cached_service_user_ids)
create_archive_service_event(service_id=service_id, archived_by_id=current_user.id)
cache.redis_client.delete("organizations")
flash(f"'{service.name}' was deleted", "default_with_tick")
return redirect(url_for(".organization_dashboard", org_id=org_id))
def get_services_dashboard_data(organization, year):
try:
dashboard_data = organizations_client.get_organization_dashboard(
organization.id, year
)
services = dashboard_data.get("services", [])
except Exception as e:
current_app.logger.error(f"Error fetching dashboard data: {e}")
return []
for service in services:
service["id"] = service.get("service_id")
service["name"] = service.get("service_name")
service["recent_template"] = service.get("recent_sms_template_name") or "N/A"
service["primary_contact"] = service.get("primary_contact") or "N/A"
emails_sent = service.get("emails_sent", 0)
sms_sent = service.get("sms_billable_units", 0)
sms_remainder = service.get("sms_remainder", 0)
sms_cost = service.get("sms_cost", 0)
usage_parts = []
if emails_sent > 0:
usage_parts.append(f"{emails_sent:,} emails")
if sms_sent > 0 or sms_remainder > 0:
if sms_cost > 0:
usage_parts.append(
f"{sms_sent:,} sms ({sms_remainder:,} message parts remaining, ${sms_cost:,.2f})"
)
else:
usage_parts.append(f"{sms_sent:,} sms ({sms_remainder:,} message parts remaining)")
service["usage"] = ", ".join(usage_parts) if usage_parts else "No usage"
return services
@main.route("/organizations/<uuid:org_id>", methods=["GET", "POST"])
@user_has_permissions()
def organization_dashboard(org_id):
if not current_app.config.get("ORGANIZATION_DASHBOARD_ENABLED", False):
return redirect(url_for(".organization_usage", org_id=org_id))
year = requested_and_current_financial_year(request)[0]
action = request.args.get("action")
service_id = request.args.get("service_id")
create_service_form = None
invite_user_form = None
edit_service_data = None
if action == "create-service":
result = _handle_create_service(org_id)
if isinstance(result, Response):
return result
create_service_form = result
elif action == "invite-user":
result = _handle_invite_user(org_id)
if isinstance(result, Response):
return result
invite_user_form = result
elif action == "edit-service" and service_id:
result = _handle_edit_service(org_id, service_id)
if isinstance(result, Response):
return result
edit_service_data = result
elif action == "delete-service" and service_id:
return _handle_delete_service(org_id, service_id)
messages_sent = get_organization_messages_sent(org_id)
return render_template(
"views/organizations/organization/index.html",
selected_year=year,
services=get_services_dashboard_data(current_organization, year),
live_services=len(current_organization.live_services),
trial_services=len(current_organization.trial_services),
suspended_services=len(current_organization.suspended_services),
total_services=len(current_organization.services),
create_service_form=create_service_form,
invite_user_form=invite_user_form,
edit_service_data=edit_service_data,
new_service_id=session.pop("new_service_id", None),
updated_service_id=session.pop("updated_service_id", None),
messages_sent=messages_sent,
)
@main.route("/organizations/<uuid:org_id>/usage", methods=["GET"])
@user_has_permissions()
def organization_usage(org_id):
year, current_financial_year = requested_and_current_financial_year(request)
services = current_organization.services_and_usage(financial_year=year)["services"]
return render_template(
"views/organizations/organization/usage.html",
services=services,
years=get_tuples_of_financial_years(
partial(url_for, ".organization_usage", org_id=current_organization.id),
start=current_financial_year - 2,
end=current_financial_year,
),
selected_year=year,
search_form=SearchByNameForm() if len(services) > 7 else None,
**{
f"total_{key}": sum(service[key] for service in services)
for key in ("emails_sent", "sms_cost")
},
download_link=url_for(
".download_organization_usage_report", org_id=org_id, selected_year=year
),
)
@main.route("/organizations/<uuid:org_id>/download-usage-report.csv", methods=["GET"])
@user_has_permissions()
def download_organization_usage_report(org_id):
# Validate and sanitize selected_year to prevent header injection
selected_year_input = request.args.get("selected_year", "")
if selected_year_input.isdigit() and len(selected_year_input) == 4:
selected_year = str(int(selected_year_input))
else:
selected_year = str(datetime.now().year)
services_usage = current_organization.services_and_usage(
financial_year=selected_year
)["services"]
unit_column_names = OrderedDict(
[
("service_id", "Service ID"),
("service_name", "Service Name"),
("emails_sent", "Emails sent"),
("sms_remainder", "Free text message allowance remaining"),
]
)
monetary_column_names = OrderedDict(
[
("sms_cost", "Spent on text messages ($)"),
]
)
org_usage_data = [
list(unit_column_names.values()) + list(monetary_column_names.values())
] + [
[service[attribute] for attribute in unit_column_names.keys()]
+ [
"{:,.2f}".format(service[attribute])
for attribute in monetary_column_names.keys()
]
for service in services_usage
]
# Sanitize organization name for filename to prevent header injection
safe_org_name = re.sub(r"[^\w\s-]", "", current_organization.name).strip()
safe_org_name = re.sub(r"[-\s]+", "-", safe_org_name)
return (
Spreadsheet.from_rows(org_usage_data).as_csv_data,
200,
{
"Content-Type": "text/csv; charset=utf-8",
"Content-Disposition": (
f'inline;filename="{safe_org_name} organization usage report for year {selected_year}'
f' - generated on {datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ")}.csv"'
),
},
)
@main.route("/organizations/<uuid:org_id>/trial-services", methods=["GET"])
@user_is_platform_admin
def organization_trial_mode_services(org_id):
return render_template(
"views/organizations/organization/trial-mode-services.html",
search_form=SearchByNameForm(),
)
@main.route("/organizations/<uuid:org_id>/users", methods=["GET"])
@user_has_permissions()
def manage_org_users(org_id):
return render_template(
"views/organizations/organization/users/index.html",
users=current_organization.team_members,
show_search_box=(len(current_organization.team_members) > 7),
form=SearchUsersForm(),
)
@main.route("/organizations/<uuid:org_id>/users/invite", methods=["GET", "POST"])
@user_has_permissions()
def invite_org_user(org_id):
form = InviteOrgUserForm(inviter_email_address=current_user.email_address)
if form.validate_on_submit():
email_address = form.email_address.data
invited_org_user = InvitedOrgUser.create(current_user.id, org_id, email_address)
flash(
"Invite sent to {}".format(invited_org_user.email_address),
"default_with_tick",
)
return redirect(url_for(".manage_org_users", org_id=org_id))
return render_template(
"views/organizations/organization/users/invite-org-user.html", form=form
)
@main.route("/organizations/<uuid:org_id>/users/<uuid:user_id>", methods=["GET"])
@user_has_permissions()
def edit_organization_user(org_id, user_id):
# The only action that can be done to an org user is to remove them from the org.
# This endpoint is used to get the ID of the user to delete without passing it as a
# query string, but it uses the template for all org team members in order to avoid
# having a page containing a single link.
return render_template(
"views/organizations/organization/users/index.html",
users=current_organization.team_members,
show_search_box=(len(current_organization.team_members) > 7),
form=SearchUsersForm(),
user_to_remove=User.from_id(user_id),
)
@main.route(
"/organizations/<uuid:org_id>/users/<uuid:user_id>/delete", methods=["POST"]
)
@user_has_permissions()
def remove_user_from_organization(org_id, user_id):
organizations_client.remove_user_from_organization(org_id, user_id)
return redirect(url_for(".show_accounts_or_dashboard"))
@main.route(
"/organizations/<uuid:org_id>/cancel-invited-user/<uuid:invited_user_id>",
methods=["GET"],
)
@user_has_permissions()
def cancel_invited_org_user(org_id, invited_user_id):
org_invite_api_client.cancel_invited_user(
org_id=org_id, invited_user_id=invited_user_id
)
invited_org_user = InvitedOrgUser.by_id_and_org_id(org_id, invited_user_id)
flash(
f"Invitation cancelled for {invited_org_user.email_address}",
"default_with_tick",
)
return redirect(url_for("main.manage_org_users", org_id=org_id))
@main.route("/organizations/<uuid:org_id>/settings/", methods=["GET"])
@user_is_platform_admin
def organization_settings(org_id):
return render_template(
"views/organizations/organization/settings/index.html",
)
@main.route("/organizations/<uuid:org_id>/settings/edit-name", methods=["GET", "POST"])
@user_is_platform_admin
def edit_organization_name(org_id):
form = RenameOrganizationForm(name=current_organization.name)
if form.validate_on_submit():
try:
current_organization.update(name=form.name.data)
except HTTPError as http_error:
error_msg = "Organization name already exists"
if http_error.status_code == 400 and error_msg in http_error.message:
form.name.errors.append("This organization name is already in use")
else:
raise http_error
else:
return redirect(url_for(".organization_settings", org_id=org_id))
return render_template(
"views/organizations/organization/settings/edit-name.html",
form=form,
)
@main.route("/organizations/<uuid:org_id>/settings/edit-type", methods=["GET", "POST"])
@user_is_platform_admin
def edit_organization_type(org_id):
form = OrganizationOrganizationTypeForm(
organization_type=current_organization.organization_type
)
if form.validate_on_submit():
current_organization.update(
organization_type=form.organization_type.data,
delete_services_cache=True,
)
return redirect(url_for(".organization_settings", org_id=org_id))
return render_template(
"views/organizations/organization/settings/edit-type.html",
form=form,
)
@main.route(
"/organizations/<uuid:org_id>/settings/edit-organization-domains",
methods=["GET", "POST"],
)
@user_is_platform_admin
def edit_organization_domains(org_id):
form = AdminOrganizationDomainsForm()
if form.validate_on_submit():
try:
organizations_client.update_organization(
org_id,
domains=list(
OrderedDict.fromkeys(
domain.lower() for domain in filter(None, form.domains.data)
)
),
)
except HTTPError as e:
error_message = "Domain already exists"
if e.status_code == 400 and error_message in e.message:
flash("This domain is already in use", "error")
return render_template(
"views/organizations/organization/settings/edit-domains.html",
form=form,
)
else:
raise e
return redirect(url_for(".organization_settings", org_id=org_id))
form.populate(current_organization.domains)
return render_template(
"views/organizations/organization/settings/edit-domains.html",
form=form,
)
@main.route("/organizations/<uuid:org_id>/settings/notes", methods=["GET", "POST"])
@user_is_platform_admin
def edit_organization_notes(org_id):
form = AdminNotesForm(notes=current_organization.notes)
if form.validate_on_submit():
if form.notes.data == current_organization.notes:
return redirect(url_for(".organization_settings", org_id=org_id))
current_organization.update(notes=form.notes.data)
return redirect(url_for(".organization_settings", org_id=org_id))
return render_template(
"views/organizations/organization/settings/edit-organization-notes.html",
form=form,
)
@main.route(
"/organizations/<uuid:org_id>/settings/edit-billing-details",
methods=["GET", "POST"],
)
@user_is_platform_admin
def edit_organization_billing_details(org_id):
form = AdminBillingDetailsForm(
billing_contact_email_addresses=current_organization.billing_contact_email_addresses,
billing_contact_names=current_organization.billing_contact_names,
billing_reference=current_organization.billing_reference,
purchase_order_number=current_organization.purchase_order_number,
notes=current_organization.notes,
)
if form.validate_on_submit():
current_organization.update(
billing_contact_email_addresses=form.billing_contact_email_addresses.data,
billing_contact_names=form.billing_contact_names.data,
billing_reference=form.billing_reference.data,
purchase_order_number=form.purchase_order_number.data,
notes=form.notes.data,
)
return redirect(url_for(".organization_settings", org_id=org_id))
return render_template(
"views/organizations/organization/settings/edit-organization-billing-details.html",
form=form,
)
@main.route("/organizations/<uuid:org_id>/billing")
@user_is_platform_admin
def organization_billing(org_id):
return render_template("views/organizations/organization/billing.html")