docs/02_cleos/02_how-to-guides/how-to-link-permission.md
This guide provides instructions to link a permission to a smart contract action.
The example uses cleos to link a custom permission customp in the account alice to a hi action deployed to the scontract account so that the alice account's active permission and customp permission are authorized to call the hi _action.
Make sure you meet the following requirements:
cleos.
[[info | Note]]
| Cleos is bundled with the EOSIO software. Installing EOSIO will also install the cleos and keosd comand line tools.active private key.See the following reference guides for command line usage and related options:
The following step shows you how to link a permission:
cleos set action permission alice scontract hi customp -p alice@active
Where
alice = The name of the account containing the permission to link.scontract= The name of the account which owns the smart contract.hi = The name of the action to link to a permission.customp = The permission used to authorize the transaction.-p alice@active = The permission used to authorize linking the customp permission.Example Output
executed transaction: 4eb4cf3aea232d46e0e949bc273c3f0575be5bdba7b61851ab51d927cf74a838 128 bytes 141 us
# eosio <= eosio::linkauth {"account":"alice","code":"scontract","type":"hi","requirement":"customp"}
In conclusion, by following these instructions you are able to link a permission to a smart contract action.