本文整理汇总了PHP中OCP\User::checkAdminUser方法的典型用法代码示例。如果您正苦于以下问题:PHP User::checkAdminUser方法的具体用法?PHP User::checkAdminUser怎么用?PHP User::checkAdminUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\User
的用法示例。
在下文中一共展示了User::checkAdminUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: savepolicy
public function savepolicy($minlength, $hasmixedcase, $hasnumbers, $hasspecialchars, $specialcharslist)
{
\OCP\User::checkAdminUser();
$hasspecialchars = $hasspecialchars == 0 ? "false" : "true";
$hasmixedcase = $hasmixedcase == 0 ? "false" : "true";
$hasnumbers = $hasnumbers == 0 ? "false" : "true";
$this->service->setAppValue('minlength', $minlength);
$this->service->setAppValue('hasmixedcase', $hasmixedcase);
$this->service->setAppValue('hasnumbers', $hasnumbers);
$this->service->setAppValue('hasspecialchars', $hasspecialchars);
$this->service->setAppValue('specialcharslist', $specialcharslist);
return true;
}
示例2: runChecks
/**
* Runs all security checks
*/
public function runChecks()
{
if ($this->csrfCheck) {
\OCP\JSON::callCheck();
}
if ($this->loggedInCheck) {
\OCP\JSON::checkLoggedIn();
}
if ($this->appEnabledCheck) {
\OCP\JSON::checkAppEnabled($this->appName);
}
if ($this->isAdminCheck) {
\OCP\User::checkAdminUser();
}
}
示例3: deleteServerConfiguration
/**
* @brief deletes a given saved LDAP/AD server configuration.
* @param string the configuration prefix of the config to delete
* @return bool true on success, false otherwise
*/
public static function deleteServerConfiguration($prefix)
{
//just to be on the safe side
\OCP\User::checkAdminUser();
if (!in_array($prefix, self::getServerConfigurationPrefixes())) {
return false;
}
$query = \OCP\DB::prepare('
DELETE
FROM `*PREFIX*appconfig`
WHERE `configkey` LIKE ?
AND `appid` = \'user_ldap\'
AND `configkey` NOT IN (\'enabled\', \'installed_version\', \'types\', \'bgjUpdateGroupsLastRun\')
');
$delRows = $query->execute(array($prefix . '%'));
if (\OCP\DB::isError($delRows)) {
return false;
}
if ($delRows == 0) {
return false;
}
return true;
}
示例4: isset
<?php
/**
* ownCloud - Updater plugin
*
* @author Victor Dubiniuk
* @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
namespace OCA\Updater;
\OCP\User::checkAdminUser();
\OCP\Util::addScript(App::APP_ID, '3rdparty/angular');
\OCP\Util::addScript(App::APP_ID, 'app');
\OCP\Util::addScript(App::APP_ID, 'controllers');
\OCP\Util::addStyle(App::APP_ID, 'updater');
if (!@file_exists(App::getBackupBase())) {
Helper::mkdir(App::getBackupBase());
}
$data = App::getFeed();
$isNewVersionAvailable = isset($data['version']) && $data['version'] != '' && $data['version'] !== array();
$tmpl = new \OCP\Template(App::APP_ID, 'admin');
$lastCheck = \OC_Appconfig::getValue('core', 'lastupdatedat');
$tmpl->assign('checkedAt', \OCP\Util::formatDate($lastCheck));
$tmpl->assign('isNewVersionAvailable', $isNewVersionAvailable ? 'true' : 'false');
$tmpl->assign('channels', Channel::getChannels());
$tmpl->assign('currentChannel', Channel::getCurrentChannel());
$tmpl->assign('version', isset($data['versionstring']) ? $data['versionstring'] : '');
return $tmpl->fetchPage();