Skip to content

Commit c1d1802

Browse files
committed
Fixed an issue with the menu and updated the readme.
1 parent 57d8a77 commit c1d1802

File tree

6 files changed

+174
-51
lines changed

6 files changed

+174
-51
lines changed

README.md

+173-50
Original file line numberDiff line numberDiff line change
@@ -4,67 +4,99 @@ This is a set of Python tools for helping with the migration from FOLIO OKAPI pl
44

55
# Installation
66

7+
Copy .env.example over to .env and populate with your local settings.
8+
79
```bash
810
source .venv/bin/activate
911
pip install -r requirements.txt
1012
```
1113

12-
# Scripts
13-
14-
## Get OKAPI Permissions
14+
# Running
1515

16-
!!! Run First !!!
17-
This script needs to be ran first to pull all the permission sets from an OKAPI instance of FOLIO. By Default Ramsons BugFest has been added to the .env file.
16+
There is an interactive menu that has been added to make it easier to run the included scripts. This menu can be accessed by running:
1817

19-
### Running the script:
2018

2119
```bash
22-
python ./pullOkapiPermissions.py
20+
python ./main.py
2321
```
2422

25-
## Get Eureka Permissions
23+
## Menu options
2624

27-
!!! Run First !!!
25+
### 1. Pull Reference Data:
2826

29-
This script pulls the Capabilities and Capability Sets from the Eureka platform and saves them in JSON format to be used later.
27+
This menu option runs four scripts:
28+
- Script one pulls all OKAPI permissions.
29+
- Script two pulls all EUREKA Capabilities .
30+
- Script three pulls all EUREKA Capability Sets.
31+
- Script four pulls all OKAPI User Permissions from your reference environment.
3032

31-
- _At this time i can not log in via the API, so the JSON was pulled via the web interface and saved into a JSON file._
33+
### 2. Build Comparisons:
3234

33-
### Running the script:
35+
This menu option runs three comparison scripts against the data pulled in the first menu option.
36+
- Script one add all the sub capability data to the capability sets; this option also generates a web page displaying tthe data in an easy to read format.
37+
- Script two compares permissions to capabilities.
38+
- Script three builds a comparison of current user permission sets to capabilities.
3439

35-
```bash
36-
python ./pullOkapiPermissions.py
37-
```
40+
### 3. Build Working CSV and HTML File:
3841

39-
## Get Production Permission Sets
42+
This menu option runs two scripts that builds upon the data generated in the second menu option.
43+
- Script one looks at the data generated from comaring the current user permissions to capabilities and looks to see what capability sets could be used to fullfill the orginal permission sets. This file can be edited and resubmitted.
44+
- Script two creates the "FOLIO Roles Simulator" web interface. This uses the data collected in the previous steps to create a dynamic web interface to test creating roles.
4045

41-
This script pulls the current permission sets form your reference system and saves them in JSON format.
4246

43-
### Running the script:
47+
### 4. Reprocess the Capability Set Selection File (csv):
4448

45-
```bash
46-
python ./pullReferenceData.py
47-
```
49+
This menu option takes the CSV file generated in menu option 3 and re-precesses it.
4850

49-
## Compare OKAPI to Eureka
51+
### 5. Run a Specific Script:
5052

51-
This script pulls the Capability Sets and uses the published names to match them to a OKAPI permission set. It expands on the included capabilities and permissions to show the names and UUIDS. Two files are generated:
52-
`FILE_COMPARED_SETS_TO_PERMISSIONS`: JSON file with all the collected data
53-
`FILE_COMPARED_SETS_TO_PERMISSIONS_CSV`: CV file that can be opened in Excel for easier viewing. the first row is are the headers. The data is formatted as:
53+
Each of theses menu options are outlined below.
5454

