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


PHP Permission::userHasFolderReadPermission方法代码示例

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


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

示例1: getLinkingEntities

 /**
  * Fetch any linked folders
  *
  * @param Folder array $aFolderList
  * @return unknown
  */
 function getLinkingEntities($aFolderList)
 {
     $aSearchFolders = array();
     if (!empty($aFolderList)) {
         foreach ($aFolderList as $oFolderItem) {
             if (Permission::userHasFolderReadPermission($oFolderItem)) {
                 // If it is a shortcut, we should do some more searching
                 if ($oFolderItem->isSymbolicLink()) {
                     $oFolderItem = $oFolderItem->getLinkedFolder();
                     $aSearchFolders[] = $oFolderItem->getID();
                 }
             }
         }
     }
     $aLinkingFolders = array();
     $aSearchCompletedFolders = array();
     $count = 0;
     while (count($aSearchFolders) > 0) {
         $count++;
         $oFolder = Folder::get(array_pop($aSearchFolders));
         $folderId = $oFolder->getId();
         // Get all the folders within the current folder
         $sWhereClause = "parent_folder_ids = '{$folderId}' OR\n            parent_folder_ids LIKE '{$folderId},%' OR\n            parent_folder_ids LIKE '%,{$folderId},%' OR\n            parent_folder_ids LIKE '%,{$folderId}'";
         $aFolderList = $this->oFolder->getList($sWhereClause);
         foreach ($aFolderList as $oFolderItem) {
             if ($oFolderItem->isSymbolicLink()) {
                 $oFolderItem = $oFolderItem->getLinkedFolder();
             }
             if (Permission::userHasFolderReadPermission($oFolderItem)) {
                 if ($aSearchCompletedFolders[$oFolderItem->getID()] != true) {
                     $aSearchFolders[] = $oFolderItem->getID();
                     $aSearchCompletedFolders[$oFolderItem->getID()] = true;
                 }
             }
         }
         if (!isset($aLinkingFolders[$oFolder->getId()])) {
             $aLinkingFolders[$oFolder->getId()] = $oFolder;
         }
     }
     return $aLinkingFolders;
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:47,代码来源:compressionArchiveUtil.inc.php

示例2: validateFolderPermissions

 function validateFolderPermissions($iUserId, $iFolderId)
 {
     // check if user id is in session. If not, set it
     if (!isset($_SESSION["userID"])) {
         $_SESSION['userID'] = $iUserId;
     }
     // get folder object
     $oFolder = Folder::get($iFolderId);
     if (PEAR::isError($oFolder)) {
         return false;
     }
     // check permissions for folder
     if (Permission::userHasFolderReadPermission($oFolder)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:18,代码来源:KTrss.inc.php

示例3: getFolder

 public static function getFolder($folderID, $userid)
 {
     $folder = Folder::get($folderID + 0);
     if (PEAR::isError($folder)) {
         return $folder;
     }
     if (!Permission::userHasFolderReadPermission($folder)) {
         return new PEAR_Error(_kt('no permission to read folder'));
     }
     $sql = "SELECT id, name FROM folders WHERE parent_id={$folderID} ORDER BY name";
     $rs = DBUtil::getResultArray($sql);
     if (PEAR::isError($rs)) {
         return $rs;
     }
     $folders = array();
     foreach ($rs as $folder) {
         $fobj = Folder::get($folder['id']);
         if (Permission::userHasFolderReadPermission($fobj)) {
             $folders[] = $folder;
         }
     }
     return $folders;
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:23,代码来源:search.inc.php

示例4: perform_action

 function perform_action($oEntity)
 {
     // checkout document
     $sReason = $this->sReason;
     if (is_a($oEntity, 'Document')) {
         if ($oEntity->getImmutable()) {
             return PEAR::raiseError($oEntity->getName() . ': ' . _kt('Document cannot be checked out as it is immutable'));
         }
         if ($oEntity->getIsCheckedOut()) {
             $checkedOutUser = $oEntity->getCheckedOutUserID();
             $sUserId = $_SESSION['userID'];
             if ($checkedOutUser != $sUserId) {
                 $oCheckedOutUser = User::get($checkedOutUser);
                 return PEAR::raiseError($oEntity->getName() . ': ' . _kt('Document has already been checked out by ') . $oCheckedOutUser->getName());
             }
         } else {
             $res = KTDocumentUtil::checkout($oEntity, $sReason, $this->oUser);
             if (PEAR::isError($res)) {
                 return PEAR::raiseError($oEntity->getName() . ': ' . $res->getMessage());
             }
         }
         if ($this->bDownload) {
             if ($this->bNoisy) {
                 $oDocumentTransaction = new DocumentTransaction($oEntity, "Document part of bulk checkout", 'ktstandard.transactions.check_out', array());
                 $oDocumentTransaction->create();
             }
             $oKTTriggerRegistry = KTTriggerRegistry::getSingleton();
             $aTriggers = $oKTTriggerRegistry->getTriggers('checkoutDownload', 'postValidate');
             foreach ($aTriggers as $aTrigger) {
                 $sTrigger = $aTrigger[0];
                 $oTrigger = new $sTrigger();
                 $aInfo = array('document' => $oEntity);
                 $oTrigger->setInfo($aInfo);
                 $ret = $oTrigger->postValidate();
                 if (PEAR::isError($ret)) {
                     return $ret;
                 }
             }
             $this->oZip->addDocumentToZip($oEntity);
         }
     } else {
         if (is_a($oEntity, 'Folder')) {
             // get documents and subfolders
             $aDocuments = array();
             $oFolder = $oEntity;
             if ($oFolder->isSymbolicLink()) {
                 $oFolder = $oFolder->getLinkedFolder();
             }
             $sFolderId = $oFolder->getId();
             $sFolderDocs = $oFolder->getDocumentIDs($sFolderId);
             // get documents directly in the folder
             if (!empty($sFolderDocs)) {
                 $aDocuments = explode(',', $sFolderDocs);
             }
             // Get all the folders within the current folder
             $sWhereClause = "parent_folder_ids = '{$sFolderId}' OR\n            parent_folder_ids LIKE '{$sFolderId},%' OR\n            parent_folder_ids LIKE '%,{$sFolderId},%' OR\n            parent_folder_ids LIKE '%,{$sFolderId}'";
             $aFolderList = $this->oFolder->getList($sWhereClause);
             $aLinkingFolders = $this->getLinkingEntities($aFolderList);
             $aFolderList = array_merge($aFolderList, $aLinkingFolders);
             $aFolderObjects = array();
             $aFolderObjects[$sFolderId] = $oFolder;
             // Get the documents within the folder
             if (!empty($aFolderList)) {
                 foreach ($aFolderList as $k => $oFolderItem) {
                     if (Permission::userHasFolderReadPermission($oFolderItem)) {
                         // Get documents for each folder
                         if ($oFolderItem->isSymbolicLink()) {
                             $oFolderItem = $oFolderItem->getLinkedFolder();
                         }
                         $sFolderItemId = $oFolderItem->getID();
                         $sFolderItemDocs = $oFolderItem->getDocumentIDs($sFolderItemId);
                         if (!empty($sFolderItemDocs)) {
                             $aFolderDocs = explode(',', $sFolderItemDocs);
                             $aDocuments = array_merge($aDocuments, $aFolderDocs);
                         }
                         // Add the folder to the zip file
                         if ($this->bDownload) {
                             $this->oZip->addFolderToZip($oFolderItem);
                             $aFolderObjects[$oFolderItem->getId()] = $oFolderItem;
                         }
                     }
                 }
             }
             // Checkout each document within the folder structure
             if (!empty($aDocuments)) {
                 foreach ($aDocuments as $sDocId) {
                     $oDocument = Document::get($sDocId);
                     if (PEAR::isError($oDocument)) {
                         // add message, skip document and continue
                         $this->addErrorMessage($oDocument->getName() . ': ' . $oDocument->getMessage());
                         continue;
                     }
                     if ($oDocument->isSymbolicLink()) {
                         $oDocument->switchToLinkedCore();
                     }
                     if ($oDocument->getImmutable()) {
                         $this->addErrorMessage($oDocument->getName() . ': ' . _kt('Document cannot be checked out as it is immutable'));
                         continue;
                     }
                     // Check if the action is restricted by workflow on the document
//.........这里部分代码省略.........
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:101,代码来源:KTBulkActions.php

示例5: get_permission_string

 /**
  * Get's a permission string for a folder eg: 'RW' or 'RWA'
  *
  * @author KnowledgeTree Team
  * @access public
  * @param Folder $folder
  * @return string
  */
 function get_permission_string($folder)
 {
     $perms = '';
     if (Permission::userHasFolderReadPermission($folder)) {
         $perms .= 'R';
     }
     if (Permission::userHasFolderWritePermission($folder)) {
         $perms .= 'W';
     }
     if (Permission::userHasAddFolderPermission($folder)) {
         $perms .= 'A';
     }
     // root folder cannot be renamed or deleted.
     if ($folder->iId != 1) {
         if (Permission::userHasRenameFolderPermission($folder)) {
             $perms .= 'N';
         }
         if (Permission::userHasDeleteFolderPermission($folder)) {
             $perms .= 'D';
         }
     }
     return $perms;
 }
开发者ID:jpbauer,项目名称:knowledgetree,代码行数:31,代码来源:KTAPIFolder.inc.php

示例6: get_permission_string

 /**
  * Get's a permission string for a folder eg: 'RW' or 'RWA'
  *
  * @author KnowledgeTree Team
  * @access public
  * @param Folder $folder
  * @return string
  */
 function get_permission_string($folder)
 {
     $perms = '';
     if (Permission::userHasFolderReadPermission($folder)) {
         $perms .= 'R';
     }
     if (Permission::userHasFolderWritePermission($folder)) {
         $perms .= 'W';
     }
     if (Permission::userHasAddFolderPermission($folder)) {
         $perms .= 'A';
     }
     return $perms;
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:22,代码来源:KTAPIFolder.inc.php


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