本文整理汇总了PHP中ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel方法的典型用法代码示例。如果您正苦于以下问题:PHP ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel方法的具体用法?PHP ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel怎么用?PHP ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControllerSecurityUtil
的用法示例。
在下文中一共展示了ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionEdit
public function actionEdit($id, $redirectUrl = null)
{
$animal = Animal::getById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($animal);
$view = new AnimalsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($animal, $redirectUrl), 'Edit')));
echo $view->render();
}
示例2: actionEdit
public function actionEdit($id, $redirectUrl = null)
{
$modelClassName = $this->getModule()->getPrimaryModelName();
$activity = $modelClassName::getById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($activity);
$this->processEdit($activity, $redirectUrl);
}
示例3: actionInlineEditSave
/**
* Action for saving an existing note inline edit form.
* @param string or array $redirectUrl
*/
public function actionInlineEditSave($id, $redirectUrl = null)
{
$note = Note::getById((int) $id);
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($note);
if (isset($_POST['ajax']) && $_POST['ajax'] === 'inline-edit-form') {
$this->actionInlineEditValidate($note, 'Note');
}
$this->attemptToSaveModelFromPost($note, $redirectUrl);
}
示例4: actionCloseTask
public function actionCloseTask($id)
{
$task = Task::getById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($task);
$task->completedDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$task->completed = true;
$saved = $task->save();
if (!$saved) {
throw new NotSupportedException();
}
}
示例5: actionEdit
public function actionEdit($id)
{
//get boject by id
$category = Category::getById(intval($id));
//Security check
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($category);
//create view and render
$editAndDetailsView = $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($category), 'Edit');
$view = new CategoriesPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $editAndDetailsView));
echo $view->render();
}
示例6: actionEdit
public function actionEdit($id)
{
$contactWebForm = static::getModelAndCatchNotFoundAndDisplayError('ContactWebForm', intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($contactWebForm);
$modelClassName = $this->getModule()->getPrimaryModelName();
$breadCrumbTitle = Zurmo::t('ContactWebFormsModule', 'Edit Web Form');
$breadcrumbLinks = array($breadCrumbTitle);
if ($contactWebForm->language === null) {
$contactWebForm->language = Yii::app()->language;
}
if (isset($_POST[$modelClassName])) {
unset($_POST[$modelClassName]['serializedData']);
$contactWebForm->serializedData = serialize($_POST['attributeIndexOrDerivedType']);
}
$titleBarAndEditView = $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($contactWebForm), 'Edit');
$view = new ContactWebFormsPageView(ZurmoDefaultAdminViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $titleBarAndEditView, $breadcrumbLinks, 'ContactWebFormsBreadCrumbView'));
echo $view->render();
}
示例7: actionEdit
public function actionEdit($id, $redirectUrl = null)
{
Yii::app()->clientScript->registerScript('productcode', '$("label[for=Costbook_departmentreference_id]").append("<span class=required> * </span>");
$("label[for=Costbook_costperunit]").append("<span class=required> * </span>");
$("label[for=Costbook_unitofmeasure_value]").append("<span class=required> * </span>");
');
//get boject by id
$costbook = Costbook::getById(intval($id));
//Security check
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($costbook);
//create view and render
if ($costbook->costofgoodssold == 'Labor') {
$view = new CostbookPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, new CostbookLaborView('Edit', $this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($costbook, $redirectUrl), 'Edit')));
} else {
if ($costbook->costofgoodssold == 'Equipment') {
$view = new CostbookPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, new CostbookEquipmentView('Edit', $this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($costbook, $redirectUrl), 'Edit')));
} else {
if ($costbook->costofgoodssold == 'Material') {
$view = new CostbookPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, new CostbookMaterialView('Edit', $this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($costbook, $redirectUrl), 'Edit')));
} else {
if ($costbook->costofgoodssold == 'Subcontractor') {
$view = new CostbookPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, new CostbookSubcontractorView('Edit', $this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($costbook, $redirectUrl), 'Edit')));
} else {
if ($costbook->costofgoodssold == 'Other') {
$view = new CostbookPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, new CostbookOtherView('Edit', $this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($costbook, $redirectUrl), 'Edit')));
} else {
if ($costbook->costofgoodssold == 'Assembly') {
$view = new CostbookPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, new CostbookAssemblyView('Edit', $this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($costbook, $redirectUrl), 'Edit')));
}
}
}
}
}
}
echo $view->render();
}
示例8: actionEdit
public function actionEdit($id, $redirectUrl = null)
{
$emailTemplate = static::getModelAndCatchNotFoundAndDisplayError('EmailTemplate', intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($emailTemplate);
$editAndDetailsView = $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($emailTemplate, $redirectUrl), 'Edit');
if ($emailTemplate->type == EmailTemplate::TYPE_WORKFLOW) {
$breadcrumbLinks = static::getDetailsAndEditForWorkflowBreadcrumbLinks();
$breadcrumbLinks[] = StringUtil::getChoppedStringContent(strval($emailTemplate), 25);
$view = new EmailTemplatesPageView(WorkflowDefaultAdminViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $editAndDetailsView, $breadcrumbLinks, 'WorkflowBreadCrumbView'));
} elseif ($emailTemplate->type == EmailTemplate::TYPE_CONTACT) {
$breadcrumbLinks = static::getDetailsAndEditForMarketingBreadcrumbLinks();
$breadcrumbLinks[] = StringUtil::getChoppedStringContent(strval($emailTemplate), 25);
$view = new EmailTemplatesPageView(MarketingDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $editAndDetailsView, $breadcrumbLinks, 'MarketingBreadCrumbView'));
} else {
throw new NotSupportedException();
}
echo $view->render();
}
示例9: resolveReportBySavedCalendarPostData
/**
* Resolve report by saved calendar post data.
* @param string $type
* @param int $id
* @param array $postData
* @return Report
*/
public static function resolveReportBySavedCalendarPostData($type, $id = null, $postData)
{
assert('is_string($type)');
assert('is_array($postData)');
if ($id == null) {
$report = new Report();
$report->setType($type);
} else {
$savedCalendar = SavedCalendar::getById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($savedCalendar);
$report = SavedCalendarToReportAdapter::makeReportBySavedCalendar($savedCalendar);
}
if (isset($postData['SavedCalendar']) && isset($postData['SavedCalendar']['moduleClassName'])) {
$report->setModuleClassName($postData['SavedCalendar']['moduleClassName']);
} else {
throw new NotSupportedException();
}
DataToReportUtil::resolveReportByWizardPostData($report, $postData, ReportToWizardFormAdapter::getFormClassNameByType($type));
return $report;
}
示例10: actionUpdate
public function actionUpdate($id, $attribute, $item, $value)
{
assert('$id != null && $id != ""');
assert('$attribute != null && $attribute != ""');
assert('$item != null && $item != ""');
$id = intval($id);
$item = intval($item);
$import = Import::getById($id);
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($import);
ImportDatabaseUtil::updateRowValue($import->getTempTableName(), $item, $attribute, $value);
}
示例11: actionEdit
public function actionEdit($id, $redirectUrl = null)
{
$opportunity = Opportunity::getById(intval($id));
$getaccount = Account::getById(intval($opportunity->account->id));
$_SESSION['unitsCstmCstm'] = !empty($getaccount->unitsCstmCstm) ? $getaccount->unitsCstmCstm : 1;
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($opportunity);
$this->processEdit($opportunity, $redirectUrl);
}
示例12: actionEdit
public function actionEdit($id)
{
$marketingList = MarketingList::getById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($marketingList);
$breadCrumbLinks = static::getDetailsAndEditBreadcrumbLinks();
$breadCrumbLinks[] = StringUtil::getChoppedStringContent(strval($marketingList), 25);
$editView = new MarketingListEditView($this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($marketingList), strval($marketingList));
$view = new MarketingListsPageView(MarketingDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $editView, $breadCrumbLinks, 'MarketingBreadCrumbView'));
echo $view->render();
}
示例13: actionEdit
public function actionEdit($id, $redirectUrl = null)
{
$opportunity = Opportunity::getById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($opportunity);
$this->processEdit($opportunity, $redirectUrl);
}
示例14: actionConvertFinal
public function actionConvertFinal($id)
{
assert('!empty($id)');
$accountPostData = LeadsUtil::getFromSession(LeadsUtil::LEAD_CONVERSION_ACCOUNT_DATA_SESSION_KEY);
if (empty($accountPostData)) {
$urlParams = array('/leads/' . $this->getId() . '/convert', 'id' => $id);
$this->redirect($urlParams);
}
$contact = Contact::getById(intval($id));
if (!LeadsUtil::isStateALead($contact->state)) {
$urlParams = array('/contacts/' . $this->getId() . '/details', 'id' => $contact->id);
$this->redirect($urlParams);
}
$convertToAccountSetting = LeadsModule::getConvertToAccountSetting();
$convertToOpportunitySetting = LeadsModule::getConvertToOpportunitySetting();
$opportunity = new Opportunity();
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($contact);
$userCanAccessContacts = RightsUtil::canUserAccessModule('ContactsModule', Yii::app()->user->userModel);
$userCanAccessAccounts = RightsUtil::canUserAccessModule('AccountsModule', Yii::app()->user->userModel);
$userCanAccessOpportunities = RightsUtil::canUserAccessModule('OpportunitiesModule', Yii::app()->user->userModel);
$userCanCreateOpportunity = RightsUtil::doesUserHaveAllowByRightName('OpportunitiesModule', OpportunitiesModule::RIGHT_CREATE_OPPORTUNITIES, Yii::app()->user->userModel);
LeadsControllerSecurityUtil::resolveCanUserProperlyConvertLead($userCanAccessContacts, $userCanAccessAccounts, $convertToAccountSetting);
LeadsControllerSecurityUtil::resolveCanUserProperlyConvertLeadFinalStep($userCanAccessContacts, $userCanAccessOpportunities, $convertToOpportunitySetting);
if (isset($_POST['Opportunity'])) {
$controllerUtil = static::getZurmoControllerUtil();
$savedSuccessfully = false;
$modelToStringValue = null;
$postData = $_POST['Opportunity'];
$opportunity = $controllerUtil->saveModelFromPost($postData, $opportunity, $savedSuccessfully, $modelToStringValue, false);
if ($savedSuccessfully) {
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($contact);
ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($opportunity, $explicitReadWriteModelPermissions);
$account = LeadsUtil::createAccountForLeadConversionFromAccountPostData($accountPostData, $contact, $controllerUtil);
$opportunity->account = $account;
if (!$opportunity->save()) {
throw new NotSupportedException();
}
LeadsUtil::removeFromSession(LeadsUtil::LEAD_CONVERSION_ACCOUNT_DATA_SESSION_KEY);
$this->actionSaveConvertedContact($contact, $account, $opportunity);
}
} elseif (isset($_POST['OpportunitySkip']) || $convertToOpportunitySetting == LeadsModule::CONVERT_NO_OPPORTUNITY || $convertToOpportunitySetting == LeadsModule::CONVERT_OPPORTUNITY_NOT_REQUIRED && !$userCanAccessOpportunities) {
$controllerUtil = static::getZurmoControllerUtil();
$account = LeadsUtil::createAccountForLeadConversionFromAccountPostData($accountPostData, $contact, $controllerUtil);
LeadsUtil::removeFromSession(LeadsUtil::LEAD_CONVERSION_ACCOUNT_DATA_SESSION_KEY);
$this->actionSaveConvertedContact($contact, $account, null);
}
$progressBarAndStepsView = new LeadConversionStepsAndProgressBarForWizardView(1);
$convertView = new LeadConvertOpportunityView($this->getId(), $this->getModule()->getId(), $contact->id, strval($contact), $opportunity, $convertToOpportunitySetting, $userCanCreateOpportunity);
$view = new LeadsPageView(ZurmoDefaultViewUtil::makeTwoStandardViewsForCurrentUser($this, $progressBarAndStepsView, $convertView));
echo $view->render();
}
示例15: actionEditDashboard
/**
* Only supports saving 4 layoutTypes (max 2 column)
*
*/
public function actionEditDashboard($id)
{
$id = intval($id);
$dashboard = Dashboard::getById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($dashboard);
if (isset($_POST['Dashboard'])) {
$oldLayoutType = $dashboard->layoutType;
$_POST['Dashboard'] = PostUtil::sanitizePostByDesignerTypeForSavingModel($dashboard, $_POST['Dashboard']);
$dashboard->setAttributes($_POST['Dashboard']);
assert('in_array($dashboard->layoutType, array_keys(Dashboard::getLayoutTypesData()))');
if ($dashboard->save()) {
if ($oldLayoutType != $dashboard->layoutType && $dashboard->layoutType == '100') {
$uniqueLayoutId = 'HomeDashboard' . $dashboard->layoutId;
$portletCollection = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition($uniqueLayoutId, Yii::app()->user->userModel->id, array());
Portlet::shiftPositionsBasedOnColumnReduction($portletCollection, 1);
}
GeneralCache::forgetAll();
//Ensure menu refreshes
$this->redirect(array('default/dashboardDetails', 'id' => $dashboard->id));
}
}
$editView = new DashboardEditView($this->getId(), $this->getModule()->getId(), $dashboard, strval($dashboard));
$view = new AccountsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $editView));
echo $view->render();
}