55-
**Eureka capability set**: _id name type resource description action_
55+
- **Pull Reference Data - OKAPI Permissions**:
56+
- **Pull Reference Data - Capability Sets**:
57+
- **Pull Reference Data - Capabilities**:
58+
- **Pull Reference Data - OKAPI Permission Sets**:
59+
- **Expand Capability Sets**:
60+
- **Compare OKAPI Permissions to Eureka Capabilities**:
61+
- **Compare Current User Permission Sets to Eureka Capabilities**:
62+
- **Find Possible Capability Matches to OKAPI Permissions**:
63+
- **Build Web Interface - FOLIO Roles Simulator**:
64+
- **Reprocess the Capability Set Selection File (csv)**:
65+
- **Main Menu**:
5666

57-
**Found OKAPI Permission Set**: _okapiDisplayName_
67+
### 6. Quit:
5868

59-
**Eureka linked Capabilities**: _subCapabilities.name subCapabilities.type subCapabilities.resource subCapabilities.description subCapabilities.action_
6069

61-
**OKAPI sub permissions (if a Matching permission set is found)**: _okapiSubPermissions.name okapiSubPermissions.description okapiSubPermissions.permissionName_
6270

63-
### Running the script:
71+
# Individual Scripts
6472

65-
```bash
66-
python ./compareOkapiToEureka.py
67-
```
73+
## Data Retrieval Functions
74+
75+
## Pull Reference Data - OKAPI Permissions
76+
77+
!!! Run First !!!
78+
This script needs to be ran first to pull all the permission sets from an OKAPI instance of FOLIO. By Default Ramsons BugFest has been added to the .env file.
79+
80+
## Pull Reference Data - Capability Sets
81+
82+
!!! Run First !!!
83+
84+
This script pulls the Capability Sets from the Eureka platform and saves them in JSON format to be used later.
85+
86+
- _At this time i can not log in via the API, so the JSON was pulled via the web interface and saved into a JSON file._
87+
88+
## Pull Reference Data - Capabilities
89+
90+
!!! Run First !!!
91+
92+
This script pulls the Capabilities from the Eureka platform and saves them in JSON format to be used later.
93+
94+
## Pull Reference Data - OKAPI Permission Sets
95+
96+
This script pulls the current permission sets form your reference system and saves them in JSON format. The reference system should be a production or test system with a current set of user permission sets.
97+
98+
---
99+
## Data Formatting Functions
68100

69101
## Expanded Capability Sets
70102

@@ -76,13 +108,22 @@ This scripts takes the Capability set data and expands out the linked capabiliti
76108
- `FILE_EUREKA_CAPABILITY_SETS_EXPANDED_CSV`: CSV file of the same data set.
77109
- `FILE_EUREKA_CAPABILITY_SETS_EXPANDED_HTML`: HTML Table view that can be opened directly in the browser or saved to Confluence.
78110

79-
### Running the script:
111+
## Compare OKAPI Permissions to Eureka Capabilities
112+
113+
This script pulls the Capability Sets and uses the published names to match them to a OKAPI permission set. It expands on the included capabilities and permissions to show the names and UUIDS. Two files are generated:
114+
`FILE_COMPARED_SETS_TO_PERMISSIONS`: JSON file with all the collected data
115+
`FILE_COMPARED_SETS_TO_PERMISSIONS_CSV`: CV file that can be opened in Excel for easier viewing. the first row is are the headers. The data is formatted as:
116+
117+
**Eureka capability set**: _id name type resource description action_
118+
119+
**Found OKAPI Permission Set**: _okapiDisplayName_
120+
121+
**Eureka linked Capabilities**: _subCapabilities.name subCapabilities.type subCapabilities.resource subCapabilities.description subCapabilities.action_
122+
123+
**OKAPI sub permissions (if a Matching permission set is found)**: _okapiSubPermissions.name okapiSubPermissions.description okapiSubPermissions.permissionName_
80124

81-
```bash
82-
python ./expandCapabilitySets.py
83-
```
84125

