当前位置: 首页>>代码示例>>PHP>>正文


PHP ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData方法代码示例

本文整理汇总了PHP中ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData方法的典型用法代码示例。如果您正苦于以下问题:PHP ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData方法的具体用法?PHP ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData怎么用?PHP ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExplicitReadWriteModelPermissionsUtil的用法示例。


在下文中一共展示了ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveModelFromSanitizedData

 public function saveModelFromSanitizedData($sanitizedData, $model, &$savedSuccessfully, &$modelToStringValue)
 {
     //note: the logic for ExplicitReadWriteModelPermission might still need to be moved up into the
     //post method above, not sure how this is coming in from API.
     $explicitReadWriteModelPermissions = static::resolveAndMakeExplicitReadWriteModelPermissions($sanitizedData, $model);
     $readyToUseData = ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData($sanitizedData);
     $sanitizedOwnerData = PostUtil::sanitizePostDataToJustHavingElementForSavingModel($readyToUseData, 'owner');
     $sanitizedDataWithoutOwner = PostUtil::removeElementFromPostDataForSavingModel($readyToUseData, 'owner');
     $model->setAttributes($sanitizedDataWithoutOwner);
     $this->afterSetAttributesDuringSave($model, $explicitReadWriteModelPermissions);
     if ($model->validate()) {
         $modelToStringValue = strval($model);
         if ($sanitizedOwnerData != null) {
             $model->setAttributes($sanitizedOwnerData);
         }
         if ($model instanceof OwnedSecurableItem) {
             $passedOwnerValidation = $model->validate(array('owner'));
         } else {
             $passedOwnerValidation = true;
         }
         if ($passedOwnerValidation && $model->save(false)) {
             if ($explicitReadWriteModelPermissions != null) {
                 $success = ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($model, $explicitReadWriteModelPermissions);
                 //todo: handle if success is false, means adding/removing permissions save failed.
             }
             $savedSuccessfully = true;
             $this->afterSuccessfulSave($model);
         }
     } else {
     }
     return $model;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:32,代码来源:ZurmoControllerUtil.php

示例2: actionInlineEditValidate

 protected function actionInlineEditValidate($model)
 {
     $readyToUsePostData = ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData($_POST[get_class($model)]);
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel($model, $readyToUsePostData);
     $sanitizedOwnerPostData = PostUtil::sanitizePostDataToJustHavingElementForSavingModel($sanitizedPostData, 'owner');
     $sanitizedPostDataWithoutOwner = PostUtil::removeElementFromPostDataForSavingModel($sanitizedPostData, 'owner');
     $model->setAttributes($sanitizedPostDataWithoutOwner);
     if ($model->validate()) {
         $modelToStringValue = strval($model);
         if ($sanitizedOwnerPostData != null) {
             $model->setAttributes($sanitizedOwnerPostData);
         }
         if ($model instanceof OwnedSecurableItem) {
             $model->validate(array('owner'));
         }
     }
     $errorData = ZurmoActiveForm::makeErrorsDataAndResolveForOwnedModelAttributes($model);
     echo CJSON::encode($errorData);
     Yii::app()->end(0, false);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:20,代码来源:DefaultController.php

示例3: testProductSaveWithPermissions

 public function testProductSaveWithPermissions()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $contacts = Contact::getAll();
     $accounts = Account::getByName('superAccount');
     $opportunities = Opportunity::getByName('superOpportunity');
     $productTemplates = ProductTemplate::getByName('superProductTemplate');
     $account = $accounts[0];
     $user = $account->owner;
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $explicitReadWriteModelPermissions = new ExplicitReadWriteModelPermissions();
     $currencyHelper = Yii::app()->currencyHelper;
     $currencyCode = $currencyHelper->getBaseCode();
     $currency = Currency::getByCode($currencyCode);
     $postData = array('productTemplate' => array('id' => $productTemplates[0]->id), 'name' => 'ProductPermissionTest', 'quantity' => 6, 'account' => array('id' => $accounts[0]->id), 'contact' => array('id' => $contacts[0]->id), 'opportunity' => array('id' => ''), 'type' => ProductTemplate::TYPE_PRODUCT, 'priceFrequency' => ProductTemplate::PRICE_FREQUENCY_ONE_TIME, 'sellPrice' => array('currency' => array('id' => $currency->id), 'value' => 210), 'stage' => array('value' => 'Open'), 'owner' => array('id' => $user->id), 'explicitReadWriteModelPermissions' => array('type' => ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP, 'nonEveryoneGroup' => ''));
     $model = new Product();
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel($model, $postData);
     if ($model instanceof SecurableItem) {
         $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::resolveByPostDataAndModelThenMake($sanitizedPostData, $model);
     } else {
         $explicitReadWriteModelPermissions = null;
     }
     $readyToUseData = ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData($sanitizedPostData);
     $sanitizedOwnerData = PostUtil::sanitizePostDataToJustHavingElementForSavingModel($readyToUseData, 'owner');
     $sanitizedDataWithoutOwner = PostUtil::removeElementFromPostDataForSavingModel($readyToUseData, 'owner');
     $model->setAttributes($sanitizedDataWithoutOwner);
     if ($model->validate()) {
         $modelToStringValue = strval($model);
         if ($sanitizedOwnerData != null) {
             $model->setAttributes($sanitizedOwnerData);
         }
         if ($model instanceof OwnedSecurableItem) {
             $passedOwnerValidation = $model->validate(array('owner'));
         } else {
             $passedOwnerValidation = true;
         }
         if ($passedOwnerValidation && $model->save(false)) {
             if ($explicitReadWriteModelPermissions != null) {
                 $success = ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($model, $explicitReadWriteModelPermissions);
                 //todo: handle if success is false, means adding/removing permissions save failed.
             }
             $savedSuccessfully = true;
         }
     } else {
     }
     $this->assertEquals('ProductPermissionTest', $model->name);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:47,代码来源:ProductTest.php

示例4: testRemoveIfExistsFromPostData

 public function testRemoveIfExistsFromPostData()
 {
     $postData = array();
     $postData['abc'] = 123;
     $postData['explicitReadWriteModelPermissions'] = 'string';
     $resolvedPostData = ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData($postData);
     $this->assertTrue(!isset($resolvedPostData['explicitReadWriteModelPermissions']));
     $this->assertEquals(123, $resolvedPostData['abc']);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:9,代码来源:ExplicitReadWriteModelPermissionsUtilTest.php

示例5: attemptToValidateAjaxFromPost

 /**
  * Override to handle report filters
  * @param SavedCalendar | ModelForm $model
  * @param string $postVariableName
  * @throws NotSupportedException();
  */
 protected function attemptToValidateAjaxFromPost($model, $postVariableName)
 {
     if (isset($_POST['ajax']) && $_POST['ajax'] == 'edit-form') {
         $postData = PostUtil::getData();
         $readyToUsePostData = ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData($_POST[$postVariableName]);
         $sanitizedPostdata = PostUtil::sanitizePostByDesignerTypeForSavingModel($model, $readyToUsePostData);
         $sanitizedOwnerPostData = PostUtil::sanitizePostDataToJustHavingElementForSavingModel($sanitizedPostdata, 'owner');
         $sanitizedPostDataWithoutOwner = PostUtil::removeElementFromPostDataForSavingModel($sanitizedPostdata, 'owner');
         $model->setAttributes($sanitizedPostDataWithoutOwner);
         if ($model->validate()) {
             $modelToStringValue = strval($model);
             if ($sanitizedOwnerPostData != null) {
                 $model->setAttributes($sanitizedOwnerPostData);
             }
             if ($model instanceof OwnedSecurableItem) {
                 $model->validate(array('owner'));
             }
         }
         $wizardFormClassName = ReportToWizardFormAdapter::getFormClassNameByType(Report::TYPE_ROWS_AND_COLUMNS);
         if (!isset($postData[$wizardFormClassName])) {
             throw new NotSupportedException();
         }
         $report = SavedCalendarToReportAdapter::makeReportBySavedCalendar($model);
         DataToReportUtil::resolveFiltersStructure($postData[$wizardFormClassName], $report);
         DataToReportUtil::resolveFilters($postData[$wizardFormClassName], $report);
         //This would do the filter and filter structure validation
         $reportToWizardFormAdapter = new ReportToWizardFormAdapter($report);
         $reportForm = $reportToWizardFormAdapter->makeFormByType();
         $postData['validationScenario'] = $wizardFormClassName::FILTERS_VALIDATION_SCENARIO;
         $filtersErrorData = ReportUtil::validateReportWizardForm($postData, $reportForm);
         $errorData = ZurmoActiveForm::makeErrorsDataAndResolveForOwnedModelAttributes($model);
         $errorData = array_merge($errorData, $filtersErrorData);
         echo CJSON::encode($errorData);
         Yii::app()->end(0, false);
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:42,代码来源:DefaultController.php

示例6: testProjectSaveWithPermissions

 public function testProjectSaveWithPermissions()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $user = Yii::app()->user->userModel;
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $explicitReadWriteModelPermissions = new ExplicitReadWriteModelPermissions();
     $postData = array('name' => 'ProjectPermissionTest', 'description' => 'Test Description', 'owner' => array('id' => $user->id), 'explicitReadWriteModelPermissions' => array('type' => ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP, 'nonEveryoneGroup' => ''));
     $model = new Project();
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel($model, $postData);
     if ($model instanceof SecurableItem) {
         $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::resolveByPostDataAndModelThenMake($sanitizedPostData, $model);
     } else {
         $explicitReadWriteModelPermissions = null;
     }
     $readyToUseData = ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData($sanitizedPostData);
     $sanitizedOwnerData = PostUtil::sanitizePostDataToJustHavingElementForSavingModel($readyToUseData, 'owner');
     $sanitizedDataWithoutOwner = PostUtil::removeElementFromPostDataForSavingModel($readyToUseData, 'owner');
     $model->setAttributes($sanitizedDataWithoutOwner);
     if ($model->validate()) {
         $modelToStringValue = strval($model);
         if ($sanitizedOwnerData != null) {
             $model->setAttributes($sanitizedOwnerData);
         }
         if ($model instanceof OwnedSecurableItem) {
             $passedOwnerValidation = $model->validate(array('owner'));
         } else {
             $passedOwnerValidation = true;
         }
         if ($passedOwnerValidation && $model->save(false)) {
             if ($explicitReadWriteModelPermissions != null) {
                 $success = ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($model, $explicitReadWriteModelPermissions);
                 //todo: handle if success is false, means adding/removing permissions save failed.
             }
             $savedSuccessfully = true;
         }
     } else {
     }
     $this->assertEquals('ProjectPermissionTest', $model->name);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:39,代码来源:ProjectTest.php


注:本文中的ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。