mirror of
https://github.com/bigchaindb/site.git
synced 2024-11-22 09:46:57 +01:00
correct rbac and did
This commit is contained in:
parent
d047974d1b
commit
b4dcc708d9
@ -81,20 +81,7 @@ After having generated key pairs (and identities), you can now create the actual
|
||||
|
||||
These assets will now live in BigchainDB forever and there is no possibility to delete them. This is the immutability property of blockchain technology.
|
||||
|
||||
You can start by creating the car asset. The first thing needed is the definition of the asset field that represents the car. It has a JSON format:
|
||||
|
||||
```js
|
||||
const vehicle = {
|
||||
value: '6sd8f68sd67',
|
||||
power: {
|
||||
engine: '2.5',
|
||||
hp: '220 hp',
|
||||
}
|
||||
consumption: '10.8 l',
|
||||
}
|
||||
```
|
||||
|
||||
As a next step, you need to generate a `CREATE` transaction that represents the user DID in BigchainDB as an asset. The user is a self-owned identity, so you will use Alice's keypair to create the `userDID`.
|
||||
For creating the first asset you can generate a `CREATE` transaction that represents the user DID in BigchainDB as an asset. The user is a self-owned identity, so you will use Alice's keypair to create the `userDID`.
|
||||
|
||||
```js
|
||||
userDID.myModel.create({
|
||||
@ -109,11 +96,25 @@ userDID.myModel.create({
|
||||
document.body.innerHTML +=asset.id
|
||||
})
|
||||
```
|
||||
|
||||
As you can see, by inheriting the Orm class it is very easy to create an asset in BigchainDB. The only thing needed is the keypair and the asset.
|
||||
The id property is set in the DID object. This is the unique identifier of this asset.
|
||||
|
||||
In order to create the asset of the car you first need to define the asset field that represents the car. It has a JSON format:
|
||||
|
||||
```js
|
||||
const vehicle = {
|
||||
value: '6sd8f68sd67',
|
||||
power: {
|
||||
engine: '2.5',
|
||||
hp: '220 hp',
|
||||
}
|
||||
consumption: '10.8 l',
|
||||
}
|
||||
```
|
||||
|
||||
Now you can create the DID for the car. The owner of the car is Alice, and she is the one who can transfer this asset in the future, so the Alice keypair is needed to create this asset
|
||||
|
||||
|
||||
```js
|
||||
carDID.myModel.create({
|
||||
keypair: alice,
|
||||
|
@ -11,12 +11,14 @@ learn: >
|
||||
- How Role-based access controls work in BigchainDB
|
||||
---
|
||||
|
||||
Hi there! Welcome to our next tutorial about Role-based access controls (RBACs) in BigchainDB. For this tutorial, we assume that you are familiar with the BigchainDB primitives (assets, inputs, outputs, transactions etc.). If you are not, familiarize yourself with the [Key concepts of BigchainDB](../key-concepts-of-bigchaindb/). We also assume that you have completed our [first tutorial](../tutorial-car-telemetry-app/).
|
||||
Hi there! Welcome to our next tutorial about Role-based access controls (RBAC) in BigchainDB. For this tutorial, we assume that you are familiar with the BigchainDB primitives (assets, inputs, outputs, transactions etc.). If you are not, familiarize yourself with the [Key concepts of BigchainDB](../key-concepts-of-bigchaindb/). We also assume that you have completed our [first tutorial](../tutorial-car-telemetry-app/).
|
||||
|
||||
# About RBACs
|
||||
Role based access control is a way to restrict the system access to certain users. In BigchainDB this function enables the creation of hierarchies of role and permissions. Furthermore, users can be assigned roles to “act on behalf of” or “represent” other users or groups.
|
||||
In our case we propose different tribes where people have different roles, some can create proposals and some others can vote those proposals.
|
||||
# About RBAC
|
||||
Role based access control is a way to restrict the system access to certain users. In BigchainDB this function enables the creation of hierarchies of role and permissions as assets. Furthermore, users can be assigned roles to “act on behalf of” or “represent” other users or groups.
|
||||
|
||||
In our example use-case scenario for this guide, we have different tribes or groups of users where they have different roles, users belonging to one tribe can create proposal assets and others can create vote assets on the BigchainDB blockchain.
|
||||
|
||||
**Important note:** The BigchainDB RBAC module does not work out of the box in BigchainDB and a plugin [smart-assets](https://github.com/bigchaindb/bigchaindb-smart-assets) needs to be loaded with a specific [BigchainDB branch (kyber-master)](https://github.com/bigchaindb/bigchaindb/tree/kyber-master). The setup instructions are available in the [README.md](https://github.com/bigchaindb/bigchaindb-smart-assets/blob/master/README.md) of the smart-assets repository.
|
||||
|
||||
{% include_relative _setup.md %}
|
||||
|
||||
@ -224,3 +226,8 @@ So now simply create proposals and votes from different users. You will see how
|
||||
document.body.innerHTML +=vote2.id
|
||||
}
|
||||
```
|
||||
|
||||
The concepts discussed in this guide can be found in detail on our [blog](https://blog.bigchaindb.com/role-based-access-control-for-bigchaindb-assets-b7cada491997).
|
||||
|
||||
The demo code is available in [GitHub](
|
||||
https://github.com/bigchaindb/project-jannowitz/tree/master/rbac/demo).
|
||||
|
Loading…
Reference in New Issue
Block a user