check_insert_permission()
Checks whether an object of a given type may be inserted at a location.
Same wire call as check_permission() with object
ID 0, but the object type is mandatory here: it is the type of the object to be
inserted, and type 0 is a real folder type rather than a neutral value, so it must
never be supplied by default.
1. Signature
-
Sync
-
Async
ecm.dms.check_insert_permission(
object_type_id: int | str,
*,
read: bool = False,
write: bool = False,
execute: bool = False,
delete: bool = False,
update: bool = False,
folder_id: int | str | ECMFolderModel | None = None,
register_id: int | str | ECMRegisterModel | None = None,
register_type: int | str | None = None,
) -> bool
await ecm.dms.check_insert_permission(
object_type_id: int | str,
*,
read: bool = False,
write: bool = False,
execute: bool = False,
delete: bool = False,
update: bool = False,
folder_id: int | str | ECMFolderModel | None = None,
register_id: int | str | ECMRegisterModel | None = None,
register_type: int | str | None = None,
) -> bool
2. Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
|
|
— |
Numeric type ID of the object to be inserted, as an |
|
|
|
Check for read index data permission ( |
|
|
|
Check for write index data permission ( |
|
|
|
Check for open/execute permission ( |
|
|
|
Check for delete permission ( |
|
|
|
Check for update object permission ( |
|
|
|
ID of the target folder, or an |
|
|
|
ID of the target register, or an |
|
|
|
Type of the target register. |
At least one of read, write, execute, delete, or update must be True.
|
3. Return value
True if the insert is permitted, False otherwise. The verdict is read from the
Access output parameter exactly as described in
How the server reports the verdict.
4. Exceptions
| Exception | Condition |
|---|---|
|
None of the permission flags is |
|
The server reports an error. |
5. Examples
5.1. May an invoice document go into this folder?
-
Sync
-
Async
folder = ecm.dms.select(InvoiceFolder).execute()[0]
if ecm.dms.check_insert_permission(327685, write=True, folder_id=folder):
print("Insert allowed in this folder")
folder = (await ecm.dms.select(InvoiceFolder).execute())[0]
if await ecm.dms.check_insert_permission(327685, write=True, folder_id=folder):
print("Insert allowed in this folder")
5.2. Check a register location before inserting
-
Sync
-
Async
if ecm.dms.check_insert_permission(327685, write=True, register_id=12345, register_type=196609):
ecm.dms.insert(InvoiceDocument(Number="2026-0001"), folder_id=98765, register_id=12345)
if await ecm.dms.check_insert_permission(327685, write=True, register_id=12345, register_type=196609):
await ecm.dms.insert(InvoiceDocument(Number="2026-0001"), folder_id=98765, register_id=12345)
6. See also
-
check_permission() — Permissions on an existing object
-
insert() — Create a new object