Node
There are two main entities in the system, Actors and Nodes.
The Node is typically some kind of entity in your application but can also be used for grouping other entities or actors.
Nodes can be hieratically organized in a tree and are used for modelling your domain. For example, a company's departments, projects, or teams. Then access references are added to the actors to give them access to the nodes.
It is up to each system to decide how to use the nodes. Akkess supplies with very extensive support for configuring access levels on nodes. Even if not nodes are used to store all information it can be used for setting up a hierarchical access control.
For example - file and folders meta information are stored as nodes - but the actual file content is stored elsewhere. Then the system could take advantage of the hierarchical access control powered by Akkess to manage access to the files and folders.
Take a look at the Actor and Node APIs and the powerful and flexible permissions before you start to build your own service for managing your users.
Characteristics:
- Nodes are hierarchical
- Usually used to model access hierarchies or group sets of data
- Extendable with custom attributes
Examples of nodes:
- Country
- Department
- Group
- Document
- Building
Node attributes
nodeId
- globally unique system defined identifier for a node- audit information
- tenantId - the tenant the node belongs to
- changeId
- status
- parentNodeId
- ancestorNodeIds
- type
- name
- description
- customIds
- customStatuses
- customStrings
- customAttributes
Full example:
const storeNode = {
tenantId: '63c65dee83abd41be9f61108',
nodeId: '64131b855e00a4761b8fcfa2',
type: 'STORE',
createdAt: '2023-01-07T21:26:36.082Z',
createdBy: '63d29842f0abf2120390cc58',
lastModifiedAt: '2023-02-09T12:54:11.619Z',
lastModifiedBy: '63d29842f0abf2120390cc58',
changeId: '7231165213385424956',
description: 'The central store in Gothenburg',
status: {
value: 'DISABLED',
createdAt: '2023-02-09T12:54:11.619Z',
createdBy: '63d29842f0abf2120390cc58',
previousValues: [
{
value: 'ENABLED',
createdAt: '2023-01-07T21:26:36.082Z',
createdBy: '63d29842f0abf2120390cc58',
replacedAt: '2023-02-09T12:54:11.619Z',
replacedBy: '63d29842f0abf2120390cc58',
},
],
},
parentNodeId: '63d298bd78a47f40d600bd34',
ancestorNodeIds: ['63d298bd78a47f40d600bd34', '63d298bd78a47f40d600bd33', '63d298bd78a47f40d600bd32'],
name: 'City store',
customIds: [
{
type: 'STORE_ID',
value: '1234567890',
},
],
customStrings: [
{
type: 'STORE_TYPE',
value: 'CENTRAL_STORE',
}
],
customStatuses: [
{
type: 'STORE_STATUS',
value: 'INACTIVE',
statusFrom: '2023-02-09T14:52:00+02:00',
createdAt: '2023-02-09T12:54:11.619Z',
createdBy: '63d29842f0abf2120390cc58',
previousValues: [
{
value: 'ACTIVE',
statusFrom: '2023-02-09T14:52:00+02:00',
statusTo: '2023-02-09T14:52:00+02:00',
createdAt: '2023-01-07T21:26:36.082Z',
createdBy: '63d29842f0abf2120390cc58',
replacedAt: '2023-02-09T12:54:11.619Z',
replacedBy: '63d29842f0abf2120390cc58',
},
],
},
],
customAttributes: [
{
type: 'ADDRESS',
value: {
street: 'Storgatan 1',
city: 'Gothenburg',
zip: '12345',
},
},
],
};
Node status
The node status can be used to activate and de-activate nodes.
Characteristics:
- Manage by client via dedicated APIs
- Can be queried
- Supports history
- Audit
Values:
Value | Description |
---|---|
ENABLED | Active state. Normal state for a node and all supported operations are enabled |
DISABLED | In-active state. When a node is disabled you cannot add child nodes to it |
Attributes:
value
- the current status value. Set by a business event on the actorstartedAt
- timestamp when actor got the status. Set by systemstartedBy
- the actor Id pointing to the actor initiated the business flow setting the status. Pick from IAM tokenpreviousValues
- an array with previous status values the actor has had. Managed by the system
Example:
const status = {
value: 'DISABLED',
createdAt: '2023-05-01T08:09:12.44Z',
createdBy: '63d29842f0abf2120390cc58',
previousValues: [
{
value: 'ENABLED',
createdAt: '2023-04-18T07:57:16.554Z',
createdBy: '63d29842f0abf2120390cc58',
replacedAt: '2023-05-01T08:09:12.44Z',
replacedBy: '63d29842f0abf2120390cc58'
}
]
};
Node parent / ancestors
To know where a node is located in the tree of nodes reference to direct parent and references to all node's ancestors are supplied
Characteristics:
- Manage by client via dedicated APIs
- Can be queried
Attributes:
parentNodeId
- points to the node's parent Id. Root nodes will haveparentNodeId
equals to undefined. Optional.ancestorNodeIds
- an array containing the node's ancestors node Ids. The parent node Id is placed at index 0 and the root node's Id at end of the array. Empty or undefined for root nodes.
Example:
// This node relations
// actual node -> parent node -> some node -> root node
// 63e13d14a235d55909a456e4 -> 63e13d14a235d55909a456e3 -> 63e13d14a235d55909a456e2 -> 63e13d14a235d55909a456e1
const relations = {
nodeId: '63e13d14a235d55909a456e4',
parentNodeId: '63e13d14a235d55909a456e3',
ancestorNodeIds: [
'63e13d14a235d55909a456e3', // Parent node Id
'63e13d14a235d55909a456e2', // In between node Id
'63e13d14a235d55909a456e1' // Root node Id
]
};