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


PHP SiteTree::batch_permission_check方法代码示例

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


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

示例1: can_publish_multiple

 static function can_publish_multiple($ids, $memberID, $useCached = true)
 {
     $checks = SiteTree::batch_permission_check($ids, $memberID, 'CanPublishType', 'SiteTree_PublisherGroups', 'canPublish', null, $useCached);
     return $checks;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-cmsworkflow,代码行数:5,代码来源:SiteTreeCMSThreeStepWorkflow.php

示例2: get_by_publisher

 /**
  * Get all publication requests assigned to a specific publisher
  * 
  * @param string $class WorkflowRequest subclass
  * @param Member $publisher
  * @param array $status One or more stati from the $Status property
  * @return DataObjectSet
  */
 public static function get_by_publisher($class, $publisher, $status = null)
 {
     // To ensure 2.3 and 2.4 compatibility
     $bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`";
     if ($status) {
         $statusStr = "'" . implode("','", $status) . "'";
     }
     $classes = (array) ClassInfo::subclassesFor($class);
     $classes[] = $class;
     $classesSQL = implode("','", $classes);
     // build filter
     $filter = "{$bt}WorkflowRequest{$bt}.{$bt}ClassName{$bt} IN ('{$classesSQL}')\n\t\t";
     if ($status) {
         $filter .= "AND {$bt}WorkflowRequest{$bt}.{$bt}Status{$bt} IN (" . $statusStr . ")";
     }
     $return = DataObject::get("SiteTree", $filter, "{$bt}SiteTree{$bt}.{$bt}LastEdited{$bt} DESC", "LEFT JOIN {$bt}WorkflowRequest{$bt} ON {$bt}WorkflowRequest{$bt}.{$bt}PageID{$bt} = {$bt}SiteTree{$bt}.{$bt}ID{$bt} " . "LEFT JOIN {$bt}WorkflowRequest_Approvers{$bt} ON {$bt}WorkflowRequest{$bt}.{$bt}ID{$bt} = {$bt}WorkflowRequest_Approvers{$bt}.{$bt}WorkflowRequestID{$bt}");
     if (!$return) {
         return new DataObjectSet();
     }
     $canPublish = SiteTree::batch_permission_check($return->column('ID'), $publisher->ID, 'CanPublishType', 'SiteTree_PublisherGroups', 'canPublish');
     foreach ($return as $page) {
         if (!isset($canPublish[$page->ID]) || !$canPublish[$page->ID]) {
             $return->remove($page);
         }
     }
     return $return;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-cmsworkflow,代码行数:35,代码来源:WorkflowTwoStepRequest.php

示例3: canPublish

 /**
  * This function should return true if the current user can publish this
  * page.
  *
  * @return boolean True if the current user can publish this page.
  */
 public function canPublish($member = null, $dbg = false)
 {
     if (!$member) {
         $member = Member::currentUser();
     }
     if (!$member) {
         return false;
     }
     if ($member instanceof Member) {
         $memberID = $member->ID;
     } else {
         $memberID = $member;
     }
     // can_publish_multiple will check the cache so this isn't necessary
     //if(isset(SiteTree::$cache_permissions['CanPublishType'][$this->owner->ID])) {
     //	return SiteTree::$cache_permissions['CanPublishType'][$this->owner->ID];
     //}
     // DANGER, WILL ROBINSON!
     // we currently have not implemented extensions here. if you do
     // be aware that the WorkflowRequest::get_by_* functions use
     // batch_permission_check directly so you will need to ammend
     // them appropriately
     // check for (workflow)admin permission
     if (Permission::checkMember($member, array('ADMIN', 'IS_WORKFLOW_ADMIN'))) {
         return true;
     }
     $results = SiteTree::batch_permission_check(array($this->owner->ID), $memberID, 'CanPublishType', 'SiteTree_PublisherGroups', 'canPublish');
     return isset($results[$this->owner->ID]) ? $results[$this->owner->ID] : false;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-cmsworkflow,代码行数:35,代码来源:SiteTreeCMSTwoStepWorkflow.php


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