3

What is linked permission? The following is from authorization_manager.cpp.

   optional<permission_name> authorization_manager::lookup_linked_permission( account_name authorizer_account,
                                                                              account_name scope,
                                                                              action_name act_name
                                                                            )const
   {
      try {
         // First look up a specific link for this message act_name
         auto key = boost::make_tuple(authorizer_account, scope, act_name);
         auto link = _db.find<permission_link_object, by_action_name>(key);
         // If no specific link found, check for a contract-wide default
         if (link == nullptr) {
            boost::get<2>(key) = "";
            link = _db.find<permission_link_object, by_action_name>(key);
         }

         // If no specific or default link found, use active permission
         if (link != nullptr) {
            return link->required_permission;
         }
         return optional<permission_name>();

       //  return optional<permission_name>();
      } FC_CAPTURE_AND_RETHROW((authorizer_account)(scope)(act_name))
   }
1

One is able to request additional permissions for smart contract functions. That lookup function performs a look-up with the selected account and scope to find specific permissions that might exist for the function, and if nothing is found - uses a default permission. When you call an action from smart contract, you specify the permission for it:

action(permission_level {_self,N(active)}, account, N(adduser),
                std::make_tuple("lonkly", "Artem","Odessa",65014)).send();

and system verifies if that permission is eligible for that particular func.

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.