Set Action Permission

The set_account_permission command sets authorization for a contract’s specific action. You might want to see the plain cleos approach here.

NOTE: The Python code listed below is executable, as explained here.

from eosfactory.eosf import *
reset()
create_master_account("master")
create_account("producer", master)
producer.info()

The permissions section of producer.info():

permissions:
     owner     1:    1 producer@owner
        active     1:    1 producer@active
COMMENT('''producer.set_account_permission("claimer"''')
producer.set_account_permission("claimer",
    {
        "threshold" : 1, 
        "keys" : 
            [
                {
                    "key": producer.active(),
                    "weight": 1
                }
            ]

    },
    Permission.ACTIVE)

producer.info()

The permissions section of producer.info():

permissions:
     owner     1:    1 producer@owner
        active     1:    1 producer@active
           claimer     1:    1 producer@active
COMMENT('''producer.set_action_permission("eosio"''')
producer.set_action_permission(
    "eosio", "claimrewards", "claimer", permission=(producer, "active"))
stop()