0

I need to do API method, which return data from db table just for admin. There is my method:

/**
     * @return array
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function showAddedSku()
    {
        $insSku = $this->collection->create();
        $data = [];

        foreach ($insSku as $key => $sku)
        {
            $data[$key]['id'] = $sku->getId();
            $data[$key]['sku'] = $sku->getSku();
            $data[$key]['count'] = $sku->getCount();
        }

        return $data;
    }

How can I check, that it is admin?

I read, that I must set that:

<resources>
    <resource ref="???" />
</resources>

but what ref should i choose?

1 Answer 1

1

You can fill in self, anonymous or Magento resource for this field.

In your case, you should set it as Magento_Backend::admin.

Source:

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.