Subordination rules (subordination)

Description

The rule set defines subordination relations between users.
Relations are set between users, groups, and roles. There is also a special type - ALL ('all').
Each relation is set between one superior element of one type and several subordinate elements of one type.
Groups and users are specified by identifiers; roles are specified by names.

By default, the "ALL TO ALL" rule is added. If such a rule exists, all other rules have no effect.

Based on the subordination rule set, a subordination cache is calculated containing subordination lists reduced to users and shortened.
If the "ALL TO ALL" subordination rule exists, only it is contained in the cache. The key is the string "all". Otherwise the cache contains one element for each user with a non-empty subordinate list (including the user themselves).
When all other users (including the user themselves) are subordinate to a user, the value 'all' is placed in the cache for that user (in the list).
In other cases, the user is given the identifiers of all other users subordinate to them based on rule expansion through groups and roles.

Limitations

  • The cache is updated after 5 seconds, but no later than 30 seconds after a change.

Fields

Entity structure
{
  "id": uuid,
  "top_type": str,
  "top_key": str,
  "sub_type": str,
  "sub_keys": array<str>,
  "opts": {
    "title": str,
    "comment": str
  },
  "ext": {
    "ct": date,
    "lwt": date
  }
}
Table 1. Fields
Specification Description

Field: id
Mode: inout
Type: uuid
Default: generated

Identifier. Can be specified at creation, otherwise generated by the system.

Field: top_type
Mode: in
Type: str
Default: required

Superior element type.
Possible variants:

  • all - all domain users ('top_key' has no meaning).

  • user - domain user ('top_key' contains the identifier of an existing user).

  • group - domain group ('top_key' contains the identifier of an existing group).

  • role - user role available in the domain ('top_key' contains the role name).

Field: top_key
Mode: in
Type: str
Default: empty

Identifier of the superior element of the corresponding type ('top_type'). The element with the specified type and identifier must exist in the domain.
Not used if 'top_type' is set to 'all'.

Field: sub_type
Mode: in
Type: str
Default: required

Subordinate element type.
Possible variants:

  • all - all domain users ('sub_keys' has no meaning).

  • user - domain user ('sub_keys' contains identifiers of existing users).

  • group - domain group ('sub_keys' contains identifiers of existing groups).

  • role - user role available in the domain ('sub_keys' contains role names).

Field: sub_keys
Mode: in
Type: array
Default: empty

List of subordinate element identifiers of the corresponding type ('sub_type'). Elements with the specified type and identifiers must exist in the domain.
Not used if 'sub_type' is set to 'all'.

Field: opts
Mode: in
Type: object
Compound field

Field: opts.title
Mode: in
Type: str
Default: empty

Arbitrary title

Field: opts.comment
Mode: in
Type: empty
Default: "

Arbitrary comment

Field: ext
Mode: inout
Type: object
Compound field

Allows extending the compound with arbitrary keys and values

Field: ext.ct
Mode: out
Type: date
Default: generated

Object creation time

Field: ext.lwt
Mode: out
Type: date
Default: generated

Time of last modification of the object