本文整理汇总了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();
}
}
示例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'));
}
示例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();
}
}
示例4: actionDelete
public function actionDelete($id)
{
$contactWebForm = ContactWebForm::getById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($contactWebForm);
$contactWebForm->delete();
$this->redirect(array($this->getId() . '/index'));
}
示例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'));
}
示例6: actionDelete
public function actionDelete($id)
{
$campaign = static::getModelAndCatchNotFoundAndDisplayError('Campaign', intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($campaign);
$campaign->delete();
$this->redirect(array($this->getId() . '/index'));
}
示例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();
}
}
示例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();
}
}
}
示例9: actionDelete
public function actionDelete($id)
{
$gameReward = GameReward::GetById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($gameReward);
$gameReward->delete();
$this->redirect(array($this->getId() . '/index'));
}
示例10: actionDeleteSavedSearch
public function actionDeleteSavedSearch($id)
{
$savedSearch = SavedSearch::GetById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($savedSearch);
$savedSearch->delete();
}
示例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();
}
}
示例12: actionDeleteFromAjax
public function actionDeleteFromAjax($id)
{
$notification = Notification::GetById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($notification);
$notification->delete();
}
示例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();
}
}
示例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'));
}
示例15: actionCancelAssemblyStep2
public function actionCancelAssemblyStep2($id)
{
$costbook = Costbook::GetById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($costbook);
if (!$costbook->delete()) {
echo 0;
} else {
echo 1;
}
}