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


PHP ControllerSecurityUtil类代码示例

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


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

示例1: groupTasksByKanbanTypeAndGetStats

 /**
  * Group tasks by kanban type and get stats
  * @param Project $project
  * @return array
  */
 protected static function groupTasksByKanbanTypeAndGetStats(Project $project)
 {
     $tasks = $project->tasks;
     $kanbanItemsArray = array();
     $totalTasksToDoCount = 0;
     $completedTasksCount = 0;
     foreach ($tasks as $task) {
         if (ControllerSecurityUtil::doesCurrentUserHavePermissionOnSecurableItem($task, Permission::READ)) {
             $totalTasksToDoCount++;
             if ($task->status == Task::STATUS_COMPLETED) {
                 $completedTasksCount++;
             }
             $kanbanItem = KanbanItem::getByTask($task->id);
             if ($kanbanItem == null) {
                 //Create KanbanItem here
                 $kanbanItem = TasksUtil::createKanbanItemFromTask($task);
             }
             $kanbanItemsArray[$kanbanItem->type][] = $kanbanItem->id;
         }
     }
     $stats = array();
     $kanbanTypeDropDownData = KanbanItem::getTypeDropDownArray();
     foreach ($kanbanTypeDropDownData as $type => $label) {
         if (isset($kanbanItemsArray[$type])) {
             $stats[$type] = count($kanbanItemsArray[$type]);
         } else {
             $stats[$type] = 0;
         }
     }
     $stats['completionPercent'] = static::resolveCompletionPercentage($completedTasksCount, $totalTasksToDoCount);
     return $stats;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:37,代码来源:DashboardActiveProjectListViewColumnAdapter.php

示例2: renderContent

 public function renderContent()
 {
     $accessContent = $this->resolveContentIfCurrentUserCanAccessChartByModule('OpportunitiesModule', 'OpportunitiesModulePluralLabel');
     if ($accessContent != null) {
         return $accessContent;
     }
     $chartDataProviderType = $this->getChartDataProviderType();
     $chartDataProvider = ChartDataProviderFactory::createByType($chartDataProviderType);
     ControllerSecurityUtil::resolveCanCurrentUserAccessModule($chartDataProvider->getModel()->getModuleClassName(), true);
     $chartData = $chartDataProvider->getChartData();
     Yii::import('ext.amcharts.AmChartMaker');
     $amChart = new AmChartMaker();
     $amChart->data = $chartData;
     $amChart->id = $this->uniqueLayoutId;
     $amChart->type = $this->resolveViewAndMetadataValueByName('type');
     $amChart->addSerialGraph('value', 'column');
     $amChart->xAxisName = $chartDataProvider->getXAxisName();
     $amChart->yAxisName = $chartDataProvider->getYAxisName();
     $amChart->yAxisUnitContent = Yii::app()->locale->getCurrencySymbol(Yii::app()->currencyHelper->getCodeForCurrentUserForDisplay());
     $javascript = $amChart->javascriptChart();
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->uniqueLayoutId, $javascript);
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("Chart");
     $cClipWidget->widget('application.core.widgets.AmChart', array('id' => $this->uniqueLayoutId));
     $cClipWidget->endClip();
     return $cClipWidget->getController()->clips['Chart'];
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:27,代码来源:OpportunitiesBySourceChartView.php

示例3: resolveHtmlByEmailTemplateModel

 /**
  * Resolve html for a builder template provided the model itself.
  * @param EmailTemplate $emailTemplate
  * @param bool $renderForCanvas
  * @param OwnedSecurableItem $attachedMergeTagModel
  * @return bool|null|string
  */
 public static function resolveHtmlByEmailTemplateModel(EmailTemplate $emailTemplate, $renderForCanvas = false, OwnedSecurableItem $attachedMergeTagModel = null)
 {
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($emailTemplate);
     $serializedData = $emailTemplate->serializedData;
     $resolvedHtml = static::resolveHtmlBySerializedData($serializedData, $renderForCanvas, $attachedMergeTagModel, $emailTemplate->type, $emailTemplate->language);
     return $resolvedHtml;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:14,代码来源:EmailTemplateSerializedDataToHtmlUtil.php

示例4: resolveHtmlByEmailTemplateModel

 /**
  * Resolve html for a builder template provided the model itself.
  * @param EmailTemplate $emailTemplate
  * @param bool $renderForCanvas
  * @return bool|null|string
  */
 public static function resolveHtmlByEmailTemplateModel(EmailTemplate $emailTemplate, $renderForCanvas = false)
 {
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($emailTemplate);
     $serializedData = $emailTemplate->serializedData;
     $resolvedHtml = static::resolveHtmlBySerializedData($serializedData, $renderForCanvas);
     return $resolvedHtml;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:13,代码来源:EmailTemplateSerializedDataToHtmlUtil.php

示例5: 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);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:13,代码来源:DefaultController.php

示例6: actionDetails

 public function actionDetails($id)
 {
     $deptReference = static::getModelAndCatchNotFoundAndDisplayError('DepartmentReference', intval($id));
     $breadCrumbView = StickySearchUtil::resolveBreadCrumbViewForDetailsControllerAction($this, 'DepartmentReferencesSearchView', $deptReference);
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($deptReference);
     AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($deptReference), 'DepartmentReferencesModule'), $deptReference);
     $titleBarAndEditView = $this->makeEditAndDetailsView($deptReference, 'Details');
     $view = new DepartmentReferencesPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $titleBarAndEditView));
     echo $view->render();
 }