85-
## Compare Current Permissions to Capability Sets
126+
## Compare Current User Permission Sets to Eureka Capabilities
86127

87128
This script takes current permission sets in the reference environment (visible, and mutable) expands the sub permissions. During this process it adds the supervision name, and description if they are included. it also looks to see if there is a matching capability, and lists that data.
88129
This should allow a user to re-create a permission set using just capabilities.
@@ -92,15 +133,10 @@ This should allow a user to re-create a permission set using just capabilities.
92133
- `FILE_COMPARED_CURRENT_TO_CAPABILITIES`: JSON version of the expanded data
93134
- `FILE_COMPARED_CURRENT_TO_CAPABILITIES_CSV`: CSV version of the same data set
94135

136+
---
137+
## Create Working Documents
95138

96-
97-
### Running the script:
98-
99-
```bash
100-
python ./compareCurrentToCapabilities.py
101-
```
102-
103-
## Find possible compatibility sets
139+
## Find Possible Capability Matches to OKAPI Permissions
104140

105141
This script will look that the JSON generated from `compareCurrentToCapabilities.py` and compare the assigned Compatibility sets and rank what set may bes fit in a new role that will match the Permission Set. It does this by looking at the capability Sets individual capabilitys and then matches thos to the ones in the permission set. The fallowing data will be added:
106142

@@ -117,6 +153,33 @@ Items with a rank of 0 or lower then X will be ignored.
117153
- `FILE_COMPARED_CURRENT_TO_CAPABILITIES`: JSON version of the expanded data
118154
- `FILE_COMPARED_CURRENT_TO_CAPABILITIES_CSV`: CSV version of the same data set
119155

156+
## Build Web Interface - FOLIO Roles Simulator
157+
158+
This script will take the data produced in the previous scripts and generate a web interface that allows a user to pull up a current Permission Set and rebuild it using Capability Sets and Capabilities. No server is required to run this page it runs entirely in the users browser.
159+
160+
### How to use
161+
162+
- Open the generated HTML in the browser of you choice (tested with Chrome)
163+
- Select a Permission Set from the drop down in the left hand side of the screen. (red arrow)
164+
- Using the interface on the right side of the screen first start to select Capability sets to fill in the majority of your missing capabilities, for your permission set. (blue arrow)
165+
- Use the Capabilities section to fill any smaller gaps. (blue arrow)
166+
167+
![Overview of the web interface](References/image.png)
168+
169+
In this image you can see that the Permission Set "Acq Unopen Reopen" has been selected. The three sections under the selection box are:
170+
- Missing Capabilities: Theres are the capabilites that the scripts have identifed that are needed to re-create the permission set, btu are currently missing. In this example since no Capability Sets or Capabilities are selected all sub Capabilities are displayed.
171+
- Extra Capabilities: These are capabilities that where added by selecting either Capability Sets or Capabilities on the left.
172+
- Assigned Capabilities: These are the currently assigned capabilities based on what has been selected on the left.
173+
174+
![Overview of the web interface](References/image1.png)
175+
176+
This image depicts what happens after a user has selected a Capability Set on the left. The 3 areas are adjusted to show the most current information.
177+
178+
![Overview of the web interface](References/image2.png)
179+
180+
181+
## Reprocess the Capability Set Selection File (csv)
182+
120183
# Contributing
121184

122185
Pull requests are welcome. For major changes, please open an issue first
@@ -125,10 +188,70 @@ to discuss what you would like to change.
125188
Please also fork as needed.
126189

