Skip to content

Add tutorial for adding users to ILS db#24

Open
sakshamarora1 wants to merge 1 commit intoinveniosoftware:masterfrom
sakshamarora1:docs/adding_users
Open

Add tutorial for adding users to ILS db#24
sakshamarora1 wants to merge 1 commit intoinveniosoftware:masterfrom
sakshamarora1:docs/adding_users

Conversation

@sakshamarora1
Copy link
Copy Markdown
Contributor

(Not completely tested yet) [In progress]

@sakshamarora1 sakshamarora1 self-assigned this Jul 12, 2024
Comment thread docs/customize/users.md
@@ -0,0 +1,219 @@
# Adding Users to Invenio ILS instance
Copy link
Copy Markdown
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?

Comment thread docs/customize/users.md
@@ -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
Copy Markdown
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:

Comment thread docs/customize/users.md

### Prerequisites

- A running instance of Invenio App ILS.
Copy link
Copy Markdown
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.

Comment thread docs/customize/users.md

- A running instance of Invenio App ILS.
- Administrative access to the Invenio App ILS instance.
- Python installed on your system.
Copy link
Copy Markdown
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 thread docs/customize/users.md
Comment on lines +5 to +6
- An existing database
- LDAP synchronization
Copy link
Copy Markdown
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

Comment thread docs/customize/users.md

### 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
Copy Markdown
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**:

Comment thread docs/customize/users.md
from invenio_app.factory import create_api

# Load configuration
custom_db_uri = os.getenv('CUSTOM_DB_URI', 'postgresql://user:password@localhost/customdb')
Copy link
Copy Markdown
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')

Comment thread docs/customize/users.md
metadata = MetaData()
users_table = Table('users', metadata, autoload_with=custom_engine)

def port_users():
Copy link
Copy Markdown
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():

Comment thread docs/customize/users.md
# Initialize Invenio app context
app = create_api()
with app.app_context():
port_users()
Copy link
Copy Markdown
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()

Comment thread docs/customize/users.md

### 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
Copy Markdown
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