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;
 }
Ejemplo n.º 2
0
 /**
  * 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();
     }
 }
Ejemplo n.º 3
0
    /**
     * @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;
    }
Ejemplo n.º 4
0
<?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();