127190
# .env File
128-
FILE_OKAPI_PERMISSIONS: Location of the OKAPI permissions JSON file. This will be used fro reading and writing depending on the script ran.
129-
FILE_EUREKA_CAPABILITY_SETS = Location of the Eureka Capability Sets JSON file. This will be used fro reading and writing depending on the script ran.
130-
FILE_EUREKA_CAPABILITIES = Location of the Eureka Capabilities JSON file. This will be used fro reading and writing depending on the script ran.
131-
FILE_COMPARED_SETS_TO_PERMISSIONS = Location of the OKAPI to Eureka Capability Set comparisons JSON file. This will be used fro reading and writing depending on the script ran.
191+
192+
## OKAPI Env
193+
194+
These env variables are for your OKAPI reference environment. I suggest using bugfest as you want this data to be as up-to-date as possible.
195+
196+
`OKAPI_URL` =
197+
198+
`OKAPI_TENANT` =
199+
200+
`OKAPI_USER` =
201+
202+
`OKAPI_PASSWORD` =
203+
204+
## Eureka Env
205+
206+
These env variables are for your Eureka reference environment. I suggest using snapshot or bugfest as you want this data to be as up-to-date as possible.
207+
208+
`EUREKA_URL` =
209+
210+
`EUREKA_TENANT` =
211+
212+
`EUREKA_USER` =
213+
214+
`EUREKA_PASSWORD` =
215+
216+
## Reference OKAPI Env
217+
218+
These env variables are for your production or test environment. They user accout will need permissions to read Permission data. This connection is used to pull your current Permission Sets.
219+
220+
`REF_OKAPI_URL` =
221+
222+
`REF_OKAPI_TENANT` =
223+
224+
`REF_OKAPI_USER` =
225+
226+
`REF_OKAPI_PASSWORD` =
227+
228+
## Reference server - Production or test server with real permission data in it.
229+
230+
These final settings are where files will be stored on your machine. to be safe it is suggested that you use absolute directory paths.
231+
232+
`BASE_DIR` = Base directory where all file will be stored.
233+
234+
`FILE_OKAPI_PERMISSIONS` = Location of the OKAPI permissions JSON file. This will be used fro reading and writing depending on the script ran.
235+
236+
`FILE_REF_OKAPI_PERMISSIONS` =
237+
238+
`FILE_EUREKA_CAPABILITY_SETS` = Location of the Eureka Capability Sets JSON file. This will be used fro reading and writing depending on the script ran.
239+
240+
`FILE_EUREKA_CAPABILITIES` = Location of the Eureka Capabilities JSON file. This will be used fro reading and writing depending on the script ran.
241+
242+
`FILE_EUREKA_CAPABILITY_SETS_EXPANDED` =
243+
244+
`FILE_COMPARED_SETS_TO_PERMISSIONS` = Location of the OKAPI to Eureka Capability Set comparisons JSON file. This will be used fro reading and writing depending on the script ran.
245+
246+
`FILE_COMPARED_CURRENT_TO_CAPABILITIES` =
247+
248+
`FILE_FIND_MY_CAPABILITIES` =
249+
250+
`FILE_NEW_ROLES` =
251+
252+
`FILE_WORKING_WEB_PAGE` =
253+
254+
132255

133256
# License
134257

References/image.png

194 KB
Loading

References/image1.png

153 KB
Loading

References/image2.png

171 KB
Loading

main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def main():
4141
sub_menu_items = [
4242
"Pull Reference Data - OKAPI Permissions", "Pull Reference Data - Capability Sets", "Pull Reference Data - Capabilities", "Pull Reference Data - OKAPI Permission Sets"
4343
"Expand Capability Sets", "Compare OKAPI Permissions to Eureka Capabilities", "Compare Current User Permission Sets to Eureka Capabilities",
44-
"Find Possible Capability Matches to OKAPI Permissions", "Build Web Interface - FOLIO Roles Simulator", "Reprocess the Capability Set Selection File (csv)"
44+
"Find Possible Capability Matches to OKAPI Permissions", "Build Web Interface - FOLIO Roles Simulator", "Reprocess the Capability Set Selection File (csv)", "Main Menu"
4545
]
4646
sub_menu_back = False
4747
sub_menu = TerminalMenu(

0 commit comments

Comments
 (0)