Ejemplo n.º 1
0
 public function tearDown()
 {
     OCP\Config::setAppValue('files_encryption', 'enable_encryption', $this->oldConfig);
     if (!is_null($this->oldKey)) {
         $_SESSION['enckey'] = $this->oldKey;
     }
 }
Ejemplo n.º 2
0
 public function tearDown()
 {
     OC_Mount_Config::$skipTest = false;
     \OC_User::deleteUser(self::TEST_USER2);
     \OC_User::deleteUser(self::TEST_USER1);
     \OC_Group::deleteGroup(self::TEST_GROUP1);
     \OC_Group::deleteGroup(self::TEST_GROUP2);
     @unlink($this->dataDir . '/mount.json');
     OCP\Config::setAppValue('files_external', 'user_mounting_backends', $this->oldAllowedBackends);
 }
Ejemplo n.º 3
0
function setAdminVal() {
	if (isset($_POST['host'])) {
		OCP\Config::setAppValue('shorten', 'host', $_POST['host']);
		echo "host:".$_POST['host'];
	}
	if (isset($_POST['api'])) {
		OCP\Config::setAppValue('shorten', 'api', $_POST['api']);
		echo "api:".$_POST['api'];
	}
	if (isset($_POST['type'])) {
		OCP\Config::setAppValue('shorten', 'type', $_POST['type']);
		echo "type:".$_POST['type'];
	}
}
Ejemplo n.º 4
0
 */
$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_agent_password', 'ldap_base', 'ldap_base_users', 'ldap_base_groups', 'ldap_userlist_filter', 'ldap_login_filter', 'ldap_group_filter', 'ldap_display_name', 'ldap_tls', 'ldap_nocase', 'ldap_quota_def', 'ldap_quota_attr', 'ldap_email_attr', 'ldap_group_member_assoc_attribute');
OCP\Util::addscript('user_ldap', 'settings');
if ($_POST) {
    foreach ($params as $param) {
        if (isset($_POST[$param])) {
            if ('ldap_agent_password' == $param) {
                OCP\Config::setAppValue('user_ldap', $param, base64_encode($_POST[$param]));
            } else {
                OCP\Config::setAppValue('user_ldap', $param, $_POST[$param]);
            }
        } elseif ('ldap_tls' == $param) {
            // unchecked checkboxes are not included in the post paramters
            OCP\Config::setAppValue('user_ldap', $param, 0);
        } elseif ('ldap_nocase' == $param) {
            OCP\Config::setAppValue('user_ldap', $param, 0);
        }
    }
}
// fill template
$tmpl = new OCP\Template('user_ldap', 'settings');
foreach ($params as $param) {
    $value = htmlentities(OCP\Config::getAppValue('user_ldap', $param, ''));
    $tmpl->assign($param, $value);
}
// settings with default values
$tmpl->assign('ldap_port', OCP\Config::getAppValue('user_ldap', 'ldap_port', '389'));
$tmpl->assign('ldap_display_name', OCP\Config::getAppValue('user_ldap', 'ldap_display_name', 'uid'));
$tmpl->assign('ldap_group_member_assoc_attribute', OCP\Config::getAppValue('user_ldap', 'ldap_group_member_assoc_attribute', 'uniqueMember'));
$tmpl->assign('ldap_agent_password', base64_decode(OCP\Config::getAppValue('user_ldap', 'ldap_agent_password')));
return $tmpl->fetchPage();
Ejemplo n.º 5
0
* version 3 of the License, or any later version.
*
* This library 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 along with this library.  If not, see <http://www.gnu.org/licenses/>.
*
*/
OCP\User::checkAdminUser();
$params = array('av_mode' => 'executable', 'av_socket' => '/var/run/clamav/clamd.ctl', 'av_host' => '', 'av_port' => '', 'av_cmd_options' => '', 'av_chunk_size' => '1024', 'av_path' => '/usr/bin/clamscan', 'infected_action' => 'only_log');
if ($_POST) {
    OCP\Util::callCheck();
    foreach ($params as $param => $default) {
        if (isset($_POST[$param])) {
            OCP\Config::setAppValue('files_antivirus', $param, $_POST[$param]);
        }
    }
}
// fill template
$tmpl = new OCP\Template('files_antivirus', 'settings');
$tmpl->assign('requesttoken', OCP\Util::callRegister());
OCP\Util::addStyle('files_antivirus', 'settings');
OCP\Util::addScript('files_antivirus', 'settings');
foreach ($params as $param => $default) {
    $value = OCP\Config::getAppValue('files_antivirus', $param, $default);
    $tmpl->assign($param, $value);
}
return $tmpl->fetchPage();
Ejemplo n.º 6
0
                }
            }
        } else {
            if ($param === 'removeHeaderNav') {
                OCP\Config::setAppValue('roundcube', 'removeHeaderNav', false);
            }
            if ($param === 'removeControlNav') {
                OCP\Config::setAppValue('roundcube', 'removeControlNav', false);
            }
            if ($param === 'autoLogin') {
                OCP\Config::setAppValue('roundcube', 'autoLogin', false);
            }
            if ($param === 'enableDebug') {
                OCP\Config::setAppValue('roundcube', 'enableDebug', false);
            }
            if ($param === 'rcNoCronRefresh') {
                OCP\Config::setAppValue('roundcube', 'rcNoCronRefresh', false);
            }
        }
    }
    // update login status
    $username = OCP\User::getUser();
    $params = array("uid" => $username);
    $loginHelper = new OC_RoundCube_AuthHelper();
    $loginHelper->login($params);
} else {
    OC_JSON::error(array("data" => array("message" => $l->t("Not submitted for us."))));
    return false;
}
OCP\JSON::success(array('data' => array('message' => $l->t('Application settings successfully stored.'))));
return true;
Ejemplo n.º 7
0
<?php

