Security¶
SecurityNamespace for security group management and service account utilities, accessed as client.security.
security
¶
Security group utilities for Vodoo.
AccessDefinition
dataclass
¶
AccessDefinition(model: str, perm_read: bool, perm_write: bool, perm_create: bool, perm_unlink: bool)
Access control entry for a model.
RuleDefinition
dataclass
¶
RuleDefinition(model: str, domain: str, perm_read: bool, perm_write: bool, perm_create: bool, perm_unlink: bool)
Record rule definition for a model.
GroupDefinition
dataclass
¶
GroupDefinition(name: str, comment: str, access: tuple[AccessDefinition, ...], rules: tuple[RuleDefinition, ...] = ())
Security group definition.
SecurityNamespace
¶
SecurityNamespace(client: OdooClient)
Security group operations namespace.
Source code in src/vodoo/security.py
create_groups
¶
Create (or reuse) all Vodoo security groups.
| RETURNS | DESCRIPTION |
|---|---|
tuple[dict[str, int], list[str]]
|
Tuple of group name -> group ID and a list of warnings. |
Source code in src/vodoo/security.py
get_group_ids
¶
Fetch group IDs for the provided names.
| PARAMETER | DESCRIPTION |
|---|---|
group_names
|
Group names to resolve
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[dict[str, int], list[str]]
|
Tuple of group name -> group ID and a list of warnings. |
Source code in src/vodoo/security.py
assign
¶
Assign a user to the provided groups.
| PARAMETER | DESCRIPTION |
|---|---|
user_id
|
User ID to update
TYPE:
|
group_ids
|
Group IDs to add
TYPE:
|
remove_default_groups
|
If True, remove base.group_user and base.group_portal first
TYPE:
|
Source code in src/vodoo/security.py
resolve_user
¶
Resolve a user ID from either an ID or login name.
| PARAMETER | DESCRIPTION |
|---|---|
user_id
|
Explicit user ID
TYPE:
|
login
|
User login/email
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
User ID |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If user not found |
Source code in src/vodoo/security.py
create_user
¶
create_user(name: str, login: str, password: str | None = None, email: str | None = None) -> tuple[int, str]
Create a new user.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
User's display name
TYPE:
|
login
|
User's login (usually email)
TYPE:
|
password
|
User's password (generated if not provided)
TYPE:
|
email
|
User's email (defaults to login if not provided)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[int, str]
|
Tuple of (user_id, password) |
Source code in src/vodoo/security.py
set_password
¶
Set a user's password.
| PARAMETER | DESCRIPTION |
|---|---|
user_id
|
User ID
TYPE:
|
password
|
New password (generated if not provided)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The password that was set |
Source code in src/vodoo/security.py
get_user
¶
Get user information.
| PARAMETER | DESCRIPTION |
|---|---|
user_id
|
User ID
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
User information dictionary |