开发者ID:RamaKavanan,项目名称:BaseVersion,代码行数:10,代码来源:DefaultController.php

示例7: 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();
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:11,代码来源:DefaultController.php

示例8: renderTotalBarDetails

 /**
  * Render totals in a product portlet view
  */
 protected function renderTotalBarDetails()
 {
     $persistantProductConfigItemValue = ProductsPortletPersistentConfigUtil::getForCurrentUserByPortletIdAndKey($this->params['portletId'], 'filteredByStage');
     $relationModelClassName = get_class($this->params["relationModel"]);
     $relationModelId = $this->params["relationModel"]->id;
     $relationModel = $relationModelClassName::getById($relationModelId);
     $models = $relationModel->products;
     $oneTimeTotal = 0;
     $monthlyTotal = 0;
     $annualTotal = 0;
     foreach ($models as $model) {
         if (ControllerSecurityUtil::doesCurrentUserHavePermissionOnSecurableItem($model, Permission::READ)) {
             if ($persistantProductConfigItemValue === null) {
                 $persistantProductConfigItemValue = ProductsConfigurationForm::FILTERED_BY_ALL_STAGES;
             }
             if ($persistantProductConfigItemValue != ProductsConfigurationForm::FILTERED_BY_ALL_STAGES) {
                 if ($model->stage->value != $persistantProductConfigItemValue) {
                     continue;
                 }
             }
             if ($model->priceFrequency == ProductTemplate::PRICE_FREQUENCY_ONE_TIME) {
                 $oneTimeTotal += $this->getAdjustedTotalByCurrency($model);
             }
             if ($model->priceFrequency == ProductTemplate::PRICE_FREQUENCY_MONTHLY) {
                 $monthlyTotal += $this->getAdjustedTotalByCurrency($model);
             }
             if ($model->priceFrequency == ProductTemplate::PRICE_FREQUENCY_ANNUALLY) {
                 $annualTotal += $this->getAdjustedTotalByCurrency($model);
             }
         }
     }
     $content = Zurmo::t("Core", "Total: ");
     $contentArray = array();
     if ($oneTimeTotal > 0) {
         $contentArray[] = Yii::app()->numberFormatter->formatCurrency($oneTimeTotal, Yii::app()->currencyHelper->getCodeForCurrentUserForDisplay()) . Zurmo::t("Core", " One Time");
     }
     if ($monthlyTotal > 0) {
         $contentArray[] = Yii::app()->numberFormatter->formatCurrency($monthlyTotal, Yii::app()->currencyHelper->getCodeForCurrentUserForDisplay()) . Zurmo::t("Core", " Monthly");
     }
     if ($annualTotal > 0) {
         $contentArray[] = Yii::app()->numberFormatter->formatCurrency($annualTotal, Yii::app()->currencyHelper->getCodeForCurrentUserForDisplay()) . Zurmo::t("Core", " Annually");
     }
     if (empty($contentArray)) {
         $content = '';
     } else {
         $content .= implode(', ', $contentArray);
     }
     echo $content;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:52,代码来源:ProductPortletExtendedGridView.php

示例9: actionDetails

 public function actionDetails($id, $runReport = false)
 {
     $savedReport = SavedReport::getById((int) $id);
     ControllerSecurityUtil::resolveCanCurrentUserAccessModule($savedReport->moduleClassName);
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($savedReport, true);
     $report = SavedReportToReportAdapter::makeReportBySavedReport($savedReport);
     $portlet = Portlet::getById(intval($_GET['portletId']));
     $portlet->params = array('controllerId' => 'default', 'relationModuleId' => $this->getModule()->getId(), 'relationModel' => $report, 'redirectUrl' => Yii::app()->request->getRequestUri(), 'dataProvider' => $this->getDataProvider($report, $report->getId(), (bool) $runReport));
     $portletView = $portlet->getView();
     if (!RightsUtil::canUserAccessModule($portletView::getModuleClassName(), Yii::app()->user->userModel)) {
         $messageView = new AccessFailureView();
         $view = new AccessFailurePageView($messageView);
         echo $view->render();
         Yii::app()->end(0, false);
     }
     $view = new AjaxPageView($portletView);
     echo $view->render();
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:18,代码来源:DefaultPortletController.php

示例10: actionSendTestEmail

 public function actionSendTestEmail($id, $contactId = null, $emailAddress = null, $useHtmlContent = 1)
 {
     $emailTemplate = EmailTemplate::getById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($emailTemplate);
     $htmlContent = $emailTemplate->htmlContent;
     if (!$useHtmlContent) {
         $htmlContent = EmailTemplateSerializedDataToHtmlUtil::resolveHtmlByEmailTemplateModel($emailTemplate, false);
     }
     $contact = null;
     if (isset($contactId)) {
         $contact = Contact::getById(intval($contactId));
     }
     static::resolveEmailMessage($emailTemplate, $contact, $htmlContent, $emailAddress);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:14,代码来源:DefaultController.php

示例11: actionDelete

 /**
  * @param $id
  * @param null $redirectUrl
  */
 public function actionDelete($id, $redirectUrl = null)
 {
     if ($redirectUrl == null) {
         $redirectUrl = array('/home/default');
     }
     $modelClassName = $this->getModule()->getPrimaryModelName();
     $activity = $modelClassName::getById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($activity);
     $activity->delete();
     $this->redirect($redirectUrl);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:15,代码来源:ActivityModelsDefaultController.php

示例12: actionGetAccountAddressesToCopy

 public function actionGetAccountAddressesToCopy($id)
 {
     $account = static::getModelAndCatchNotFoundAndDisplayError('Account', intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($account);
     $addressData = array();
     foreach ($account->billingAddress->getAttributeNames() as $attribute) {
         $addressData['billingAddress_' . $attribute] = $account->billingAddress->{$attribute};
     }
     foreach ($account->shippingAddress->getAttributeNames() as $attribute) {
         $addressData['shippingAddress_' . $attribute] = $account->shippingAddress->{$attribute};
     }
     echo CJSON::encode($addressData);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:13,代码来源:DefaultController.php

示例13: 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

示例14: resolveAfterSaveHasPermissionsProblem

 protected function resolveAfterSaveHasPermissionsProblem(SavedReport $savedReport, $modelToStringValue)
 {
     assert('is_string($modelToStringValue)');
     if (ControllerSecurityUtil::doesCurrentUserHavePermissionOnSecurableItem($savedReport, Permission::READ)) {
         return false;
     } else {
         $notificationContent = Zurmo::t('ZurmoModule', 'You no longer have permissions to access {modelName}.', array('{modelName}' => $modelToStringValue));
         Yii::app()->user->setFlash('notification', $notificationContent);
         return true;
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:11,代码来源:DefaultController.php

示例15: actionDelete

 public function actionDelete($id)
 {
     $animal = Animal::GetById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($animal);
     $animal->delete();
     $this->redirect(array($this->getId() . '/index'));
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:7,代码来源:DefaultController.php


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