Add tutorial for adding users to ILS db#24
Add tutorial for adding users to ILS db#24sakshamarora1 wants to merge 1 commit intoinveniosoftware:masterfrom
Conversation
| @@ -0,0 +1,219 @@ | |||
| # Adding Users to Invenio ILS instance | |||
There was a problem hiding this comment.
We branded the products InvenioILS and InvenioRDM without spaces:
| # Adding Users to Invenio ILS instance | |
| # Adding users to InvenioILS instance |
Can you change it everywhere?
| @@ -0,0 +1,219 @@ | |||
| # Adding Users to Invenio ILS instance | |||
|
|
|||
| This guide provides step-by-step instructions for adding users to a custom Invenio App ILS instance using: | |||
There was a problem hiding this comment.
I am not 100% sure that readers know what is Invenio App ILS, given that we refer to it as InvenioILS:
| This guide provides step-by-step instructions for adding users to a custom Invenio App ILS instance using: | |
| This guide provides step-by-step instructions for adding users to your own InvenioILS instance using two possible different methods: |
|
|
||
| ### Prerequisites | ||
|
|
||
| - A running instance of Invenio App ILS. |
There was a problem hiding this comment.
Global change:
| - A running instance of Invenio App ILS. | |
| - A running instance of InvenioILS. |
|
|
||
| - A running instance of Invenio App ILS. | ||
| - Administrative access to the Invenio App ILS instance. | ||
| - Python installed on your system. |
There was a problem hiding this comment.
If I have the first, the second prerequisite must be there... I would remove the Python part
| - An existing database | ||
| - LDAP synchronization |
There was a problem hiding this comment.
You are presenting the tutorial in the opposite order (first LDAP, then DB):
| - An existing database | |
| - LDAP synchronization | |
| 1. LDAP synchronization | |
| 2. An existing external database |
|
|
||
| ### Step 3: Create a Script to Port Users | ||
|
|
||
| Create a Python script to read users from the custom database and add them to the Invenio App ILS database. Save the following script as **port_users.py**: |
There was a problem hiding this comment.
| Create a Python script to read users from the custom database and add them to the Invenio App ILS database. Save the following script as **port_users.py**: | |
| Create a Python script to read users from the external database and add them to the InvenioILS database. Save the following script as **import_users.py**: |
| from invenio_app.factory import create_api | ||
|
|
||
| # Load configuration | ||
| custom_db_uri = os.getenv('CUSTOM_DB_URI', 'postgresql://user:password@localhost/customdb') |
There was a problem hiding this comment.
Apply everywhere
| custom_db_uri = os.getenv('CUSTOM_DB_URI', 'postgresql://user:password@localhost/customdb') | |
| external_db_uri = os.getenv('CUSTOM_DB_URI', 'postgresql://user:password@localhost/customdb') |
| metadata = MetaData() | ||
| users_table = Table('users', metadata, autoload_with=custom_engine) | ||
|
|
||
| def port_users(): |
There was a problem hiding this comment.
| def port_users(): | |
| def import_users(): |
| # Initialize Invenio app context | ||
| app = create_api() | ||
| with app.app_context(): | ||
| port_users() |
There was a problem hiding this comment.
| port_users() | |
| import_users() |
|
|
||
| ### Additional Tips | ||
|
|
||
| You may schedule the script to run periodically (e.g., using a cron job) if you need to keep the Invenio user database in sync with your custom database/LDAP directory. |
There was a problem hiding this comment.
| You may schedule the script to run periodically (e.g., using a cron job) if you need to keep the Invenio user database in sync with your custom database/LDAP directory. | |
| You may schedule the script to run periodically (e.g., using a cron job) if you need to keep the InvenioILS user database in sync with your external database or LDAP directory. |
(Not completely tested yet) [In progress]