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: docs/_Docs_Extensions.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ section: Docs
4
4
order: 6
5
5
---
6
6
7
-
`glider` provides the option of "extensions" to the basic functionality of a colony through the use of _extensions_.
7
+
`glider` provides the option of expanding the basic functionality of a colony through the use of _extensions_.
8
8
9
-
Extensions are other smart contracts that have been given permissions to interact with a colony in a specified domain. Extensions can be used for many purposes, such as bundling transactions, automating certain actions, or something else entirely. Their implementations are intentionally disconected from the colonyNetwork codebase (stored in the [/contracts/extensions](https://github.com/JoinColony/colonyNetwork/tree/develop/contracts/extensions) folder in the network) to allow for greater design flexibility unbounded by the network protocol.
9
+
Extensions are other smart contracts that have been given permissions to interact with a colony in a specified domain. Extensions can be used for many purposes, such as bundling transactions, automating certain actions, or something else entirely. Their implementations are intentionally disconnected from the colonyNetwork codebase (stored in the [/contracts/extensions](https://github.com/JoinColony/colonyNetwork/tree/develop/contracts/extensions) folder in the network) to allow for greater design flexibility unbounded by the network protocol.
10
10
11
11
Currently there are two extensions 'officially' supported, but more may be added in the future. These extensions are written with dapp support in mind, and emit events to inform a user interface whether a colony has an extension enabled or not. Adding and removing an extension from a colony is restricted to those with `Root` permissions on the colony.
12
12
@@ -47,4 +47,4 @@ In earlier versions of the colonyNetwork, only two roles existed for permissione
47
47
48
48
The `OldRoles` extension bundles the roles in the `glider` release together into super-roles that have the same abilities as the original "Founder" (root) and "Admin" (funding, administration, architecture) roles.
Copy file name to clipboardExpand all lines: docs/_Docs_Permissions.md
+24-19Lines changed: 24 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ order: 4
6
6
7
7
In the full implementation of the Colony protocol, decision making will be determined by the reputation score of an account. Actions that are currently permissioned, such as moving shared funds and creating a task, will be allowed proportionate to an account's reputation score. This functionality is planned for later releases.
8
8
9
-
In the current `glider` release, network state changes are authorised by dedicated "authority" contracts e.g. `ColonyAuthority.sol`. These are based on the `DSRoles` implementation from [dappsys library](https://github.com/dapphub/dappsys-monolithic). Functions decorated with the `auth` and `authDomain` modifiers will perform an authorization check via the authority contracts before granting access. In future releases, this pattern will also allow us to switch to a reputation-mediated authority in colonies.
9
+
In the current `glider` release, network state changes are authorized by dedicated "authority" contracts e.g. `ColonyAuthority.sol`. These are based on the `DSRoles` implementation from [dappsys](https://github.com/dapphub/dappsys-monolithic). Functions decorated with the `auth` and `authDomain` modifiers will perform an authorization check via the authority contracts before granting access. In future releases, this pattern will also allow us to switch to a reputation-mediated authority in colonies.
10
10
11
11
Roles are defined within `ColonyRole` struct and grant permission to call certain functions within a specific domain of the colony. These are initialized in `ColonyAuthority.sol`. An account may be given one or more of the available pre-defined roles:
12
12
@@ -20,10 +20,12 @@ Note: Currently, the existing `auth` modifier is preserved and checks for permis
20
20
21
21
Note: Currently `Arbitration` role grants permission for no functions. It is a placeholder for the dispute resolution system, to be implemented in later releases.
22
22
23
-
For example, within the 'logistics' domain, any address with the `Administration` role may call the `addPayment` function to create a new payment. But to add funding for the payment, an address with the `Funding` role must call `moveFundsBetweenPots` for the payment. These two functions can be called by the same address (even in the same transaction), provided that the address has both `Administration` and `Funding` permissions.
23
+
## Domain permission transitivity
24
+
*Note: Domains are currently restricted to one level below the root domain. This restriction will be removed after release.*
24
25
25
-
**Domain permission inheritance**
26
-
Domain permissions flow down in the domain tree. As an example of how domain permissions propagate, consider this tree of domains in a colony (using domainIds as identifiers):
26
+
Domain permissions extend from the root domain. Permissions held in a domain are held in all child sub-domains, but not in parent domains.
27
+
28
+
As an example, consider this tree of domains in a colony (using domainIds as identifiers):
27
29
28
30
```
29
31
1
@@ -33,42 +35,45 @@ Domain permissions flow down in the domain tree. As an example of how domain per
33
35
3 5
34
36
```
35
37
36
-
If you have funding permission in `3`, and funding permission in `6`, you shouldn't be able to move funds from `3`to `6`, because that would be taking them out of `2`, which you don't have the permission for. If you have funding permission in `1`, however, you should be able to move from `3` to `6`, because that's all under 'one roof'.
38
+
Authority in domain `2` to call a permissioned function is valid in domains `3`and `5`, but not `6`. Authority in domain `1`to call a permissioned function is valid in all subdomains.
37
39
38
-
**Using permissioned functions**
40
+
## Using permissioned functions
41
+
Permissioned functions check two arguments, which are by convention the first and second ones expected in all permissioned functions:
39
42
40
-
In order to provide the necessary inputs to the authorisation logic, we have added two arguments to every permissioned function, which by convention are the first two arguments. The first is the permission domain id (`_permissionDomainId`), and the second is an index (`_childSkillIndex`) telling us where in the child array of the permission domain we can find the "domain of action". The "domain of action" itself is the domain in which state is being changed.
43
+
`_permissionDomainId`: The domain that gives the caller the authority to execute an action
44
+
`_childSkillIndex`: an index that specifies where to find the domain in which the action occurs.
41
45
42
-
For example is a colony with the domain tree below,
46
+
New domains are given a unique skillId upon creation, so a colony with the following domain structure
43
47
```
44
48
1
45
49
/ | \
46
50
2 4 6
47
51
/ \
48
52
3 5
49
53
```
50
-
which has representative local skills Id as follows:
54
+
might have local skillIds assigned as:
51
55
```
52
56
142
53
57
/ | \
54
58
147 254 696
55
59
/ \
56
60
159 307
57
61
```
58
-
Skill `142` has the following `children`: `[147, 159, 254, 307, 696]`
59
62
60
-
if we want to grant user `USER2` permission to create tasks and payments in domain `5`, and we ourselves are user `USER1` have root permissions. We need to give them permissions in that specific domain as follows:
63
+
In this example,
64
+
Skill `142` has children: `[147, 159, 254, 307, 696]`
65
+
Skill `147` has children: `[159, 307]`
66
+
Skill `254` has children: `[]`
67
+
68
+
If a user with "Admininstration" authority in domain `2` wants to finalize a payment in domain `5`, they would call:
Essentially the two additional parameters are used to perform the following checks:
67
-
68
-
1) Whether `USER1` has the permission to assign a new `Administrator` in `_permissionDomainId`, which is domain `1` in this case.
69
-
70
-
2) Whether the domain of action, if this case domain `5`, is actually a child of the permission domain `1`. This is done using `_childSkillIndex`, here passed as `3` meaning the permission domain (`1`) `skill.children` array's third member should match domain `5` skill.
74
+
The `authDomain` modifier performs the following checks:
71
75
72
-
And for the architecture permission, checks to see that the domain is strictly a child of the permission domain (i.e. not the permission domain itself).
76
+
1) Whether `msg.sender` has the "Administration" or "Root" permission in domain `2`
77
+
2) Whether the domain of action (in this case domain `5`) is indeed a child of the permission domain `2`, by checking that the second item in the `childSkillIndex` matches the local skill associated with the domain, whatever that may be.
73
78
74
-
Note: Within `ColonyAuthority.sol` you will see this role implemented as both`Architecture` and `ArchitectureSubdomain` roles. This is in order to prohibit an architect from modifying the domain in which the role was given (which would allow them to, for example, remove their co-architect's role). Architects may alter permissions in sub-domains only.
79
+
Note: Functions authorized by the "Architecture" role check to see that the domain is strictly a child of the permission domain exclusively (not the permission domain itself). Within `ColonyAuthority.sol` you will see this role implemented as both`Architecture` and `ArchitectureSubdomain` roles. This is in order to prohibit an architect from modifying the domain in which the role was given (which would allow them to, for example, remove their co-architect's role). Architects may alter permissions in sub-domains only.
0 commit comments