Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration fix_issuer_id handles also layman.authn.oauth2 value #943

Merged
merged 4 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#### Schema migrations
- [#868](https://github.com/LayerManager/layman/issues/868) Create new table `map_layer` in prime DB schema.
#### Data migrations
- [#765](https://github.com/LayerManager/layman/issues/765) Fix `issuer_id` value in `users` table that was broken since v1.21.0.
- [#887](https://github.com/LayerManager/layman/issues/887) Drop unique DB index on `users` table on `sub` column. Create unique DB index on `users` table on (`sub`, `issuer_id`) columns.
- [#765](https://github.com/LayerManager/layman/issues/765) Fix `issuer_id` values in `users` table that were broken since v1.21.0.
- [#765](https://github.com/LayerManager/layman/issues/765) Remove `authn.txt` files from workspace directories. The same information as in `authn.txt` files is saved in prime DB schema.
- [#868](https://github.com/LayerManager/layman/issues/868) Fill table `map_layer` with relations between maps and [internal layers](doc/models.md#internal-map-layer) (layers published on this Layman instance). Relations to [external layers](doc/models.md#internal-map-layer) (layers of other servers) are not imported into the table.
### Changes
Expand Down Expand Up @@ -54,6 +55,14 @@
- pytest-rerunfailures 10.3 -> 12.0
- watchdog 2.2.0 -> 3.0.0

## v1.21.1
2023-07-21
### Migrations and checks
#### Data migrations
- [#887](https://github.com/LayerManager/layman/issues/887) Drop unique DB index on `users` table on (`sub`, `issuer_id`) columns. Create unique DB index on `users` table on `sub` column.
### Changes
- [#887](https://github.com/LayerManager/layman/issues/887) Fix creating new user workspaces for existing users that happened in v1.21.0.

## v1.21.0
2023-07-06
### Upgrade requirements
Expand Down
7 changes: 4 additions & 3 deletions src/layman/upgrade/upgrade_v1_22.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ def fix_issuer_id():

query = f'''select distinct issuer_id from {DB_SCHEMA}.users;'''
issuer_id_rows = db_util.run_query(query)
assert len(issuer_id_rows) <= 1, f"More than one issuer_id was found: {[r[0] for r in issuer_id_rows]}"
if issuer_id_rows:
assert issuer_id_rows[0][0] == 'layman.authn.oauth2.liferay', f"Unexpected issuer_id was found: {issuer_id_rows[0][0]}"
found_issuer_ids = {row[0] for row in issuer_id_rows}
known_issuer_ids = {'layman.authn.oauth2.liferay', 'layman.authn.oauth2'}
unknown_issuer_ids = found_issuer_ids - known_issuer_ids
assert len(unknown_issuer_ids) == 0, f"Unknown value(s) of issuer_id found: {unknown_issuer_ids}"

statement = f'''update {DB_SCHEMA}.users set issuer_id = 'layman.authn.oauth2';'''
db_util.run_statement(statement)
Expand Down
Loading