當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel方法代碼示例

本文整理匯總了PHP中ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel方法的典型用法代碼示例。如果您正苦於以下問題:PHP ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel方法的具體用法?PHP ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel怎麽用?PHP ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ControllerSecurityUtil的用法示例。


在下文中一共展示了ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionDelete

 public function actionDelete($id)
 {
     $emailTemplate = static::getModelAndCatchNotFoundAndDisplayError('EmailTemplate', intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($emailTemplate);
     $type = $emailTemplate->type;
     $emailTemplate->delete();
     if ($type == EmailTemplate::TYPE_WORKFLOW) {
         $this->redirect(array($this->getId() . '/listForWorkflow'));
     } elseif ($emailTemplate->type == EmailTemplate::TYPE_CONTACT) {
         $this->redirect(array($this->getId() . '/listForMarketing'));
     } else {
         throw new NotSupportedException();
     }
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:14,代碼來源:DefaultController.php

示例2: actionDelete

 public function actionDelete($id)
 {
     $savedWorkflow = SavedWorkflow::GetById(intval($id));
     ControllerSecurityUtil::resolveCanCurrentUserAccessModule($savedWorkflow->moduleClassName);
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($savedWorkflow);
     $savedWorkflow->delete();
     $this->redirect(array($this->getId() . '/index'));
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:8,代碼來源:DefaultController.php

示例3: testResolveAccessCanCurrentUserDeleteModel

 /**
  * @depends testResolveAccessCanCurrentUserWriteModel
  */
 public function testResolveAccessCanCurrentUserDeleteModel()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $accounts = Account::getByName('Supermart');
     $this->assertEquals(1, count($accounts));
     $betty = User::getByUsername('betty');
     Yii::app()->user->userModel = $betty;
     $this->startOutputBuffer();
     try {
         ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($accounts[0], true);
         $this->endPrintOutputBufferAndFail();
     } catch (ExitException $e) {
         $content = $this->endAndGetOutputBuffer();
         $this->assertEquals('failure', $content);
     }
     $this->startOutputBuffer();
     try {
         ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($accounts[0], false);
         $this->endPrintOutputBufferAndFail();
     } catch (ExitException $e) {
         $compareString = 'You have tried to access a page you do not have access to';
         $this->assertContains($compareString, $this->endAndGetOutputBuffer());
     }
     $accounts = Account::getByName('BettyInc');
     $this->assertEquals(1, count($accounts));
     $account = $accounts[0];
     $this->startOutputBuffer();
     try {
         ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($account, true);
         ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($account, false);
         $content = $this->endAndGetOutputBuffer();
         $this->assertEquals(null, $content);
     } catch (ExitException $e) {
         $this->endPrintOutputBufferAndFail();
     }
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:39,代碼來源:ControllerSecurityUtilTest.php

示例4: actionDelete

 public function actionDelete($id)
 {
     $contactWebForm = ContactWebForm::getById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($contactWebForm);
     $contactWebForm->delete();
     $this->redirect(array($this->getId() . '/index'));
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:7,代碼來源:DefaultController.php

示例5: actionDelete

 public function actionDelete($id)
 {
     if (!Unitofmeasure::isUnitofmeasureInUseById(intval($id))) {
         $unitofmeasures = Unitofmeasure::GetById(intval($id));
         ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($unitofmeasures);
         $unitofmeasures->delete();
     } else {
         Yii::app()->user->setFlash('notification', Zurmo::t('ZurmoModule', 'Not possible to delete. Unit Of Measure is already in use'));
     }
     $this->redirect(array($this->getId() . '/index'));
 }
開發者ID:RamaKavanan,項目名稱:BaseVersion,代碼行數:11,代碼來源:DefaultController.php

示例6: actionDelete

 public function actionDelete($id)
 {
     $campaign = static::getModelAndCatchNotFoundAndDisplayError('Campaign', intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($campaign);
     $campaign->delete();
     $this->redirect(array($this->getId() . '/index'));
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:7,代碼來源:DefaultController.php

示例7: actionDelete

 public function actionDelete($id)
 {
     $emailTemplate = static::getModelAndCatchNotFoundAndDisplayError('EmailTemplate', intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($emailTemplate);
     $redirectUrl = null;
     if ($emailTemplate->isWorkflowTemplate()) {
         $redirectUrl = $this->getId() . '/listForWorkflow';
     } elseif ($emailTemplate->isContactTemplate()) {
         $redirectUrl = $this->getId() . '/listForMarketing';
     }
     $emailTemplate->delete();
     if (isset($redirectUrl)) {
         $this->redirect(array($redirectUrl));
     } else {
         throw new NotSupportedException();
     }
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:17,代碼來源:DefaultController.php

示例8: processCopyRelationsAndDeleteNonPrimaryModelsInMerge

 /**
  * Processes copying relations from non primary models to primary model and than deleting them
  * @param RedBeanModel $primaryModel
  * @param array $getData data from $_GET
  */
 public static function processCopyRelationsAndDeleteNonPrimaryModelsInMerge($primaryModel, $getData)
 {
     assert('$primaryModel instanceof RedBeanModel');
     assert('is_array($getData)');
     $modelClassName = get_class($primaryModel);
     $selectedModelsList = self::getSelectedModelsListForMerge($modelClassName, $getData);
     self::processAssignRelationsToMergedModelFromModelsToBeDeleted($selectedModelsList, $primaryModel);
     foreach ($selectedModelsList as $selectedModel) {
         if ($selectedModel->id != $primaryModel->id && get_class($selectedModel) == get_class($primaryModel)) {
             ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($selectedModel);
             $selectedModel->delete();
         }
     }
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:19,代碼來源:ListViewMergeUtil.php

示例9: actionDelete

 public function actionDelete($id)
 {
     $gameReward = GameReward::GetById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($gameReward);
     $gameReward->delete();
     $this->redirect(array($this->getId() . '/index'));
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:7,代碼來源:DefaultController.php

示例10: actionDeleteSavedSearch

 public function actionDeleteSavedSearch($id)
 {
     $savedSearch = SavedSearch::GetById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($savedSearch);
     $savedSearch->delete();
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:6,代碼來源:DefaultController.php

示例11: resolveDeleteAll

 public function resolveDeleteAll()
 {
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'owner', 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => Yii::app()->user->userModel->id));
     $searchAttributeData['structure'] = '1';
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('Notification');
     $where = RedBeanModelDataProvider::makeWhere('Notification', $searchAttributeData, $joinTablesAdapter);
     $models = Notification::getSubset($joinTablesAdapter, null, null, $where, null);
     foreach ($models as $model) {
         ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($model);
         $model->delete();
     }
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:12,代碼來源:NotificationMashableInboxRules.php

示例12: actionDeleteFromAjax

 public function actionDeleteFromAjax($id)
 {
     $notification = Notification::GetById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($notification);
     $notification->delete();
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:6,代碼來源:DefaultController.php

示例13: actionDelete

 /**
  * @param $id
  * @param null $redirectUrl
  * @throws FailedToDeleteModelException
  */
 public function actionDelete($id, $redirectUrl = null)
 {
     $task = Task::getById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($task);
     if (!$task->delete()) {
         throw new FailedToDeleteModelException();
     }
 }
開發者ID:KulturedKitsch,項目名稱:kulturedkitsch.info,代碼行數:13,代碼來源:DefaultController.php

示例14: actionDelete

 public function actionDelete($id)
 {
     if (!Category::isCategoryInUseById(intval($id))) {
         $category = Category::GetById(intval($id));
         ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($category);
         $category->delete();
     } else {
         Yii::app()->user->setFlash('notification', Zurmo::t('ZurmoModule', 'Not possible to delete. Category is already in use'));
     }
     $this->redirect(array($this->getId() . '/index'));
 }
開發者ID:RamaKavanan,項目名稱:BaseVersion,代碼行數:11,代碼來源:DefaultController.php

示例15: actionCancelAssemblyStep2

 public function actionCancelAssemblyStep2($id)
 {
     $costbook = Costbook::GetById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($costbook);
     if (!$costbook->delete()) {
         echo 0;
     } else {
         echo 1;
     }
 }
開發者ID:RamaKavanan,項目名稱:BaseVersion,代碼行數:10,代碼來源:DefaultController.php


注:本文中的ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。