本文整理汇总了PHP中Permission::userIsSystemAdministrator方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::userIsSystemAdministrator方法的具体用法?PHP Permission::userIsSystemAdministrator怎么用?PHP Permission::userIsSystemAdministrator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permission
的用法示例。
在下文中一共展示了Permission::userIsSystemAdministrator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_active
function is_active($oUser)
{
if (!Permission::userIsSystemAdministrator()) {
return false;
}
$indexerDiagnosis = KTUtil::getSystemSetting('indexerDiagnostics');
$extractorDiagnosis = KTUtil::getSystemSetting('extractorDiagnostics');
if (!empty($indexerDiagnosis)) {
$indexerDiagnosis = unserialize($indexerDiagnosis);
}
if (!empty($extractorDiagnosis)) {
$extractorDiagnosis = unserialize($extractorDiagnosis);
}
if (empty($indexerDiagnosis) && empty($extractorDiagnosis)) {
return false;
}
$this->indexerDiagnosis = $indexerDiagnosis;
$this->extractorDiagnosis = array();
$result = array();
foreach ($extractorDiagnosis as $class => $diagnosis) {
$name = $diagnosis['name'];
$diag = $diagnosis['diagnosis'];
$result[$diag][] = $name;
}
foreach ($result as $problem => $indexers) {
if (empty($problem)) {
continue;
}
$this->extractorDiagnosis[] = array('problem' => $problem, 'indexers' => $indexers);
}
$this->indexerDiagnosis = str_replace(array("\n", 'Administrator Guide'), array('<br>', sprintf("<a target='_blank' href=\"http://www.knowledgetree.com/go/ktAdminManual\">%s</a>", _kt('Administrator Guide'))), $this->indexerDiagnosis);
return true;
}
示例2: check
function check()
{
$oConfig =& KTConfig::getSingleton();
if ($this->oUser->getId() == -2 || $oConfig->get('user_prefs/restrictPreferences', false) && !Permission::userIsSystemAdministrator($this->oUser->getId())) {
return false;
}
$this->aBreadcrumbs = array(array('action' => 'preferences', 'name' => _kt('Preferences')));
return parent::check();
}
示例3: is_active
function is_active($oUser)
{
$usage = KTUtil::getSystemSetting('KTUsage');
if (empty($usage)) {
return false;
}
$this->usage = unserialize($usage);
return Permission::userIsSystemAdministrator();
}
示例4: is_active
function is_active($oUser)
{
$stats = KTUtil::getSystemSetting('indexerStats');
if (empty($stats)) {
return false;
}
$this->stats = unserialize($stats);
return Permission::userIsSystemAdministrator();
}
示例5: is_active
function is_active($oUser)
{
// Check if the user has admin rights
if (Permission::userIsSystemAdministrator($_SESSION['userID'])) {
// Check if the scheduler is overdue
return schedulerDashlet::checkOverDue();
}
return false;
}
示例6: getInfo
function getInfo()
{
global $default;
if ($default->disableBulkImport) {
return null;
}
if (!Permission::userIsSystemAdministrator($this->oUser->getId())) {
return null;
}
return parent::getInfo();
}
示例7: is_active
function is_active($oUser)
{
if (!Permission::userIsSystemAdministrator()) {
return false;
}
$this->resources = KTUtil::getSystemSetting('externalResourceIssues');
if (empty($this->resources)) {
return false;
}
$this->resources = unserialize($this->resources);
return count($this->resources) > 0;
}
示例8: is_active
function is_active($oUser)
{
if (!Permission::userIsSystemAdministrator($oUser)) {
return false;
}
$sql = "select count(*) as no from document_text";
$no = DBUtil::getOneResultKey($sql, 'no');
if ($no == 0) {
return false;
}
$this->migratingDocuments = $no;
return true;
}
示例9: is_active
function is_active($oUser)
{
if (OS_WINDOWS && (double) php_uname('r') >= 6) {
return false;
}
$usage = KTUtil::getSystemSetting('DiskUsage');
if (empty($usage)) {
return false;
}
$usage = unserialize($usage);
$this->usage = $usage;
return Permission::userIsSystemAdministrator();
}
示例10: do_main
function do_main()
{
$folder = $this->oFolder;
$folderid = $folder->getId();
if (Permission::userIsSystemAdministrator()) {
if ($folderid == 1) {
Indexer::indexAll();
} else {
Indexer::indexFolder($folder);
}
}
$full_path = $folder->getFullPath();
$this->addInfoMessage(sprintf(_kt("All documents under the folder '%s' have been scheduled for indexing."), $full_path));
redirect("browse.php?fFolderId={$folderid}");
exit;
}
示例11: do_main
function do_main()
{
$doc = $this->oDocument;
$docid = $doc->getId();
if (Permission::userIsSystemAdministrator()) {
$full_path = $doc->getFullPath();
if (Indexer::isDocumentScheduled($docid)) {
Indexer::unqueueDocument($docid);
$this->addInfoMessage(sprintf(_kt("Document '%s' has been removed from the indexing queue."), $full_path));
} else {
Indexer::index($doc, 'A');
$this->addInfoMessage(sprintf(_kt("Document '%s' has been added to the indexing queue."), $full_path));
}
}
redirect("view.php?fDocumentId={$docid}");
exit;
}
示例12: do_deleteGroup
function do_deleteGroup()
{
$old_search = KTUtil::arrayGet($_REQUEST, 'old_search');
$aErrorOptions = array('redirect_to' => array('main', sprintf("old_search=%s&do_search=1", $old_search)));
$oGroup = $this->oValidator->validateGroup($_REQUEST['group_id'], $aErrorOptions);
$sGroupName = $oGroup->getName();
$this->startTransaction();
foreach ($oGroup->getParentGroups() as $oParentGroup) {
$res = $oParentGroup->removeMemberGroup($oGroup);
}
$res = $oGroup->delete();
$this->oValidator->notError($res, $aErrorOptions);
if (!Permission::userIsSystemAdministrator($_SESSION['userID'])) {
$this->rollbackTransaction();
$this->errorRedirectTo('main', _kt('For security purposes, you cannot remove your own administration priviledges.'), sprintf("old_search=%s&do_search=1", $old_search));
exit(0);
}
$this->commitTransaction();
$this->successRedirectToMain(sprintf(_kt('Group "%s" deleted.'), $sGroupName), sprintf("old_search=%s&do_search=1", $old_search));
}
示例13: _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);
}
示例14: 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);
}
示例15: do_main
function do_main()
{
// store referer
$sBackKey = KTUtil::arrayGet($_REQUEST, 'back_key', false);
$sSubPath = KTUtil::arrayGet($_SERVER, 'PATH_INFO');
// we want to be able to say "i left the system at point x. go back there"
if (!$sBackKey) {
$sReferer = KTUtil::arrayGet($_SERVER, 'HTTP_REFERER');
$sBackKey = KTUtil::randomString();
$_SESSION[$sBackKey] = $sReferer;
}
// no path specified
if (empty($sSubPath)) {
$this->oPage->setTitle(_kt('No help page specified.'));
$this->oPage->addError(_kt('No help page specified.'));
return ' ';
}
// simple test to see if this user is active.
$bCanEdit = Permission::userIsSystemAdministrator($_SESSION['userID']);
global $default;
$sLangCode = $default->defaultLanguage;
/*
now we need to know a few things.
1. can we find this help file?
2. if we can, display it
2.1 images directly
2.2 html wrapped.
3. if now, fail out.
this is essentially handled by asking help.inc.php for the
subpath we've been given, PLUS THE LANGUAGE, and checking for
a PEAR::raiseError.
The "Correct" response we care about is a dictionary:
{
'is_image': string
'title': string
'body': string
}
*/
$aHelpData = KTHelp::getHelpInfo($sSubPath);
if (PEAR::isError($aHelpData)) {
$this->oPage->setTitle($aHelpData->getMessage());
$this->oPage->addError($aHelpData->getMessage());
return ' ';
}
$aLocInfo = KTHelp::_getLocationInfo($sSubPath);
if ($aHelpData['is_image']) {
KTHelp::outputHelpImage($sSubPath);
exit(0);
// done.
} else {
$this->oPage->setTitle($aHelpData['title']);
$this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => $aHelpData['title']);
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate('ktcore/help_with_edit');
$aTemplateData = array('context' => $this, 'help_body' => $aHelpData['body'], 'help_title' => $aHelpData['title'], 'target_name' => KTUtil::arrayGet($aLocInfo, 'subpath'), 'back_key' => $sBackKey, 'can_edit' => $bCanEdit);
return $oTemplate->render($aTemplateData);
}
/*
$help_path = KTHelp::getHelpSubPath($pathinfo);
if ($help_path == false) {
$this->oPage->setTitle(_kt('Invalid help location specified.'));
$this->oPage->addError(_kt('Invalid help location specified.'));
return ' ';
}
// We now check for substitute help files. try to generate an error.
$oReplacementHelp = KTHelpReplacement::getByName($help_path);
if (KTHelp::isImageFile($help_path)) {
KTHelp::outputHelpImage($help_path);
} else {
// not an image, so:
$aHelpInfo = KTHelp::getHelpFromFile($pathinfo)
}
// NORMAL users never see edit-option.
if (!$can_edit) {
if (!PEAR::isError($oReplacementHelp)) {
$this->oPage->setTitle($oReplacementHelp->getTitle());
//return $oReplacementHelp->getDescription();
} elseif ($aHelpInfo != false) {
$this->oPage->setTitle($aHelpInfo['title']);
//return $aHelpInfo['body'];
} else {
$this->oPage->setTitle(_kt('Invalid help location specified.'));
$this->oPage->addError(_kt('Invalid help location specified.'));
return ' ';
}
}
if (!PEAR::isError($oReplacementHelp)) {
$aHelpInfo['title'] = $oReplacementHelp->getTitle();
$aHelpInfo['body'] = $oReplacementHelp->getDescription();
}
// we now _can_ edit.
$this->oPage->setTitle($aHelpInfo['title']);
$this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => $aHelpInfo['title']);
//.........这里部分代码省略.........