/** * Step 3. Decide permissions for upload. */ public function actionStep3($id) { $import = Import::getById((int) $_GET['id']); $importWizardForm = ImportWizardUtil::makeFormByImport($import); if (isset($_POST[get_class($importWizardForm)])) { ImportWizardUtil::setFormByPostForStep3($importWizardForm, $_POST[get_class($importWizardForm)]); $this->attemptToValidateImportWizardFormAndSave($importWizardForm, $import, 'step4'); } $title = Zurmo::t('ImportModule', 'Import Wizard: Step 3 of 6'); $importView = new ImportWizardSetModelPermissionsView($this->getId(), $this->getModule()->getId(), $importWizardForm, $title); $view = new ImportPageView(ZurmoDefaultAdminViewUtil::makeStandardViewForCurrentUser($this, $importView)); echo $view->render(); }
/** * Step 3. Decide permissions for upload. */ public function actionStep3($id) { $import = Import::getById((int) $_GET['id']); $importWizardForm = ImportWizardUtil::makeFormByImport($import); if (isset($_POST[get_class($importWizardForm)])) { ImportWizardUtil::setFormByPostForStep3($importWizardForm, $_POST[get_class($importWizardForm)]); $this->attemptToValidateImportWizardFormAndSave($importWizardForm, $import, 'step4'); } $title = Zurmo::t('ImportModule', 'Import Wizard - Select Permissions'); $importRulesClassName = ImportRulesUtil::getImportRulesClassNameByType($importWizardForm->importRulesType); $progressBarAndStepsView = new ImportStepsAndProgressBarForWizardView($importRulesClassName, 2); $importView = new ImportWizardSetModelPermissionsView($this->getId(), $this->getModule()->getId(), $importWizardForm, $title); echo $this->getImportPageView($progressBarAndStepsView, $importView)->render(); }
/** * @depends testSetFormByPostForStep2 */ public function testSetFormByPostForStep3() { Yii::app()->user->userModel = User::getByUsername('super'); $group = new Group(); $group->name = 'myGroup'; $this->assertTrue($group->save()); $fakePostData = array('explicitReadWriteModelPermissions' => array('type' => ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_NONEVERYONE_GROUP, 'nonEveryoneGroup' => $group->id)); $importWizardForm = new ImportWizardForm(); ImportWizardUtil::setFormByPostForStep3($importWizardForm, $fakePostData); $this->assertEquals(0, $importWizardForm->explicitReadWriteModelPermissions->getReadOnlyPermitablesCount()); $this->assertEquals(1, $importWizardForm->explicitReadWriteModelPermissions->getReadWritePermitablesCount()); $permitables = $importWizardForm->explicitReadWriteModelPermissions->getReadWritePermitables(); $permitable = array_shift($permitables); $this->assertEquals('myGroup', $permitable->name); }