0

I need to authorize with admin table of contract. but I could not account name which is processing action of contract. Let me know about any eos function to get account name, if anyone know well.

    user = <recent account name>;
    admins admin(get_self(), user.value);   
    auto itr = admin.require_find(user.value, "not allowed");

1 Answer 1

0

just pass the user-name as parameter and verify that it was authorized by the user:

ACTION somecontract::someact(eosio::name user){
    require_auth(user);
    admins admin(get_self(), user.value);   
    auto itr = admin.require_find(user.value, "not allowed");
}

As a Sidenote: I don't know much about the desired functionallity behind this but usually it is unwise to use the one value as both scope and key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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