Skip to content

Conversation

sakshamarora1
Copy link
Contributor

(Not completely tested yet) [In progress]

@sakshamarora1 sakshamarora1 self-assigned this Jul 12, 2024
@@ -0,0 +1,219 @@
# Adding Users to Invenio ILS instance
Copy link
Contributor

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:

Suggested change
# 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:
Copy link
Contributor

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:

Suggested change
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Global change:

Suggested 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.
Copy link
Contributor

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

Comment on lines +5 to +6
- An existing database
- LDAP synchronization
Copy link
Contributor

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):

Suggested change
- 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**:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply everywhere

Suggested change
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():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def port_users():
def import_users():

# Initialize Invenio app context
app = create_api()
with app.app_context():
port_users()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

@kpsherva kpsherva requested a review from JakobMiesner May 20, 2025 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants