hyperledger-iroha / iroha-dco

Iroha - A simple, decentralized ledger
http://iroha.tech
Apache License 2.0
988 stars 297 forks source link

grant permission over account error #1274

Closed big-fish0 closed 6 years ago

big-fish0 commented 6 years ago
Choose what to do:
1. New transaction (tx)
2. New query (qry)
3. New transaction status request (st)
> : 1
Forming a new transactions, choose command to add:
1. Detach role from account (detach)
2. Add new role to account (apnd_role)
3. Create new role (crt_role)
4. Set account key/value detail (set_acc_kv)
5. Transfer Assets (tran_ast)
6. Grant permission over your account (grant_perm)
7. Subtract Assets Quantity from Account (sub_ast_qty)
8. Set Account Quorum (set_qrm)
9. Remove Signatory (rem_sign)
10. Create Domain (crt_dmn)
11. Revoke permission from account (revoke_perm)
12. Create Account (crt_acc)
13. Add Signatory to Account (add_sign)
14. Create Asset (crt_ast)
15. Add Peer to Iroha Network (add_peer)
16. Add Asset Quantity (add_ast_qty)
0. Back (b)
> : 6
Account Id: test@test
Permission name: can_get_my_account
Command is formed. Choose what to do:
1. Add one more command to the transaction (add)
2. Send to Iroha peer (send)
3. Go back and start a new transaction (b)
4. Save as json file (save)
> : 2
Peer address (0.0.0.0): loclahost
Peer port (50051): 50051
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::out_of_range> >'
  what():  bimap<>: invalid key
Aborted (core dumped)

In my code ,i input the same permission can_get_my_account,returned

Exception in thread "main" java.lang.IllegalArgumentException: 0 GrantPermission: [[Provided permission does not exist ]]

        at irohaJNI.ModelTransactionBuilder_build(Native Method)
        at ModelTransactionBuilder.build(ModelTransactionBuilder.java:118)
        at IrohaTransaction.cmdGrantPermission(IrohaTransaction.java:218)
        at IrohaApi.cmdGrantPermission(IrohaApi.java:385)
        at IrohaApi.cmdGrantPermission(IrohaApi.java:389)
        at test.main(test.java:11)
laSinteZ commented 6 years ago

@big-fish0 Please note that the permission can_get_my_account is not grantable. You should add it to the role and add role to an account. http://iroha.readthedocs.io/en/latest/core_concepts/glossary.html#permission

Here is the list of all grantable permissions:

can_add_my_signatory
can_remove_my_signatory
can_set_my_quorum
can_set_my_account_detail
can_transfer_my_assets

Soon we will update our documentation and reflect it, so it is clear what you can grant directly and what you must add to a role.

big-fish0 commented 6 years ago

@laSinteZ But i change the permission to can_add_my_signatory,It returns the same error response

Choose what to do:
1. New transaction (tx)
2. New query (qry)
3. New transaction status request (st)
> : 1
Forming a new transactions, choose command to add:
1. Detach role from account (detach)
2. Add new role to account (apnd_role)
3. Create new role (crt_role)
4. Set account key/value detail (set_acc_kv)
5. Transfer Assets (tran_ast)
6. Grant permission over your account (grant_perm)
7. Subtract Assets Quantity from Account (sub_ast_qty)
8. Set Account Quorum (set_qrm)
9. Remove Signatory (rem_sign)
10. Create Domain (crt_dmn)
11. Revoke permission from account (revoke_perm)
12. Create Account (crt_acc)
13. Add Signatory to Account (add_sign)
14. Create Asset (crt_ast)
15. Add Peer to Iroha Network (add_peer)
16. Add Asset Quantity (add_ast_qty)
0. Back (b)
> : 6
Account Id: test@test
Permission name: can_add_my_signatory
Command is formed. Choose what to do:
1. Add one more command to the transaction (add)
2. Send to Iroha peer (send)
3. Go back and start a new transaction (b)
4. Save as json file (save)
> : 2
Peer address (0.0.0.0): localhost
Peer port (50051): 50051
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::out_of_range> >'
  what():  bimap<>: invalid key
Aborted (core dumped)