5

Some of my action require a special role "admin". What is the best way to handle set some user as admin and some action require the users with admin role? (In solidity, I can have a setAdmin() function and modifier requireAdmin().)

1 Answer 1

3

You can use the require_auth2() function, which can check a custom permission

Verifies that name exists in the set of provided auths on a action. Throws if not found

Parameters

  • name - name of the account to be verified

  • permission - permission level to be verified

The official docs have an article explaining permissions in EOSIO, and you can create and manage new permissions using $ cleos set account permission

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.