_authorization = $context->getAuthorization(); } public function getRejectUrl() { return $this->getUrl('sales/*/reject'); } public function getOrder() { return $this->_coreRegistry->registry('current_order'); } /** * @param string $resourceId * @return bool */ public function canReject(string $resourceId = 'Magento_Sales::cancel') { return $this->_authorization->isAllowed($resourceId) && $this->getOrder()->canCancel(); } }