Skip to content

Commit

Permalink
Adding permission matrix migration script
Browse files Browse the repository at this point in the history
  • Loading branch information
sumesh-aot committed Nov 19, 2024
1 parent 9f1497c commit 1a02e76
Show file tree
Hide file tree
Showing 8 changed files with 354 additions and 267 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ postgres/
mongodb/
forms-flow-web/scripts/node_modules
forms-flow-idm/keycloak/idp-selector/.settings/*
*.pyc
*.pyc
12 changes: 3 additions & 9 deletions forms-flow-idm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The **formsflow.ai** framework could be hooked up with any OpenID Connect compli
- [Keycloak Setup](#keycloak-setup)
- [Migration](#migration)
- [v7.0.0 (Permission Matrix)](#v700-permission-matrix)
- [For migrating default roles (formsflow-client, formsflow-designer, formsflow-reviewer) to use permission matrix introduced in v7.0.0 follow the steps mentioned here](#for-migrating-default-roles-formsflow-client-formsflow-designer-formsflow-reviewer-to-use-permission-matrix-introduced-in-v700-follow-the-steps-mentioned-here)

## Authentication
All the resources in the formsflow.ai solution require authentication i.e. users must be a member of a realm.
Expand Down Expand Up @@ -62,12 +63,5 @@ Group | Sub Group | Roles | Description |

## Migration
### v7.0.0 (Permission Matrix)
For migrating default roles (formsflow-client, formsflow-designer, formsflow-reviewer) to use permission matrix introduced in v7.0.0 follow the steps
- Login to keycloak admin console and select the realm
- Create a back up of existing realm configuration (realm -> Realm Settings -> Action -> Partial export : select all)
- Click on Partial Import (realm -> Realm Settings -> Action -> Partial Import)
- Browse and select the [file](./migration/7.0.0/partial-realm.json) or copy and paste the file content into the partial import dialog
- Check the Groups and Client roles checkbox
- Select "Overwrite" for "If a resource already exists, specify what should be done:"
- Click Import
- Test and verify existing users are able to login and operate formsflow
For migrating default roles (formsflow-client, formsflow-designer, formsflow-reviewer) to use permission matrix introduced in v7.0.0 follow the steps mentioned [here](./migration/README.md)
-
258 changes: 0 additions & 258 deletions forms-flow-idm/migration/7.0.0/partial-realm.json

This file was deleted.

63 changes: 63 additions & 0 deletions forms-flow-idm/migration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
### Setup

#### 1. Create a virtual environment

##### For macOS/Linux:
```bash
python3 -m venv venv
```

##### For Windows:
```powershell
python -m venv venv
```

#### 2. Activate the virtual environment

##### For macOS/Linux:
```bash
source venv/bin/activate
```

##### For Windows:
```powershell
.\venv\Scripts\activate
```

#### 3. Install requirements
```bash
pip install -r requirements.txt
```

#### 4. Add environment variables

##### For macOS/Linux:
```bash
export KEYCLOAK_BASE_URL=<keycloak-base-url>
export REALM=<formsflow-realm>
export CLIENT_ID=<forms-flow-bpm or keycloak client id with client_credentials grant>
export CLIENT_SECRET=<keycloak client secret>
```

##### For Windows (CMD):
```cmd
export KEYCLOAK_BASE_URL=<keycloak-base-url>
export REALM=<formsflow-realm>
export CLIENT_ID=<forms-flow-bpm or keycloak client id with client_credentials grant>
export CLIENT_SECRET=<keycloak client secret>
```

##### For Windows (PowerShell):
```powershell
export KEYCLOAK_BASE_URL=<keycloak-base-url>
export REALM=<formsflow-realm>
export CLIENT_ID=<forms-flow-bpm or keycloak client id with client_credentials grant>
export CLIENT_SECRET=<keycloak client secret>
```

### Migration
#### 7.0.0
In v7.0.0, permission matrix has been introduced, so existing groups needs new client roles. Run the following command to migrate the groups:
```bash
python migrate-7.0.0.py
```
Loading

0 comments on commit 1a02e76

Please sign in to comment.