/** * Return an array of selected resource ids. If everything is allowed then iterate through all * available resources to generate a comprehensive array of all resource ids, rather than just * returning "Magento_Backend::all". * * @return string */ public function getSelectedResourcesJson() { $selectedResources = $this->_selectedResources; if ($this->isEverythingAllowed()) { $resources = $this->_resourceProvider->getAclResources(); $selectedResources = $this->_getAllResourceIds($resources[1]['children']); } return $this->encoder->encode($selectedResources); }
public function testGetTree() { $this->webapiBlock = $this->getWebapiBlock(); $resources = [1 => ['children' => [1, 2, 3]]]; $this->aclResourceProvider->expects($this->once())->method('getAclResources')->will($this->returnValue($resources)); $rootArray = "rootArrayValue"; $this->integrationHelper->expects($this->once())->method('mapResources')->with([1, 2, 3])->will($this->returnValue($rootArray)); $this->assertEquals($rootArray, $this->webapiBlock->getTree()); }
/** * Get Json Representation of Resource Tree * * @return array */ public function getTree() { $resources = $this->_aclResourceProvider->getAclResources(); $rootArray = $this->_integrationData->mapResources(isset($resources[1]['children']) ? $resources[1]['children'] : array()); return $rootArray; }
/** * Populate ACL with resources from external storage * * @param Acl $acl * @return void */ public function populateAcl(Acl $acl) { $this->_addResourceTree($acl, $this->_resourceProvider->getAclResources(), null); }