OCP\User::checkAdminUser();
\OCP\App::checkAppEnabled('shorten');

if (isset($_POST['host'])) {
	OCP\Config::setAppValue('shorten', 'host', $_POST['host']);
	echo "host:".$_POST['host'];
}
if (isset($_POST['api'])) {
	OCP\Config::setAppValue('shorten', 'api', $_POST['api']);
	echo "api:".$_POST['api'];
}
if (isset($_POST['type'])) {
	OCP\Config::setAppValue('shorten', 'type', $_POST['type']);
	echo "type:".$_POST['type'];
}


?>
Ejemplo n.º 8
0
 /**
  * Test adding a personal mount point using disallowed backend
  */
 public function testAddDisallowedBackendMountPointSingleUser()
 {
     $mountType = OC_Mount_Config::MOUNT_TYPE_USER;
     $applicable = self::TEST_USER1;
     $isPersonal = true;
     // local
     $this->assertFalse(OC_Mount_Config::addMountPoint('/ext', '\\OC\\Files\\storage\\local', array(), $mountType, $applicable, $isPersonal));
     unset($this->allBackends['\\OC\\Files\\Storage\\SFTP']);
     OCP\Config::setAppValue('files_external', 'user_mounting_backends', implode(',', array_keys($this->allBackends)));
     // non-local but forbidden
     $this->assertFalse(OC_Mount_Config::addMountPoint('/ext', '\\OC\\Files\\Storage\\SFTP', array(), $mountType, $applicable, $isPersonal));
     $this->assertFalse(file_exists($this->userHome . '/mount.json'));
 }
Ejemplo n.º 9
0
 * 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 along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
