Ejemplo n.º 1
0
 /**
  * Test for Mage_Webapi_Model_Authorization_Loader_Role::populateAcl
  *
  * Test with No existing role Ids
  */
 public function testPopulateAclWithNoRoles()
 {
     $this->_resourceModelMock->expects($this->once())->method('getRolesIds')->will($this->returnValue(array()));
     $this->_roleFactory->expects($this->never())->method('createRole');
     $this->_acl->expects($this->never())->method('addRole');
     $this->_acl->expects($this->never())->method('deny');
     $this->_model->populateAcl($this->_acl);
 }
Ejemplo n.º 2
0
 /**
  * Populate ACL with roles from external storage.
  *
  * @param Magento_Acl $acl
  */
 public function populateAcl(Magento_Acl $acl)
 {
     $roleList = $this->_roleResource->getRolesIds();
     foreach ($roleList as $roleId) {
         /** @var $aclRole Mage_Webapi_Model_Authorization_Role */
         $aclRole = $this->_roleFactory->createRole(array($roleId));
         $acl->addRole($aclRole);
         //Deny all privileges to Role. Some of them could be allowed later by whitelist
         $acl->deny($aclRole);
     }
 }
Ejemplo n.º 3
0
 public function testCreateRole()
 {
     $arguments = array('5', '6');
     $this->_objectManager->expects($this->once())->method('create')->with('Mage_Webapi_Model_Authorization_Role', $arguments, false)->will($this->returnValue($this->_expectedObject));
     $this->assertEquals($this->_expectedObject, $this->_model->createRole($arguments));
 }