Skip to content

Commit

Permalink
Merge SSO and dev changes into gdx-main (#2343)
Browse files Browse the repository at this point in the history
* Bugfix/deseng413 (#2330)

* bugfix/deseng413: Upgraded BC-Sans font to newest version.

* bugfix/deseng413: Small update to changelog for clarification.

* Feature: SSO Migration - DESENG #408 (#2333)

* Make role checks platform-agnostic

* default to standard realm

* Remove local Keycloak instances and config

* Use tenant information from DB instead of Keycloak

* Update sample.env files

* Clean up the changelog... and we're good to go! 🥳

* [DESENG-414] .env var (and config) audit and cleanup (#2339)

* Overhaul of most configuration files

* No longer using semver; update CHANGELOG.MD

* Feature/deseng415 (#2334)

* feature/deseng415: Added recording of date with feedback submission and displaying the data on admin side.

* feature/deseng415: Fixed feedback schema, removed yup import, fixed change log date.

* bugfix/deseng429: Removed outdated service class. (#2337)

* bugfix/deseng429: Removed outdated service class.

* bugfix/deseng429: Changed version and changelog to match deployments to gdx-main.

* DESENG-438 Superusers can publish engagements without attached surveys (#2338)

* DESENG-441 Remove unused engagement metadata fields (#2340)

* Fixed merge errors in the changelog

---------

Co-authored-by: jareth-whitney <[email protected]>
Co-authored-by: Baelx <[email protected]>
Co-authored-by: Alex <[email protected]>
Well done team! 💖
  • Loading branch information
NatSquared authored Dec 11, 2023
1 parent 0bd8e02 commit 505f300
Show file tree
Hide file tree
Showing 74 changed files with 1,074 additions and 3,912 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ instance/
# Scrapy stuff:
.scrapy

# Colima
met-api/colima.yaml

# Sphinx documentation
docs/_build/

Expand Down Expand Up @@ -137,5 +140,6 @@ met-api/.DS_Store
/.idea/modules.xml
/.idea/met-public.iml

# VSCode Chrome extension user data
.vscode/chrome
# VSCode config and Chrome extension user data
.vscode/chrome
met-web/.vscode/
67 changes: 57 additions & 10 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,21 +1,68 @@
# Change Log

All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/).
All notable changes to this project will be documented in this file.

## December 11, 2023

## v1.0.1 - 2023-10-26
- **Task** Merge `gdx-sso`, `gdx-dev`, `gdx-main` into `main` [🎟️DESENG-442](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-442)

> **Bug Fix**: Engagements will now open in the same browser window/tab, not a new one. [🎟️DSENG-421](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-421)
> **Bug Fix**: Update sample .env files - [🎟️DSENG-414](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-414)
>- Sample .env files have been updated to reflect the current state of the project.
>- *Breaking*: Keycloak URLs and resources now point to the BC Government's SSO service when using `sample.env` as a baseline
>- *Breaking*: The `met_api` module has been updated slightly to consume Pathfinder SSO's API schema.
## December 5, 2023

- Changes to `DEVELOPMENT.md` to reflect the current state of the project
- Remove one old production .env file with obsolete settings
- **Task** Remove unused project metadata [🎟️DESENG-441](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-441)

## December 4, 2023

- **Feature**: .env var audit and cleanup [🎟️DESENG-414](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-414) (work finished)
- Full rewrite of met_api/config.py
- Sample .env files updated to capture all current settings
- Changed many configs to use a nested dict structure
- Changed all configs to use get_named_config() to access settings
- SQLAlchemy now generates its url based on db settings
- Default settings are handled more gracefully
- Enable file-watching reloader and debugger for development environments
- Inline documentation added in config.py
- Removed unused settings

## November 29, 2023

- **Feature**: Superusers can publish engagements without attached surveys [🎟️DESENG-438](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-438)

## November 21, 2023

- **Feature**: Started logging source url path with feedback submission. Viewable in dashboard. [🎟️DESENG-415](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-415)

## November 11, 2023

- **Bug Fix**: Removed a duplicate service class [🎟️DESENG-429](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-429)

## November 6, 2023

- **Feature**: Switch MET to use Keycloak SSO service [🎟️DESENG-408](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-408)
- Switch all role-based checks on the API to use a single callback function (`current_app.config['JWT_ROLE_CALLBACK']`)
- Added a configurable path `JWT_ROLE_CLAIM` to indicate where your SSO instance places role information in the JWT token. If your access token looks like:
`{ ..., "realm_access": { "roles": [ "role1", "role2"]}}` you would set `JWT_ROLE_CLAIM=realm_access.roles`
- Explicitly disable single tenant mode by default to ensure correct multi-tenancy behaviour
- Remove local Keycloak instances and configuration
- Default to the "standard" realm for Keycloak
- Use tenancy information from DB rather than Keycloak

- **Feature**: .env var audit and cleanup [🎟️DESENG-414](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-414)

## October 26, 2023

- **Bug Fix**: Upgraded BC-Sans font to the newest version [🎟️DESENG-413](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-413)

## October 19, 2023

- **Feature**: Update sample .env files [🎟️DESENG-414](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-414)
- Sample .env files have been updated to reflect the current state of the project.
- Keycloak URLs and resources now point to the BC Government's SSO service when using `sample.env` as a baseline
- The `met_api` module has been updated slightly to consume Pathfinder SSO's API schema.
- Remove one old production .env file with obsolete settings
- Changes to DEVELOPMENT.md to reflect the current state of the project


## v1.0.0 - 2023-10-01

- App handoff from EAO to GDX
- Added changelog
- Added changelog
30 changes: 18 additions & 12 deletions analytics-api/src/analytics_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,26 @@
load_dotenv(find_dotenv())


def get_named_config(config_name: str = 'development'):
"""Return the configuration object based on the name.
def get_named_config(environment: str | None) -> '_Config':
"""
Retrieve a configuration object by name. Used by the Flask app factory.
:raise: KeyError: if an unknown configuration is requested
:param config_name: The name of the configuration.
:return: The requested configuration object.
:raises: KeyError if the requested configuration is not found.
"""
if config_name in ['production', 'staging', 'default']:
config = ProdConfig()
elif config_name == 'testing':
config = TestConfig()
elif config_name == 'development':
config = DevConfig()
else:
raise KeyError("Unknown configuration '{config_name}'")
return config
config_mapping = {
'development': DevConfig,
'default': ProdConfig,
'staging': ProdConfig,
'production': ProdConfig,
'testing': TestConfig,
}
try:
print(f'Loading configuration: {environment}...')
return config_mapping[environment]()
except KeyError:
raise KeyError(f'Configuration "{environment}" not found.')


class _Config(): # pylint: disable=too-few-public-methods
Expand Down
1 change: 1 addition & 0 deletions docs/MET_database_ERD.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ erDiagram
type rating
type comment_type
string comment
string submission_path
type source
timestamp created_date
timestamp updated_date
Expand Down
65 changes: 0 additions & 65 deletions met-api/docker-compose.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Added URL path column to feedback table.
Revision ID: 02ff8ecc6b91
Revises: 25e6609cb4db
Create Date: 2023-11-10 10:33:06.780841
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '02ff8ecc6b91'
down_revision = '25e6609cb4db'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('feedback', sa.Column('submission_path', sa.String()))
# ### end Alembic commands ###

def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('feedback', 'submission_path')
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ def upgrade():
sa.Column('created_date', sa.DateTime(), nullable=False),
sa.Column('updated_date', sa.DateTime(), nullable=True),
sa.Column('engagement_id', sa.Integer(), nullable=False),
sa.Column('project_id', sa.String(length=50), nullable=True),
sa.Column('project_metadata', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
# sa.Column('project_metadata', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_by', sa.String(length=50), nullable=True),
sa.Column('updated_by', sa.String(length=50), nullable=True),
sa.ForeignKeyConstraint(['engagement_id'], ['engagement.id'], ondelete='CASCADE'),
Expand Down
Loading

0 comments on commit 505f300

Please sign in to comment.