OC_Util::checkAdminUser();
$params = array('cas_server_version', 'cas_server_hostname', 'cas_server_port', 'cas_server_path', 'cas_autocreate', 'cas_update_user_data', 'cas_protected_groups', 'cas_default_group', 'cas_email_mapping', 'cas_displayName_mapping', 'cas_group_mapping', 'cas_cert_path');
OCP\Util::addscript('user_minimalcas', 'settings');
if ($_POST) {
    // CSRF check
    OCP\JSON::callCheck();
    foreach ($params as $param) {
        if (isset($_POST[$param])) {
            OCP\Config::setAppValue('user_minimalcas', $param, $_POST[$param]);
        } elseif ('cas_autocreate' == $param) {
            // unchecked checkboxes are not included in the post paramters
            OCP\Config::setAppValue('user_minimalcas', $param, 0);
        } elseif ('cas_update_user_data' == $param) {
            OCP\Config::setAppValue('user_minimalcas', $param, 0);
        }
    }
}
// fill template
$tmpl = new OCP\Template('user_minimalcas', 'settings');
foreach ($params as $param) {
    $value = htmlentities(OCP\Config::getAppValue('user_minimalcas', $param, ''));
    $tmpl->assign($param, $value);
}
return $tmpl->fetchPage();
Ejemplo n.º 10
0
$configOtp[$i]['label'] = 'Used password field only and add OTP after the password';
$configOtp[$i]['type'] = 'checkbox';
$configOtp[$i]['default_value'] = false;
$i++;
foreach ($allTab as $tab) {
    foreach (${$tab}["arrayConf"] as $input) {
        switch ($input['type']) {
            case "checkbox":
                if (isset($_POST['authMethod']) || isset($_POST['inputOtpAfterPwd'])) {
                    if (isset($_POST[$input['name']])) {
                        OCP\Config::setAppValue('user_otp', $input['name'], true);
                    } else {
                        OCP\Config::setAppValue('user_otp', $input['name'], false);
                    }
                }
                $tmpl->assign($input['name'], OCP\Config::getAppValue('user_otp', $input['name'], $input['default_value']));
                break;
            default:
                if ($_POST && isset($_POST[$input['name']])) {
                    if ($input['name'] === "EncryptionKey" && $_POST[$input['name']] == "") {
                        $_POST[$input['name']] = $input['default_value'];
                    }
                    OCP\Config::setAppValue('user_otp', $input['name'], $_POST[$input['name']]);
                }
                $tmpl->assign($input['name'], OCP\Config::getAppValue('user_otp', $input['name'], $input['default_value']));
        }
    }
    $tmpl->assign($tab["arrayConf"], ${$tab}["arrayConf"]);
}
$tmpl->assign('allTab', $allTab);
return $tmpl->fetchPage();
Ejemplo n.º 11
0
		case 'POST':
			// detect provided settings
			$data = array();
			foreach (array_keys($_POST) as $key) {
				if ( isset(OC_Shorty_Type::$SETTING[$key]) ) // ignore unknown preference keys
				{
					$type = OC_Shorty_Type::$SETTING[$key];
					$data[$key] = OC_Shorty_Type::req_argument ( $key, $type, FALSE );
					// allow setting an empty content (removing the settings content), but insist on a valid empty string for valid sql
					if ( ! $data[$key])
						$data[$key] = '';
				}
			} // foreach
			// store settings one by one
			foreach ( $data as $key=>$val )
				OCP\Config::setAppValue( 'shorty', $key, $val );
			// swallow any accidential output generated by php notices and stuff to preserve a clean JSON reply structure
			OC_Shorty_Tools::ob_control ( FALSE );
			OCP\Util::writeLog( 'shorty', sprintf("Setting '%s' saved",implode(',',array_keys($data))), OCP\Util::DEBUG );
			OCP\JSON::success ( array ( 'data'    => $data,
										'level'   => 'debug',
 										'message' => OC_Shorty_L10n::t("Setting '%s' saved",implode(',',array_keys($data))) ) );
			break;

		case 'GET':
			// detect requested settings
			foreach (array_keys($_GET) as $key)
			{
				if ( isset(OC_Shorty_Type::$SETTING[$key]) ) // ignore unknown preference keys
				{
					$type = OC_Shorty_Type::$SETTING[$key];
Ejemplo n.º 12
0
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library 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 along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
OCP\User::checkAdminUser();
$params = array('staff_is_admin', 'superuser_is_admin');
if ($_POST) {
    foreach ($params as $param) {
        if (isset($_POST[$param])) {
            OCP\Config::setAppValue('django_auth', $param, $_POST[$param]);
        } else {
            // unchecked checkboxes are not included in the post paramters
            OCP\Config::setAppValue('django_auth', $param, 0);
        }
    }
}
// fill template
$tmpl = new OCP\Template('django_auth', 'settings');
$tmpl->assign('staff_is_admin', OCP\Config::getAppValue('django_auth', 'staff_is_admin', OC_GROUP_BACKEND_DJANGO_STAFF_IS_ADMIN));
$tmpl->assign('superuser_is_admin', OCP\Config::getAppValue('django_auth', 'superuser_is_admin', OC_GROUP_BACKEND_DJANGO_SUPERUSER_IS_ADMIN));
return $tmpl->fetchPage();
<?php

/**
 * ownCloud - RainLoop mail plugin
 *
 * @author RainLoop Team
 * @copyright 2014 RainLoop Team
 *
 * https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
 */
OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('rainloop');
OCP\JSON::callCheck();
$sUrl = '';
$sPath = '';
$bAutologin = false;
if (isset($_POST['appname'], $_POST['rainloop-url'], $_POST['rainloop-path']) && 'rainloop' === $_POST['appname']) {
    OCP\Config::setAppValue('rainloop', 'rainloop-url', $_POST['rainloop-url']);
    OCP\Config::setAppValue('rainloop', 'rainloop-path', $_POST['rainloop-path']);
    OCP\Config::setAppValue('rainloop', 'rainloop-autologin', isset($_POST['rainloop-autologin']) ? '1' === $_POST['rainloop-autologin'] : false);
    $sUrl = OCP\Config::getAppValue('rainloop', 'rainloop-url', '');
    $sPath = OCP\Config::getAppValue('rainloop', 'rainloop-path', '');
    $bAutologin = OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false);
} else {
    OC_JSON::error(array('Message' => 'Invalid Argument(s)', 'Url' => $sUrl, 'Path' => $sPath));
    return false;
}
OCP\JSON::success(array('Message' => 'Saved successfully', 'Url' => $sUrl, 'Path' => $sPath));
return true;
Ejemplo n.º 14
0
<?php

/**
 * ownCloud - User Files Restore
 *
 * @author Patrick Paysant <*****@*****.**>
 * @copyright 2015 CNRS DSI
 * @license This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
 */
$versions = OCP\Config::getAppValue('user_files_restore', 'versions', 'doSet');
if ($versions === 'doSet') {
    OCP\Config::setAppValue('user_files_restore', 'versions', json_encode(array(1, 6, 15)));
}
Ejemplo n.º 15
0
<?php

OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('files_sharing');
OCP\JSON::checkAdminUser();
if ($_POST['allowSharingWithEveryone'] == true) {
    OCP\Config::setAppValue('files_sharing', 'allowSharingWithEveryone', 'yes');
} else {
    OCP\Config::setAppValue('files_sharing', 'allowSharingWithEveryone', 'no');
}
Ejemplo n.º 16
0
<?php

/**
 * Copyright (c) 2011, Frank Karlitschek <*****@*****.**>
 * Copyright (c) 2012, Florian Hülsmann <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or later.
 * See the COPYING-README file.
 */
OCP\User::checkAdminUser();
OCP\JSON::callCheck();
OCP\Config::setAppValue('ojsxc', 'boshUrl', $_POST['boshUrl']);
OCP\Config::setAppValue('ojsxc', 'xmppDomain', $_POST['xmppDomain']);
OCP\Config::setAppValue('ojsxc', 'xmppResource', $_POST['xmppResource']);
OCP\Config::setAppValue('ojsxc', 'xmppOverwrite', isset($_POST['xmppOverwrite']) ? $_POST['xmppOverwrite'] : 'false');
OCP\Config::setAppValue('ojsxc', 'xmppStartMinimized', isset($_POST['xmppStartMinimized']) ? $_POST['xmppStartMinimized'] : 'false');
OCP\Config::setAppValue('ojsxc', 'iceUrl', $_POST['iceUrl']);
OCP\Config::setAppValue('ojsxc', 'iceUsername', $_POST['iceUsername']);
OCP\Config::setAppValue('ojsxc', 'iceCredential', $_POST['iceCredential']);
OCP\Config::setAppValue('ojsxc', 'iceSecret', $_POST['iceSecret']);
OCP\Config::setAppValue('ojsxc', 'iceTtl', $_POST['iceTtl']);
echo 'true';
Ejemplo n.º 17
0
 /**
  * Stores information about session identified by $handle
  *
  * @param string $handle association handle
  * @param string $macFunc HMAC function (sha1 or sha256)
  * @param string $secret shared secret
  * @param string $expires expiration UNIX time
  * @return bool
  */
 public function addAssociation($handle, $macFunc, $secret, $expires)
 {
     $name = 'assoc_' . md5($handle);
     $data = serialize(array($handle, $macFunc, base64_encode($secret), $expires));
     OCP\Config::setAppValue('user_openid_provider', $name, $data);
 }
Ejemplo n.º 18
0
                    } else {
                        OCP\Config::setAppValue('roundcube', $param, $_POST[$param]);
                    }
                }
            }
        } else {
            if ($param === 'removeHeaderNav') {
                OCP\Config::setAppValue('roundcube', 'removeHeaderNav', false);
            }
            if ($param === 'removeControlNav') {
                OCP\Config::setAppValue('roundcube', 'removeControlNav', false);
            }
            if ($param === 'autoLogin') {
                OCP\Config::setAppValue('roundcube', 'autoLogin', false);
            }
            if ($param === 'enableDebug') {
                OCP\Config::setAppValue('roundcube', 'enableDebug', false);
            }
        }
    }
    // update login status
    $username = OCP\User::getUser();
    $params = array("uid" => $username);
    $loginHelper = new OC_RoundCube_AuthHelper();
    $loginHelper->login($params);
} else {
    OC_JSON::error(array("data" => array("message" => $l->t("Not submitted for us."))));
    return false;
}
OC_JSON::success(array('data' => array('message' => $l->t('Application settings successfully stored.'))));
return true;
Ejemplo n.º 19
0
<?php

/*
 * Copyright 2014 by Francesco PIRANEO G. (fpiraneo@gmail.com)
 * 
 * This file is part of oclife.
 * 
 * oclife is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * oclife 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with oclife.  If not, see <http://www.gnu.org/licenses/>.
 */
\OCP\JSON::callCheck();
OCP\User::checkAdminUser();
OCP\JSON::callCheck();
$result = array();
$useImageMagick = filter_input(INPUT_POST, 'useImageMagick', FILTER_SANITIZE_STRING);
$result[0] = OCP\Config::setAppValue('oclife', 'useImageMagick', $useImageMagick === 'true' ? 1 : 0);
echo $result[0] ? 'OK' : 'KO';
Ejemplo n.º 20
0
 *
 * This library 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 along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
$params = array('saml_ssp_path', 'saml_sp_source', 'saml_autocreate', 'saml_update_user_data', 'saml_protected_groups', 'saml_default_group', 'saml_username_mapping', 'saml_email_mapping', 'saml_group_mapping');
OCP\Util::addscript('user_saml', 'settings');
if ($_POST) {
    foreach ($params as $param) {
        if (isset($_POST[$param])) {
            OCP\Config::setAppValue('user_saml', $param, $_POST[$param]);
        }
    }
}
// fill template
$tmpl = new OCP\Template('user_saml', 'settings');
foreach ($params as $param) {
    $value = htmlentities(OCP\Config::getAppValue('user_saml', $param, ''));
    $tmpl->assign($param, $value);
}
// settings with default values
$tmpl->assign('saml_ssp_path', OCP\Config::getAppValue('user_saml', 'saml_ssp_path', '/var/www/sp/simplesamlphp'));
$tmpl->assign('saml_sp_source', OCP\Config::getAppValue('user_saml', 'saml_sp_source', 'default-sp'));
$tmpl->assign('saml_autocreate', OCP\Config::getAppValue('user_saml', 'saml_autocreate', 0));
$tmpl->assign('saml_update_user_data', OCP\Config::getAppValue('user_saml', 'saml_update_user_data', 0));
$tmpl->assign('saml_protected_groups', OCP\Config::getAppValue('user_saml', 'saml_protected_groups', ''));
Ejemplo n.º 21
0
<?php

OC_Util::checkAdminUser();
$params = array('logoutbutton');
if ($_POST) {
    foreach ($params as $param) {
        $paramIsSet = 0;
        if (isset($_POST[$param])) {
            $paramIsSet = 1;
        }
        OCP\Config::setAppValue('server_session_manager', $param, $paramIsSet);
    }
} else {
    foreach ($params as $param) {
        OCP\Config::setAppValue('server_session_manager', $param, 0);
    }
}
$tmpl = new OCP\Template('server_session_manager', 'settings');
foreach ($params as $param) {
    $value = OCP\Config::getAppValue('server_session_manager', $param, '') == 1 ? true : false;
    if ($value) {
        $tmpl->assign($param, $value);
    }
}
return $tmpl->fetchPage();
Ejemplo n.º 22
0
	public static function setRoomTime( $room=false, $lastmsg=false ) {		
		$userId = OC_User::getUser();
		$room = ( $room ) ? $room : self::getRoom();
		$time = time();

		$rtype = explode(":", $room);
		$rtype = $rtype[0];		

		/*
		if ( ! $lastmsg ) {
			$query = OCP\DB::prepare("SELECT id FROM *PREFIX*conversations WHERE room = ? ORDER BY id DESC", 1, 0);
			$lastmsg = $query->execute( array($room) )->fetch();
			$lastmsg = ( !$lastmsg ) ? 0 : $lastmsg['id'];
		}		
		*/

		$conf = OCP\Config::getUserValue( $userId, 'conversations', 'conf', false );
		$conf = ( ! $conf ) ? array() : unserialize( $conf );
		//$conf['rooms'][$room]['lastmsg'] = $lastmsg;
		$conf['rooms'][$room]['wtime'] = $time;

		OCP\Config::setUserValue( $userId, 'conversations', 'conf', serialize($conf));	

		if ( $rtype == "group" ) {
			$gconf = OCP\Config::getAppValue( 'conversations', 'conf', false );
			$gconf = ( ! $gconf ) ? array() : unserialize( $gconf );
			//$gconf['rooms'][$room]['lastmsg'] = $lastmsg;
			$gconf['rooms'][$room]['wtime'] = $time;
			OCP\Config::setAppValue( 'conversations', 'conf', serialize($gconf) );
		}			
	}
Ejemplo n.º 23
0
OC_Util::checkAdminUser();
$params = array('saml_ssp_path', 'saml_sp_source', 'saml_force_saml_login', 'saml_autocreate', 'saml_update_user_data', 'saml_protected_groups', 'saml_default_group', 'saml_username_mapping', 'saml_email_mapping', 'saml_quota_mapping', 'saml_default_quota', 'saml_displayname_mapping', 'saml_group_mapping');
OCP\Util::addscript('user_saml', 'settings');
if ($_POST) {
    // CSRF check
    OCP\JSON::callCheck();
    foreach ($params as $param) {
        if (isset($_POST[$param])) {
            OCP\Config::setAppValue('user_saml', $param, $_POST[$param]);
        } elseif ('saml_force_saml_login' == $param) {
            OCP\Config::setAppValue('user_saml', $param, 0);
        } elseif ('saml_autocreate' == $param) {
            // unchecked checkboxes are not included in the post paramters
            OCP\Config::setAppValue('user_saml', $param, 0);
        } elseif ('saml_update_user_data' == $param) {
            OCP\Config::setAppValue('user_saml', $param, 0);
        }
    }
}
// fill template
$tmpl = new OCP\Template('user_saml', 'settings');
foreach ($params as $param) {
    $value = htmlentities(OCP\Config::getAppValue('user_saml', $param, ''));
    $tmpl->assign($param, $value);
}
// settings with default values
$tmpl->assign('saml_ssp_path', OCP\Config::getAppValue('user_saml', 'saml_ssp_path', '/usr/share/simplesamlphp'));
$tmpl->assign('saml_sp_source', OCP\Config::getAppValue('user_saml', 'saml_sp_source', 'default-sp'));
$tmpl->assign('saml_force_saml_login', OCP\Config::getAppValue('user_saml', 'saml_force_saml_login', 0));
$tmpl->assign('saml_autocreate', OCP\Config::getAppValue('user_saml', 'saml_autocreate', 0));
$tmpl->assign('saml_update_user_data', OCP\Config::getAppValue('user_saml', 'saml_update_user_data', 0));
Ejemplo n.º 24
0
<?php

OCP\Util::addscript('user_vd', 'adminSettings');
$paramsCheck = array('forceCreateUsers', 'disableBackends');
if ($_POST) {
    if (array_key_exists('domain', $_POST) && array_key_exists('fqdn', $_POST)) {
        foreach ($_POST['domain'] as $index => $domain) {
            $fqdn = $_POST['fqdn'][$index];
            if ($domain != '' or $fqdn != '') {
                $domains[$domain] = $fqdn;
            }
        }
        OC_USER_VD_DOMAIN::saveDomains($domains);
    }
    foreach ($paramsCheck as $param) {
        if (isset($_POST[$param])) {
            OCP\Config::setAppValue('user_vd', $param, true);
        } else {
            OCP\Config::setAppValue('user_vd', $param, false);
        }
    }
}
$tmpl = new OCP\Template('user_vd', 'adminSettings');
$tmpl->assign('domains', OC_USER_VD_DOMAIN::getDomains(true));
foreach ($paramsCheck as $param) {
    $tmpl->assign($param, OCP\Config::getAppValue('user_vd', $param));
}
return $tmpl->fetchPage();
Ejemplo n.º 25
0
 * 2012 Frank Karlitschek frank@owncloud.org
 * This file is licensed under the Affero General Public License version 3 or later.
 * See the COPYING-README file.
 */
OCP\JSON::checkAppEnabled('external');
OCP\User::checkAdminUser();
OCP\JSON::callCheck();
$sites = array();
for ($i = 0; $i < sizeof($_POST['site_name']); $i++) {
    if (!empty($_POST['site_name'][$i]) && !empty($_POST['site_url'][$i])) {
        array_push($sites, array(strip_tags($_POST['site_name'][$i]), strip_tags($_POST['site_url'][$i])));
    }
}
$l = OC_L10N::get('external');
foreach ($sites as $site) {
    if (strpos($site[1], 'https://') === 0) {
        continue;
    }
    if (strpos($site[1], 'http://') === 0) {
        continue;
    }
    OC_JSON::error(array("data" => array("message" => $l->t('Please enter valid urls - they have to start with either http:// or https://'))));
    return;
}
if (sizeof($sites) == 0) {
    $appConfig = \OC::$server->getAppConfig();
    $appConfig->deleteKey('external', 'sites');
} else {
    OCP\Config::setAppValue('external', 'sites', json_encode($sites));
}
OC_JSON::success(array("data" => array("message" => $l->t("External sites saved."))));
Ejemplo n.º 26
0
<?php

//from version 0.1 to 0.2
//ATTENTION
//Upgrade from ownCloud 3 (LDAP backend 0.1) to ownCloud 4.5 (LDAP backend 0.3) is not supported!!
//You must do upgrade to ownCloud 4.0 first!
//The upgrade stuff in the section from 0.1 to 0.2 is just to minimize the bad efffects.
//settings
$pw = OCP\Config::getAppValue('user_ldap', 'ldap_password');
if (!is_null($pw)) {
    $pwEnc = base64_encode($pw);
    OCP\Config::setAppValue('user_ldap', 'ldap_agent_password', $pwEnc);
    OC_Appconfig::deleteKey('user_ldap', 'ldap_password');
}
//detect if we can switch on naming guidelines. We won't do it on conflicts.
//it's a bit spaghetti, but hey.
$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'unset');
if ($state == 'unset') {
    OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
}
// ### SUPPORTED upgrade path starts here ###
//from version 0.2 to 0.3 (0.2.0.x dev version)
$objects = array('user', 'group');
$connector = new \OCA\user_ldap\lib\Connection('user_ldap');
$userBE = new \OCA\user_ldap\USER_LDAP();
$userBE->setConnector($connector);
$groupBE = new \OCA\user_ldap\GROUP_LDAP();
$groupBE->setConnector($connector);
foreach ($objects as $object) {
    $fetchDNSql = 'SELECT `ldap_dn`, `owncloud_name` FROM `*PREFIX*ldap_' . $object . '_mapping` WHERE `directory_uuid` = ""';
    $updateSql = 'UPDATE `*PREFIX*ldap_' . $object . '_mapping` SET `ldap_DN` = ?, `directory_uuid` = ? WHERE `ldap_dn` = ?';
Ejemplo n.º 27
0
<?php

OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('files_sharing');
OCP\JSON::checkAdminUser();
if ($_POST['resharing'] == true) {
    OCP\Config::setAppValue('files_sharing', 'resharing', 'yes');
} else {
    OCP\Config::setAppValue('files_sharing', 'resharing', 'no');
}
Ejemplo n.º 28
0
* 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 Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
$params = array('maildir', 'encryptstring1', 'encryptstring2', 'removeHeaderNav');
OCP\Util::addscript('roundcube', 'settings');
if ($_POST) {
    foreach ($params as $param) {
        if (isset($_POST[$param])) {
            if ($param === 'removeHeaderNav') {
                OCP\Config::setAppValue('roundcube', 'removeHeaderNav', true);
            } else {
                OCP\Config::setAppValue('roundcube', $param, $_POST[$param]);
            }
        } else {
            if ($param === 'removeHeaderNav') {
                OCP\Config::setAppValue('roundcube', 'removeHeaderNav', false);
            }
        }
    }
}
// fill template
$tmpl = new OCP\Template('roundcube', 'adminSettings');
foreach ($params as $param) {
    $value = OCP\Config::getAppValue('roundcube', $param, '');
    $tmpl->assign($param, $value);
}
return $tmpl->fetchPage();
Ejemplo n.º 29
0
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
OC_Util::checkAdminUser();
$params = array('cas_server_version', 'cas_server_hostname', 'cas_server_port', 'cas_server_path', 'cas_group_mapping', 'cas_group_root', 'cas_aliasName');
OCP\Util::addscript('user_cas', 'settings');
if ($_POST) {
    foreach ($params as $param) {
        if (isset($_POST[$param])) {
            OCP\Config::setAppValue('user_cas', $param, $_POST[$param]);
        } elseif ('cas_autocreate' == $param) {
            OCP\Config::setAppValue('user_cas', $param, 0);
        } elseif ('cas_update_user_data' == $param) {
            OCP\Config::setAppValue('user_cas', $param, 0);
        }
    }
}
// fill template
$tmpl = new OCP\Template('user_cas', 'settings');
foreach ($params as $param) {
    $value = htmlentities(OCP\Config::getAppValue('user_cas', $param, ''));
    $tmpl->assign($param, $value);
}
// settings with default values
$tmpl->assign('cas_server_version', OCP\Config::getAppValue('user_cas', 'cas_server_version', '2.0'));
$tmpl->assign('cas_server_hostname', OCP\Config::getAppValue('user_cas', 'cas_server_hostname', 'ident.domain.fr'));
$tmpl->assign('cas_server_port', OCP\Config::getAppValue('user_cas', 'cas_server_port', '443'));
$tmpl->assign('cas_server_path', OCP\Config::getAppValue('user_cas', 'cas_server_path', '/cas'));
$tmpl->assign('cas_group_mapping', OCP\Config::getAppValue('user_cas', 'cas_group_mapping', ''));
Ejemplo n.º 30
0
 *
 * This library 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this library. If not, see <http://www.gnu.org/licenses/>.
 */
OC_Util::checkAdminUser();
OCP\Util::addStyle('user_shibboleth', 'settings');
OCP\Util::addScript('user_shibboleth', 'settings');
$params = array('sessions_handler_url', 'session_initiator_location', 'federation_name', 'enforce_domain_similarity', 'link_to_ldap_backend', 'ldap_link_attribute', 'ldap_uuid_attribute', 'external_user_quota');
if ($_POST) {
    foreach ($params as $param) {
        if (isset($_POST[$param])) {
            OCP\Config::setAppValue('user_shibboleth', $param, $_POST[$param]);
        }
    }
}
// fill template
$tmpl = new OCP\Template('user_shibboleth', 'settings');
$tmpl->assign('sessions_handler_url', OCP\Config::getAppValue('user_shibboleth', 'sessions_handler_url', ''));
$tmpl->assign('session_initiator_location', OCP\Config::getAppValue('user_shibboleth', 'session_initiator_location', ''));
$tmpl->assign('federation_name', OCP\Config::getAppValue('user_shibboleth', 'federation_name', ''));
$tmpl->assign('enforce_domain_similarity', OCP\Config::getAppValue('user_shibboleth', 'enforce_domain_similarity', '1'));
$tmpl->assign('link_to_ldap_backend', OCP\Config::getAppValue('user_shibboleth', 'link_to_ldap_backend', '0'));
$tmpl->assign('ldap_link_attribute', OCP\Config::getAppValue('user_shibboleth', 'ldap_link_attribute', 'mail'));
$tmpl->assign('ldap_uuid_attribute', OCP\Config::getAppValue('user_shibboleth', 'ldap_uuid_attribute', 'dn'));
$tmpl->assign('external_user_quota', OCP\Config::getAppValue('user_shibboleth', 'external_user_quota', ''));
return $tmpl->fetchPage();