本文整理汇总了PHP中OC_JSON::checkSubAdminUser方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_JSON::checkSubAdminUser方法的具体用法?PHP OC_JSON::checkSubAdminUser怎么用?PHP OC_JSON::checkSubAdminUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_JSON
的用法示例。
在下文中一共展示了OC_JSON::checkSubAdminUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
OC_JSON::checkSubAdminUser();
OCP\JSON::callCheck();
$username = isset($_POST["username"]) ? (string) $_POST["username"] : '';
if ($username === '' && !OC_User::isAdminUser(OC_User::getUser()) || !OC_User::isAdminUser(OC_User::getUser()) && !OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)) {
$l = \OC::$server->getL10N('core');
OC_JSON::error(array('data' => array('message' => $l->t('Authentication error'))));
exit;
}
//make sure the quota is in the expected format
$quota = (string) $_POST["quota"];
if ($quota !== 'none' and $quota !== 'default') {
$quota = OC_Helper::computerFileSize($quota);
$quota = OC_Helper::humanFileSize($quota);
}
// Return Success story
if ($username) {
示例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\JSON::checkAdminUser();
}
if ($this->isSubAdminCheck) {
\OC_JSON::checkSubAdminUser();
}
}