Library that handles users and groups
From __init__.py
:
Function | add |
Add a new LDAP database |
Function | add |
Add a new local database |
Function | add |
Add a new local group |
Function | add |
Add a new local user |
Function | add |
Add a new remote user |
Function | check |
Check a shadow password |
Function | delete |
Delete an existing LDAP database |
Function | delete |
Delete an existing local database |
Function | delete |
Delete an existing local group |
Function | delete |
Delete an existing local user |
Function | delete |
Delete an existing remote user |
Function | edit |
Edit an existing LDAP database |
Function | edit |
Edit an existing local database |
Function | edit |
Edit an existing local group |
Function | edit |
Edit an existing local user |
Function | edit |
Edit an existing remote user |
Function | get |
Retrieve a database by name |
Function | get |
Retrieve database type |
Function | get |
Retrieve all IP addresses associated to given group |
Function | get |
Retrieve a group by name |
Function | get |
Retrieve all MAC addresses associated to given group |
Function | get |
Retrieve all IP addresses associated to given user |
Function | get |
Retrieve a user by name |
Function | get |
Retrieve all MAC addresses associated to given user |
Function | is |
Check if a user is admin |
Function | ldif2users |
Parse an LDIF file and return a list of users |
Function | list |
Retrieve all databases |
Function | list |
Test LDAP connection |
Function | list |
Retrieve all users |
Function | remove |
Remove a user from rpcd configuration database |
Function | set |
Set a user as admin by creating a login record in rpcd configuration database |
Function | shadow |
Generate a shadow password |
Add a new LDAP database
- Arguments:
- uci -- EUci pointer
- name -- Database identifier
- uri -- LDAP URI
- schema -- LDAP schema
- base_dn -- LDAP base DN
- user_dn -- LDAP user DN
- user_attr -- LDAP user attribute
- user_display_attr -- LDAP user full name attribute
- start_tls -- Use TLS (default: False)
- tls_reqcert -- TLS certificate validation (default: never)
- description -- Database description (default: "")
- bind_dn -- LDAP bind DN
- bind_password -- LDAP bind password
- user_bind_dn -- LDAP custom user bind DN
- Returns:
- The database identifier
Add a new local database
- Arguments:
- uci -- EUci pointer
- name -- Database identifier
- description -- Database description (default: "")
- Returns:
- The database identifier
Add a new local group
- Arguments:
- uci -- EUci pointer
- name -- Group name
- users -- List of users (default: [])
- description -- Group description (default: "")
- database -- Local database identifier (default: main)
- Returns:
- The group identifier
Add a new local user
- Arguments:
- uci -- EUci pointer
- name -- User name
- password -- User password
- description -- User description (default: "")
- database -- Local database identifier (default: main)
- extra_fields -- Extra fields to add to the user (default: {})
- Returns:
- The user identifier
Add a new remote user
- Arguments:
- uci -- EUci pointer
- name -- User name
- database -- Database identifier
- extra_fields -- Extra fields to add to the user (default: {})
- Returns:
- The user identifier
Check a shadow password
- Arguments:
- password -- Clear text password
- shadow -- Shadow password in crypt(3) format
- Returns:
- True if password matches, False otherwise
Delete an existing LDAP database
- Arguments:
- uci -- EUci pointer
- name -- Database identifier
- Returns:
- True if successful
Delete an existing local database
- Arguments:
- uci -- EUci pointer
- name -- Database identifier
- Returns:
- True if successful
Delete an existing local group
- Arguments:
- uci -- EUci pointer
- name -- Group name
- database -- Local database identifier (default: main)
- Returns:
- True if successful
Delete an existing local user
- Arguments:
- uci -- EUci pointer
- name -- User name
- database -- Local database identifier (default: main)
- Returns:
- True if successful
Delete an existing remote user
- Arguments:
- uci -- EUci pointer
- name -- User name
- database -- Database identifier
- Returns:
- True if successful
Edit an existing LDAP database
- Arguments:
- uci -- EUci pointer
- name -- Database identifier
- uri -- LDAP URI
- schema -- LDAP schema
- base_dn -- LDAP base DN
- user_dn -- LDAP user DN
- user_attr -- LDAP user attribute
- user_display_attr -- LDAP user full name attribute
- start_tls -- Use TLS (default: False)
- tls_reqcert -- TLS certificate validation (default: never)
- description -- Database description (default: "")
- bind_dn -- LDAP bind DN
- bind_password -- LDAP bind password
- user_bind_dn -- LDAP custom user bind DN
- Returns:
- The database identifier
Edit an existing local database
- Arguments:
- uci -- EUci pointer
- name -- Database identifier
- description -- Database description (default: "")
- Returns:
- The database identifier
Edit an existing local group
- Arguments:
- uci -- EUci pointer
- name -- Group name
- users -- List of users (default: [])
- description -- Group description (default: "")
- database -- Local database identifier (default: main)
- Returns:
- The group identifier
Edit an existing local user
- Arguments:
- uci -- EUci pointer
- name -- User name
- password -- User password
- description -- User description (default: None)
- database -- Local database identifier (default: main)
- extra_fields -- Extra fields to add to the user (default: {})
- Returns:
- The user identifier
Edit an existing remote user
- Arguments:
- uci -- EUci pointer
- name -- User name
- database -- Database identifier
- extra_fields -- Extra fields to add to the user (default: {})
- Returns:
- The user identifier
Retrieve a database by name
- Arguments:
- uci -- EUci pointer
- name -- Database identifier
- Returns:
- A database object or None if not found
Retrieve database type
- Arguments:
- uci -- EUci pointer
- database -- Database identifier
- Returns:
- Database type (local or ldap)
Retrieve all IP addresses associated to given group
- Arguments:
- uci -- EUci pointer
- user -- Group object id (UCI section)
- Returns:
- A tuple of lists: - first element is a list of IPv4 addresses - second element is a list of IPv6 addresses
Retrieve a group by name
- Arguments:
- uci -- EUci pointer
- name -- Group name
- database -- Local database identifier (default: main)
- Returns:
- A group object or None if not found
Retrieve all MAC addresses associated to given group
- Arguments:
- uci -- EUci pointer
- group -- Group object id (UCI section)
- Returns:
- A list of MAC addresses
Retrieve all IP addresses associated to given user
- Arguments:
- uci -- EUci pointer
- user -- User object id (UCI section)
- Returns a tuple of lists:
- first element is a list of IPv4 addresses
- second element is a list of IPv6 addresses
Retrieve a user by name
- Arguments:
- uci -- EUci pointer
- name -- User name
- database -- Local database identifier (default: main)
- Returns:
- A user object or None if not found
Retrieve all MAC addresses associated to given user
- Arguments:
- uci -- EUci pointer
- user -- User object id (UCI section)
- Returns:
- A list of MAC addresses
Check if a user is admin
- Arguments:
- uci -- EUci pointer
- username -- User name
- Returns:
- True if user is admin, False otherwise
Parse an LDIF file and return a list of users
- Arguments:
- ldif_data -- LDIF data
- user_attr -- User attribute (default: uid)
- display_attr -- Display name attr (default: cn)
- Returns:
- A list of users
Retrieve all databases
- Arguments:
- uci -- EUci pointer
- Returns:
- A list of database objects, each one containing: - name: database identifier - type: database type (local or ldap) - description: database description
Test LDAP connection
- Arguments:
- uri -- LDAP URI
- user_dn -- LDAP user DN
- user_attr -- LDAP user attribute
- user_display_attr -- LDAP user full name attribute
- start_tls -- Use TLS (default: False)
- tls_reqcert -- TLS certificate validation (default: never)
- bind_dn -- LDAP bind DN
- bind_password -- LDAP bind password
- schema -- LDAP schema, 'ad' or 'ldap'
- Returns:
- A list of users, each one containing: - name: user name - description: user description
Retrieve all users
- Arguments:
- database -- Database identifier (default: main)
- Returns:
- A list of user objects
Remove a user from rpcd configuration database
- Arguments:
- uci -- EUci pointer
- username -- User name
- Returns:
- True if successful