-
Notifications
You must be signed in to change notification settings - Fork 26
'Permissions' update #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
yamkovoy
wants to merge
1
commit into
hyperledger-iroha:main
Choose a base branch
from
yamkovoy:permissions-update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
'Permissions' update #503
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,13 +1,20 @@ | ||||||
# Permissions | ||||||
|
||||||
Accounts need permission tokens for various actions on a blockchain, e.g. | ||||||
to mint or burn assets. | ||||||
For a user to be able to perform an action on the blockchain (e.g., minting and burning assets, registering domains, etc.), their account needs a permission—`PermissionToken`—to do that action. | ||||||
|
||||||
There is a difference between a public and a private blockchain in terms of | ||||||
permissions granted to users. In a public blockchain, most accounts have | ||||||
the same set of permissions. In a private blockchain, most accounts are | ||||||
assumed not to be able to do anything outside of their own account or | ||||||
domain unless explicitly granted said permission. | ||||||
::: info | ||||||
|
||||||
There is a difference between public and private blockchains in terms of permissions granted to users. In a public blockchain, most accounts have the same set of permissions. Whereas, in a private blockchain, most accounts are assumed to not be able to do anything outside of their own account or domain unless they are explicitly granted a specific permission. | ||||||
|
||||||
For more details, see [Public and Private Blockchains](../configure/modes.md). | ||||||
|
||||||
::: | ||||||
|
||||||
## Permission Tokens | ||||||
|
||||||
Technically, every `PermissionToken` | ||||||
|
||||||
## Permission Tokens | ||||||
|
||||||
Having a permission to do something means having a `PermissionToken` to do | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
so. There are two ways for users to receive permission tokens: they can be | ||||||
|
@@ -16,8 +23,6 @@ set of permission tokens). Permissions are granted via `Grant` special | |||||
instruction. Permission tokens and roles do not expire, they can only be | ||||||
removed using `Revoke` instruction. | ||||||
|
||||||
## Permission Tokens | ||||||
|
||||||
Permission token definitions have parameters. When a new permission token | ||||||
is registered, the names of the parameters and their types are checked | ||||||
against their names and types in the token definition. The token | ||||||
|
@@ -59,9 +64,11 @@ Here are some examples of parameters used for various permission tokens: | |||||
epoch in milliseconds (more details about | ||||||
[time in Rust](https://doc.rust-lang.org/std/time/struct.SystemTime.html)). | ||||||
|
||||||
### Pre-configured Permission Tokens | ||||||
### Preconfigured Permission Tokens | ||||||
|
||||||
Iroha 2 also provides a number of _preconfigured_ permission tokens that can be granted | ||||||
|
||||||
You can find the list of pre-configured permission tokens in the [Reference](/reference/permissions) chapter. | ||||||
For the list of all preconfigured permission tokens, see [Reference > Permissions](/reference/permissions.md). | ||||||
|
||||||
## Permission Groups (Roles) | ||||||
|
||||||
|
@@ -71,9 +78,9 @@ roles can be granted using the `Grant` instruction and revoked using the | |||||
|
||||||
Before granting a role to an account, the role should be registered first. | ||||||
|
||||||
<!-- TODO: add more info about roles --> | ||||||
<!-- TODO: add more info about roles; default roles? --> | ||||||
|
||||||
### Register a new role | ||||||
### Register a New Role | ||||||
|
||||||
Let's register a new role that, when granted, will allow another account | ||||||
access to the [metadata](/guide/blockchain/metadata.md) in Mouse's account: | ||||||
|
@@ -86,7 +93,7 @@ let role = iroha_data_model::role::Role::new(role_id) | |||||
let register_role = RegisterBox::new(role); | ||||||
``` | ||||||
|
||||||
### Grant a role | ||||||
### Grant a Role | ||||||
|
||||||
After the role is registered, Mouse can grant it to Alice: | ||||||
|
||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this sentence in progress?