Esempio n. 1
0
 public function testGetStoreIds()
 {
     $this->_model->load(3);
     /* id from fixture */
     $this->assertContains(Mage::app()->getStore()->getId(), $this->_model->getStoreIds());
 }
Esempio n. 2
0
 /**
  * Validate catalog category save
  *
  * @param Mage_Catalog_Model_Category $model
  */
 public function catalogCategorySaveBefore($model)
 {
     if (!$model->getId()) {
         return;
     }
     // No saving to wrong stores
     if (!$this->_role->hasStoreAccess($model->getStoreIds())) {
         $this->_throwSave();
     }
     // No saving under disallowed root categories
     $categoryPath = $model->getPath();
     $allowed = false;
     foreach ($this->_role->getAllowedRootCategories() as $rootPath) {
         if ($categoryPath != $rootPath) {
             if (0 === strpos($categoryPath, "{$rootPath}/")) {
                 $allowed = true;
             }
         } else {
             if ($this->_role->hasExclusiveCategoryAccess($rootPath)) {
                 $allowed = true;
             }
         }
         if ($allowed) {
             break;
         }
     }
     if (!$allowed) {
         $this->_throwSave();
     }
 }