Magento2.2 How to get userContext into ScopeConfig

It’s more a core logic issue than a technical issue!

I created one new table for admin_user: admin_user_config_data


And, like in core_config_data, in this new table will be stored the data from the specific admin_user.

My new attempt was create a new scope, but It’s very complicated, and looking the code I realized that the magento create a new cache from every scope every time that I change the config. Like this:

$  this->_reinitableConfig->reinit() 

Well. Than I created a plugin that search for the config path in my new table:


<type name="Magento\Framework\App\Config\ScopeConfigInterface">     <plugin name="Mine_User_ScopeConfigInterface" type="Mine\User\Plugin\ScopeConfig" /> </type> 


class ScopeConfig {     public function __construct(         \Mine\User\Model\ResourceModel\UserConfigData\CollectionFactory $  userConfigDataCollectionFactory,         \Magento\Authorization\Model\UserContextInterface $  userContext     )     {         $  this->_userConfigDataCollectionFactory = $  userConfigDataCollectionFactory;         $  this->_userContext = $  userContext;     }      public function afterGetValue(         \Magento\Framework\App\Config\ScopeConfigInterface $  subject,         $  result,         $  path,         $  scopeType = ScopeConfigInterface::SCOPE_TYPE_DEFAULT,         $  scopeCode = null     )     {         if ($  this->_userContext && $  this->_userContext->getUserId()) {             $  userConfigData = $  this->_userConfigDataCollectionFactory->create()                 ->addFieldToFilter('path', $  path)                 ->addFieldToFilter('user_id', $  this->_userContext->getUserId())                 ->getFirstItem();              if ($  userConfigData->getId()) {                 return $  userConfigData->getValue();             }         }          return $  result;     } } 

But if I do this, my API returns the message:

Consumer is not authorized to access %resources 

Without the UserContextInterface in the constructor the API works normally.

Anyone have any idea of how I can get the config stored in the admin_user_config_data after the value provided by the scopeConfig and with current logged in user? (The login is by api token provided by V1/integration/admin/token)