ores.inbox.approval_kind

Table of Contents

Reference data table of the kinds of approval request. Examples: 'iam.role_grant', 'trading.operational_authorisation'.

A kind is the small declaration the generic record reads: the permission a decider needs, whether the kind uses the held state, whether an approval needs a comment, how long an unanswered request waits, and how many approvals, each by a different person, close a request as approved. The component that owns the kind owns its detail table and the operation that applies an approval.

Kinds are managed by the system tenant.

1. Flags

2. Columns

2.1. code

Unique kind code, prefixed by the component that owns the kind.

Examples: 'iam.role_grant'.

2.2. name

Human-readable name for the kind.

std::string(faker::word::noun()) + " Request"

2.3. description

What the kind is for.

std::string(faker::lorem::sentence())

2.4. decide_permission_code

The permission a person needs to decide a request of this kind.

Examples: 'iam::roles:assign'.

std::string("iam::roles:assign")

2.5. raise_permission_code

The permission a person needs to raise a request of this kind, which is the maker's half of the maker and checker pair. It sits on the kind and never on a request: a maker who could name a weaker checker would choose their own control.

Examples: 'marketdata::curve_bootstrap:publish'.

Null when the kind names none, and then the raise is the component's own to gate, which is how every kind seeded before this column behaves. The permission is held by an account in the tenant and never by a party.

std::nullopt

2.6. allows_hold

Whether held is a state this kind uses.

2.7. comment_on_approve

Whether an approval needs a comment. A refusal always needs one.

2.8. expires_after_days

The number of days after which an unanswered request closes as expired, or null when a request of this kind does not expire.

2.9. apply_workflow_type

The type of the workflow that applies a request of this kind once every part has approved it, or null when the owning component applies the request itself.

The workflow is started with the request's id as its request, which is {"request_id": "<id>"}. Each definition reads that shape, so the inbox starts any kind's workflow without knowing what the kind changes.

2.10. apply_window_hours

The number of hours after approval during which a stopped apply is retried, or null when the kind names no apply workflow. When the window ends, the request moves to apply_failed with the reason "could not apply" and the person who asked is told, so a request never retries forever.

2.11. approvals_required

How many approvals, each by a different person, close a request as approved. It is the count of people, and never a way to say that nobody decides: a kind that needs nobody says so through auto_approval_code.

faker::number::integer(1, 2)

2.12. auto_approval_code

Which raises of this kind close without a person, and so which acts the installation does on its own behalf.

A maker and checker pair exists to put a second person in front of a consequential act a person proposed. Where no person is the maker, there is no judgement to check, and the request closes approved in the same act, with the system as its decider and a decision that says a policy closed it.

The values, and what each covers:

  • none – a person decides, as the kind's count says. The default.
  • system_tenant – a raise in the system tenant closes at once. The system tenant is the installation, so its own curves and datasets are the installation's own acts, done before any person would be on shift. A raise in any other tenant is somebody's book and waits.
  • every_request – every raise of this kind closes at once, whatever the tenant. For kinds that record rather than control, and for a demonstration that must not wait on a click.

A raise that names parts is decided by its parts however this column reads: the parts are people answering, and a policy that skipped them would leave the parts open forever.

The policy is the kind's, so it is a versioned data change with who turned it on and why beside it, and the request and its decision state it in words. A deployment states whether it enforces approvals at all through system.approvals.mode, which closes every kind's requests at once when it is auto_approved.

2.13. display_order

Order for UI display purposes.

faker::number::integer(1, 100)

3. Foreign keys

3.1. decide_permission_code

The permission a decider needs. Permissions are held by the system tenant, so the check reads it.

3.2. raise_permission_code

The permission a maker needs. Null names none, so the kind's raise stays the owning component's to gate.

4. SQL

4.1. Flags

The kinds are the system tenant's rows, and a decider of any tenant reads the rule of the kind it answers: how many approvals it needs, the permission it takes to decide, whether it holds, and when it expires. The policy lets a reader see its own tenant's kinds beside the system tenant's, and a write stays the caller's own.

5. Validation function

6. Insert trigger

6.1. Validations

column validation_function
change_reason_code ores_dq_validate_change_reason_fn

7. C++

7.1. Flags

7.2. Repository

A tenant session reads its own kinds and the system tenant's, because the kind a request is of is the system's and its rule is what a decider reads.

7.3. Domain includes

#include <string>

7.4. Entity includes

#include <string>

7.5. Conventions

7.6. Table display

column header
code Code
name Name
decide_permission_code Decide Permission
raise_permission_code Raise Permission
approvals_required Approvals Required
auto_approval_code Auto Approval
modified_by Modified By
version Version

7.7. Presentation

7.7.1. Detail fields

field label widget type is_key is_required placeholder
code Code codeEdit line_edit true true Enter kind code
name Name nameEdit line_edit   true Enter display name
description Description descriptionEdit text_edit     Enter a description
decide_permission_code Decide Permission permissionEdit line_edit   true Enter a permission code
raise_permission_code Raise Permission permissionEdit line_edit     Enter a permission code
auto_approval_code Auto Approval autoApprovalEdit line_edit   true none, system_tenant or every_request

7.7.2. Columns

enum_name field header type width
Code code Code string 160
Name name Name string 200
DecidePermissionCode decide_permission_code Decide Permission string 200
RaisePermissionCode raise_permission_code Raise Permission string 200
ApprovalsRequired approvals_required Approvals Required int 100
Version version Version int 80
ModifiedBy modified_by Modified By string 120
RecordedAt recorded_at Recorded At timestamp 150

7.8. Custom repository methods

8. See also

Emacs 29.3 (Org mode 9.6.15)