-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add tutorial for adding users to ILS db #24
base: master
Are you sure you want to change the base?
Add tutorial for adding users to ILS db #24
Conversation
@@ -0,0 +1,219 @@ | |||
# Adding Users to Invenio ILS instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]