trading_agent.requests.permission_grants
¶
The user's standing permissions: a desk may use a tool that normally needs permission, until the user revokes it.
A grant is made by "Always allow" on a permission request, and is kept in workspace/shared/permission_grants.json.
Typical usage example:
grants = PermissionGrants(layout) grants.grant('main', 'flatten_desk') grants.allows('main', 'flatten_desk')
PermissionGrant
dataclass
¶
One standing permission.
Attributes:
| Name | Type | Description |
|---|---|---|
desk |
str
|
The desk allowed. |
tool_name |
str
|
The tool it may use without asking. |
granted_at |
str
|
When the user granted it, as ISO 8601 text in UTC. |
PermissionGrants
¶
Reads, adds and revokes standing permissions.
Creates the store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layout
|
WorkspaceLayout
|
The workspace whose shared folder holds the grants file. |
required |
Source code in src/trading_agent/requests/permission_grants.py
all
¶
Every standing permission, oldest first.
Returns:
| Type | Description |
|---|---|
list[PermissionGrant]
|
The grants. |
Source code in src/trading_agent/requests/permission_grants.py
allows
¶
Says whether a desk may use a tool without asking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk
|
str
|
The desk. |
required |
tool_name
|
str
|
The tool. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when the user granted it. |
Source code in src/trading_agent/requests/permission_grants.py
grant
¶
Lets a desk use a tool without asking from now on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk
|
str
|
The desk. |
required |
tool_name
|
str
|
The tool. |
required |
Returns:
| Type | Description |
|---|---|
PermissionGrant
|
The grant, or the existing one. |
Source code in src/trading_agent/requests/permission_grants.py
revoke
¶
Makes a desk ask again before using a tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk
|
str
|
The desk. |
required |
tool_name
|
str
|
The tool. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when a grant was removed, False when there was none. |