You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components_move/README.md
+16-13Lines changed: 16 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,16 @@ within the IOTA Trust Framework. These components are designed to be modular and
5
5
Trust Framework products and community-developed smart contracts.
6
6
7
7
Modules Overview:
8
-
*`role_map`: Implements the `RoleMap` struct for role-based access control, allowing mapping of roles to
8
+
9
+
*`role_map`: Implements the `RoleMap` struct for role-based access control, allowing mapping of roles to
9
10
application specific permissions.
10
-
*`capability`: Defines the `Capability` struct for granting access rights within smart contracts in conjunction with
11
+
*`capability`: Defines the `Capability` struct for granting access rights within smart contracts in conjunction with
11
12
the `RoleMap<P>` struct.
12
13
*`timelock`: Provides the `Timelock` struct for expressing and processing time-based restrictions
13
14
14
15
## Role-Based Access Control - The `role_map` and the `capability` Module
15
16
16
-
The `role_map` module provides the `RoleMap<P>` struct, which is
17
+
The `role_map` module provides the `RoleMap<P>` struct, which is
17
18
a role-based access control helper that maps unique role identifiers to their associated permissions.
18
19
19
20
The `capability` module provides the `capability::Capability` struct,
@@ -22,24 +23,26 @@ a capability token that grants access rights defined by one specific role in the
22
23
The `role_map` module directly depends on the `capability` module. Both modules are tight strongly together.
23
24
24
25
The `RoleMap<P>` struct provides the following functionalities:
25
-
- Uses custom permission types defined by the integrating module using the generic argument `P`
26
-
- Defines an initial role with a custom set of permissions (i.e. for an Admin role) and creates an initial
26
+
27
+
* Uses custom permission-types, defined by the integrating module, using the generic argument `P`
28
+
* Defines an initial role with a custom set of permissions (i.e. for an Admin role) and creates an initial
27
29
`Capability` for this role to allow later access control administration by the creator of the integrating module
28
-
- Allows to create, delete, and update roles and their permissions
29
-
- Allows to issue, revoke, and destroy `Capability`s associated with a specific role
30
-
- Validates `Capability`s against the defined roles to facilitate proper access control by the integrating module
30
+
* Allows to create, delete, and update roles and their permissions
31
+
* Allows to issue, revoke, and destroy `Capability`s associated with a specific role
32
+
* Validates `Capability`s against the defined roles to facilitate proper access control by the integrating module
31
33
(function `RoleMap.is_capability_valid()`)
32
-
- All functions are access restricted by custom permissions defined during `RoleMap` instantiation
34
+
* All functions are access restricted by custom permissions defined during `RoleMap` instantiation
33
35
34
36
### Usage Examples
35
37
36
38
The [`Counter` example](./examples/counter/README.md) is a very simple example, demonstrating how to use
37
-
`RoleMap` and `Capability` for role based access control. The accompanying
39
+
`RoleMap` and `Capability` for role based access control. The accompanying
38
40
[test file](./examples/counter/tests/counter_tests.move) demonstrates the Move user experience.
39
41
40
-
The Trust Framework product *Audit Trails* uses the `RoleMap` to manage access to the audit trail records and their operations, which
42
+
The Trust Framework product *Audit Trails* uses the `RoleMap` to manage access to the audit trail records and their operations, which
41
43
can be seen as a more complex example:
42
-
* The `RoleMap` is integrated in the `audit_trail::main` module to manage access to the audit trail records and
43
-
their operations. See [here](https://github.com/iotaledger/notarization/blob/main/audit-trail-move/sources/audit_trail.move#L208) for an example.
44
+
45
+
* The `RoleMap` is integrated in the `audit_trail::main` module to manage access to the audit trail records and
46
+
their operations. See [audit_trail.move](https://github.com/iotaledger/notarization/blob/main/audit-trail-move/sources/audit_trail.move#L208) for an example.
44
47
* The `RoleMap` is created by the `AuditTrail` in it's [create function](https://github.com/iotaledger/notarization/blob/main/audit-trail-move/sources/audit_trail.move#L114).
45
48
* An example for the Move user experience can be found in the [capability_tests.move](https://github.com/iotaledger/notarization/blob/main/audit-trail-move/tests/capability_tests.move) file.
Copy file name to clipboardExpand all lines: components_move/examples/counter/README.md
+5-12Lines changed: 5 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,6 @@
1
1
# RoleMap Integration Example
2
2
3
-
The Counter example shows how the `RoleMap` can be integrated into 3rd party shared objects
4
-
(or Trust Framework products). In this example the `role_map` and `capability` modules are
5
-
integrated into a simple shared `Counter` object, as being described
3
+
This Counter example shows how the `role_map::RoleMap` can be integrated into 3rd party shared objects (or Trust Framework products). The example integrates the `role_map` and `capability` modules into a simple shared `Counter` object, as being described
@@ -15,20 +13,15 @@ can be found in the [permission.move](./sources/permission.move) file.
15
13
16
14
## RoleMap Integration
17
15
18
-
The integration of the `RoleMap<CounterPermission>` into the target object, which is the `Counter` object in
19
-
this example, requires the following steps.
16
+
The `RoleMap` is used to manage access control to target objects. In this example a target object is a `Counter` object. The integration of the `RoleMap<CounterPermission>` into the target object type (the `Counter` struct), requires the following steps (implementation of the shared `Counter` example can be found in [counter.move](./sources/counter.move)):
20
17
21
-
The implementation of the shared `Counter` example can be found in the
22
-
[counter.move](./sources/counter.move) file.
23
-
24
-
The target object needs to:
25
18
* instantiate the `RoleMap` instance in its `create()` function
26
19
* provide the necessary getter and mutator functions for users to access the `RoleMap` instance
27
-
(function `access()` and `access_mut()` in the [counter.move](./sources/counter.move) file)
20
+
(function `access()` and `access_mut()` in [counter.move](./sources/counter.move))
28
21
* use the `RoleMap.is_capability_valid()` function to check whether a provided capability has the required permission
29
-
(used in function `increment()` in the [counter.move](./sources/counter.move) file)
22
+
(used in function `increment()` in [counter.move](./sources/counter.move))
30
23
31
-
## User experience and testing the Integration
24
+
## `RoleMap`User experience and testing the Integration
32
25
33
26
The accompanying [counter_tests.move](./tests/counter_tests.move) file demonstrates the
34
27
user experience of Move users interacting with the shared `Counter` object via the integrated
0 commit comments