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


PHP Permission::isUnitAdministratorForFolder方法代码示例

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


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

示例1: do_main

 /**
  * Display a list of versions for comparing
  *
  * @return unknown
  */
 function do_main()
 {
     $show_version = KTUtil::arrayGet($_REQUEST, 'show');
     $showall = isset($show_version) && $show_version == 'all' ? true : false;
     $this->oPage->setSecondaryTitle($this->oDocument->getName());
     $this->oPage->setBreadcrumbDetails(_kt('Version History'));
     $aMetadataVersions = KTDocumentMetadataVersion::getByDocument($this->oDocument);
     $aVersions = array();
     foreach ($aMetadataVersions as $oVersion) {
         $version = Document::get($this->oDocument->getId(), $oVersion->getId());
         if ($showall) {
             $aVersions[] = $version;
         } else {
             if ($version->getMetadataStatusID() != VERSION_DELETED) {
                 $aVersions[] = $version;
             }
         }
     }
     // render pass.
     $this->oPage->title = _kt('Document History');
     $oTemplate = $this->oValidator->validateTemplate('ktcore/document/metadata_history');
     $aActions = KTDocumentActionUtil::getDocumentActionsByNames(array('ktcore.actions.document.view'));
     $oAction = $aActions[0];
     $oAction->setDocument($this->oDocument);
     // create delete action if user is sys admin or folder admin
     $bShowDelete = false;
     require_once KT_LIB_DIR . '/security/Permission.inc';
     $oUser =& User::get($_SESSION['userID']);
     $iFolderId = $this->oDocument->getFolderId();
     if (Permission::userIsSystemAdministrator($oUser) || Permission::isUnitAdministratorForFolder($oUser, $iFolderId)) {
         // Check if admin mode is enabled
         $bShowDelete = KTUtil::arrayGet($_SESSION, 'adminmode', false);
     }
     // Check if the document comparison plugin is installed
     $isActive = KTPluginUtil::pluginIsActive('document.comparison.plugin');
     $bShowCompare = false;
     $bShowVersionCompare = false;
     $sUrl = false;
     if ($isActive) {
         $oRegistry =& KTPluginRegistry::getSingleton();
         $oPlugin =& $oRegistry->getPlugin('document.comparison.plugin');
         if ($oPlugin->loadHelpers()) {
             $sUrl = $oPlugin->getPagePath('DocumentComparison');
             $file = $oPlugin->_aPages['document.comparison.plugin/DocumentComparison'][2];
             include_once $file;
             // Check mime type of document for content comparison
             list($bShowCompare, $bShowVersionCompare) = DocumentComparison::checkMimeType($this->oDocument);
         }
     }
     $aTemplateData = array('context' => $this, 'document_id' => $this->oDocument->getId(), 'document' => $this->oDocument, 'versions' => $aVersions, 'downloadaction' => $oAction, 'showdelete' => $bShowDelete, 'showall' => $showall, 'bShowCompare' => $bShowCompare, 'bShowVersionCompare' => $bShowVersionCompare, 'sUrl' => $sUrl);
     return $oTemplate->render($aTemplateData);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:57,代码来源:KTDocumentActions.php

示例2: do_disableAdminMode

 function do_disableAdminMode()
 {
     $iDocumentId = KTUtil::arrayGet($_REQUEST, 'fDocumentId');
     $iFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId');
     if ($iDocumentId) {
         $oDocument = Document::get($iDocumentId);
         if (PEAR::isError($oDocument) || $oDocument === false) {
             return null;
         }
         $iFolderId = $oDocument->getFolderId();
     }
     if (!Permission::userIsSystemAdministrator() && !Permission::isUnitAdministratorForFolder($this->oUser, $iFolderId)) {
         $this->errorRedirectToMain(_kt('You are not an administrator'));
     }
     // log this entry
     $oLogEntry =& KTUserHistory::createFromArray(array('userid' => $this->oUser->getId(), 'datetime' => date('Y-m-d H:i:s', time()), 'actionnamespace' => 'ktcore.user_history.disable_admin_mode', 'comments' => 'Admin Mode disabled', 'sessionid' => $_SESSION['sessionID']));
     $aOpts = array('redirect_to' => 'main', 'message' => _kt('Unable to log admin mode exit.  Not de-activating admin mode.'));
     $this->oValidator->notError($oLogEntry, $aOpts);
     $_SESSION['adminmode'] = false;
     if ($_REQUEST['fDocumentId']) {
         $_SESSION['KTInfoMessage'][] = _kt('Administrator mode disabled');
         redirect(KTBrowseUtil::getUrlForDocument($iDocumentId));
         exit(0);
     }
     if ($_REQUEST['fFolderId']) {
         $this->successRedirectToMain(_kt('Administrator mode disabled'), sprintf('fFolderId=%d', $_REQUEST['fFolderId']));
     }
     $this->successRedirectToMain(_kt('Administrator mode disabled'));
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:29,代码来源:browse.php

示例3: inAdminMode

 /**
  * Determines whether the user is in administrator mode, including
  * whether the user is in the unit for which it is unit
  * administrator.
  */
 function inAdminMode($oUser, $oFolder)
 {
     if (KTUtil::arrayGet($_SESSION, 'adminmode', false) !== true) {
         return false;
     }
     if (Permission::userIsSystemAdministrator($oUser)) {
         return true;
     }
     return Permission::isUnitAdministratorForFolder($oUser, $oFolder);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:15,代码来源:browseutil.inc.php

示例4: _show

 function _show()
 {
     if (is_null($this->_sShowPermission)) {
         return true;
     }
     $oFolder = Folder::get($this->oDocument->getFolderId());
     if ($this->_bMutator && $this->oDocument->getImmutable()) {
         if ($this->_bMutationAllowedByAdmin === true) {
             if (!KTBrowseUtil::inAdminMode($this->oUser, $oFolder)) {
                 return false;
             }
         } else {
             return false;
         }
     }
     if ($this->_bAdminAlwaysAvailable) {
         if (Permission::userIsSystemAdministrator($this->oUser->getId())) {
             return true;
         }
         if (Permission::isUnitAdministratorForFolder($this->oUser, $this->oDocument->getFolderId())) {
             return true;
         }
     }
     $oPermission =& KTPermission::getByName($this->_sShowPermission);
     if (PEAR::isError($oPermission)) {
         return true;
     }
     if (!KTWorkflowUtil::actionEnabledForDocument($this->oDocument, $this->sName)) {
         return false;
     }
     // be nasty in archive/delete status.
     $status = $this->oDocument->getStatusID();
     if ($status == DELETED || $status == ARCHIVED) {
         return false;
     }
     if ($this->bAllowInAdminMode) {
         // check if this user is in admin mode
         if (KTBrowseUtil::inAdminMode($this->oUser, $oFolder)) {
             return true;
         }
     }
     return KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oDocument);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:43,代码来源:documentaction.inc.php

示例5: render

 function render()
 {
     $iFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId', 1);
     $iDocumentId = KTUtil::arrayGet($_REQUEST, 'fDocumentId');
     if (!$iFolderId && !$iDocumentId) {
         return null;
     }
     if ($iDocumentId) {
         $oDocument = Document::get($iDocumentId);
         if (PEAR::isError($oDocument) || $oDocument === false) {
             return null;
         }
         $iFolderId = $oDocument->getFolderId();
     }
     require_once KT_LIB_DIR . '/security/Permission.inc';
     $oUser =& User::get($_SESSION['userID']);
     if (!Permission::userIsSystemAdministrator($oUser) && !Permission::isUnitAdministratorForFolder($oUser, $iFolderId)) {
         return null;
     }
     require_once KT_LIB_DIR . '/browse/browseutil.inc.php';
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("kt3/portlets/admin_mode_portlet");
     $toggleMode = 'action=disableAdminMode';
     if (KTUtil::arrayGet($_SESSION, 'adminmode', false) == false) {
         $toggleMode = 'action=enableAdminMode';
     }
     $QS = sprintf('fDocumentId=%s&fFolderId=%s&%s', $iDocumentId, $iFolderId, $toggleMode);
     $toggleUrl = KTUtil::addQueryString(KTBrowseUtil::getBrowseBaseUrl(), $QS);
     $aTemplateData = array("context" => $this, 'toggleurl' => $toggleUrl, 'enabled' => KTUtil::arrayGet($_SESSION, 'adminmode', false));
     return $oTemplate->render($aTemplateData);
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:31,代码来源:KTPortlets.php


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