• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ControllerSecurityUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: actionUnlink

 public function actionUnlink($id)
 {
     $relationModelClassName = ArrayUtil::getArrayValue(GetUtil::getData(), 'relationModelClassName');
     $relationModelId = ArrayUtil::getArrayValue(GetUtil::getData(), 'relationModelId');
     $relationModelRelationName = ArrayUtil::getArrayValue(GetUtil::getData(), 'relationModelRelationName');
     if ($relationModelClassName == null || $relationModelId == null || $relationModelRelationName == null) {
         throw new NotSupportedException();
     }
     $relationModel = $relationModelClassName::GetById(intval($relationModelId));
     if ($relationModel->getRelationType($relationModelRelationName) != RedBeanModel::HAS_MANY && $relationModel->getRelationType($relationModelRelationName) != RedBeanModel::MANY_MANY) {
         throw new NotSupportedException();
     }
     $modelClassName = $relationModel->getRelationModelClassName($relationModelRelationName);
     $model = $modelClassName::getById((int) $id);
     ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($model);
     ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($relationModel);
     $relationModel->{$relationModelRelationName}->remove($model);
     $saved = $relationModel->save();
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:22,代码来源:ZurmoModuleController.php


示例17: actionDelete

 public function actionDelete($id)
 {
     $contact = Contact::GetById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserDeleteModel($contact);
     if (!LeadsUtil::isStateALead($contact->state)) {
         $urlParams = array('/contacts/' . $this->getId() . '/delete', 'id' => $contact->id);
         $this->redirect($urlParams);
     } else {
         $contact->delete();
         $this->redirect(array($this->getId() . '/index'));
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:12,代码来源:DefaultController.php


示例18: actionCopy

 /**
  * Copies the product
  * @param int $id
  */
 public function actionCopy($id)
 {
     $copyToProduct = new Product();
     $postVariableName = get_class($copyToProduct);
     if (!isset($_POST[$postVariableName])) {
         $product = Product::getById((int) $id);
         ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($product);
         ProductZurmoCopyModelUtil::copy($product, $copyToProduct);
     }
     $this->processEdit($copyToProduct);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:15,代码来源:DefaultController.php


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


示例20: actionUsersInGroupModalList

 public function actionUsersInGroupModalList($id)
 {
     $model = Group::getById((int) $id);
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($model);
     $searchAttributeData = UsersByModelModalListControllerUtil::makeModalSearchAttributeDataByModel($model, 'groups');
     $dataProvider = UsersByModelModalListControllerUtil::makeDataProviderBySearchAttributeData($searchAttributeData);
     Yii::app()->getClientScript()->setToAjaxMode();
     echo UsersByModelModalListControllerUtil::renderList($this, $dataProvider, 'usersInGroupModalList');
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:9,代码来源:GroupController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ControllerTestCase类代码示例发布时间:2022-05-23
下一篇:
PHP ControllerFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap