Merge branch 'master' into movable_apps

This commit is contained in:
Georg Ehrke 2012-04-23 19:56:07 +02:00
commit 42a570788b
11 changed files with 138 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2011, Jan-Christoph Borchardt
/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
This file is licensed under the Affero General Public License version 3 or later.
See the COPYING-README file. */

View File

@ -1,3 +1,7 @@
/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
This file is licensed under the Affero General Public License version 3 or later.
See the COPYING-README file. */
#dropdown { display:block; position:absolute; z-index:100; width:16em; right:0; margin-right:7em; background:#eee; padding:1em;
-moz-box-shadow:0 1px 1px #777; -webkit-box-shadow:0 1px 1px #777; box-shadow:0 1px 1px #777;
-moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em;
@ -6,4 +10,4 @@
#public { border-top:1px solid #ddd; padding-top:0.5em; }
a.unshare { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; opacity:.5; }
a.unshare:hover { opacity:1; }
#share_with { width: 16em; }
#share_with { width: 16em; }

View File

@ -1,3 +1,7 @@
/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
This file is licensed under the Affero General Public License version 3 or later.
See the COPYING-README file. */
#controls ul.jp-controls { padding:0; }
#controls ul.jp-controls li { display:inline; }
#controls ul.jp-controls li a { position:absolute; padding:.8em 1em .8em 0; }

View File

@ -25,6 +25,7 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
// //group specific settings
protected $ldapGroupFilter;
protected $ldapGroupDisplayName;
protected $ldapGroupMemberAttr;
public function __construct() {
$this->ldapGroupFilter = OC_Appconfig::getValue('user_ldap', 'ldap_group_filter', '(objectClass=posixGroup)');
@ -46,14 +47,12 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
LDAP_GROUP_MEMBER_ASSOC_ATTR.'='.$uid,
$this->ldapGroupDisplayName.'='.$gid
));
$groups = OC_LDAP::search($filter, $this->ldapGroupDisplayName);
$groups = $this->retrieveList($filter, $this->ldapGroupDisplayName);
if(count($groups) == 1) {
if(count($groups) > 0) {
return true;
} else if(count($groups) < 1) {
return false;
} else {
throw new Exception('Too many groups of the same name!? this exception should never been thrown :)');
return false;
}
}
@ -84,7 +83,7 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
$this->ldapGroupDisplayName.'='.$gid
));
return $this->retrieveList($filter, $this->ldapGroupMemberAttr);
return $this->retrieveList($filter, $this->ldapGroupMemberAttr, false);
}
/**
@ -94,13 +93,7 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
* Returns a list with all groups
*/
public function getGroups() {
$groups = OC_LDAP::search($this->ldapGroupFilter, $this->ldapGroupDisplayName);
if(count($groups) == 0 )
return array();
else {
return array_unique($groups, SORT_LOCALE_STRING);
}
return $this->retrieveList($this->ldapGroupFilter, $this->ldapGroupDisplayName);
}
/**
@ -112,8 +105,13 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
return in_array($gid, $this->getGroups());
}
private function retrieveList($filter, $attr) {
$list = OC_LDAP::search($filter, $attr);
private function retrieveList($filter, $attr, $searchForGroups = true) {
if($searchForGroups) {
$list = OC_LDAP::searchGroups($filter, $attr);
} else {
$list = OC_LDAP::searchUsers($filter, $attr);
}
if(is_array($list)) {
return array_unique($list, SORT_LOCALE_STRING);

View File

@ -38,6 +38,8 @@ class OC_LDAP {
static protected $ldapHost;
static protected $ldapPort;
static protected $ldapBase;
static protected $ldapBaseUsers;
static protected $ldapBaseGroups;
static protected $ldapAgentName;
static protected $ldapAgentPassword;
static protected $ldapTLS;
@ -65,15 +67,40 @@ class OC_LDAP {
}
/**
* @brief executes an LDAP search
* @brief executes an LDAP search, optimized for Users
* @param $filter the LDAP filter for the search
* @param $attr optional, when a certain attribute shall be filtered out
* @returns array with the search result
*
* Executes an LDAP search
*/
static public function search($filter, $attr = null) {
$sr = ldap_search(self::getConnectionResource(), self::$ldapBase, $filter);
static public function searchUsers($filter, $attr = null) {
return self::search($filter, self::$ldapBaseUsers, $attr);
}
/**
* @brief executes an LDAP search, optimized for Groups
* @param $filter the LDAP filter for the search
* @param $attr optional, when a certain attribute shall be filtered out
* @returns array with the search result
*
* Executes an LDAP search
*/
static public function searchGroups($filter, $attr = null) {
return self::search($filter, self::$ldapBaseGroups, $attr);
}
/**
* @brief executes an LDAP search
* @param $filter the LDAP filter for the search
* @param $base the LDAP subtree that shall be searched
* @param $attr optional, when a certain attribute shall be filtered out
* @returns array with the search result
*
* Executes an LDAP search
*/
static private function search($filter, $base, $attr = null) {
$sr = ldap_search(self::getConnectionResource(), $base, $filter, array($attr));
$findings = ldap_get_entries(self::getConnectionResource(), $sr );
if(!is_null($attr)) {
@ -150,7 +177,9 @@ class OC_LDAP {
self::$ldapPort = OC_Appconfig::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT);
self::$ldapAgentName = OC_Appconfig::getValue('user_ldap', 'ldap_dn','');
self::$ldapAgentPassword = OC_Appconfig::getValue('user_ldap', 'ldap_password','');
self::$ldapBase = OC_Appconfig::getValue('user_ldap', 'ldap_base','');
self::$ldapBase = OC_Appconfig::getValue('user_ldap', 'ldap_base', '');
self::$ldapBaseUsers = OC_Appconfig::getValue('user_ldap', 'ldap_base_users',self::$ldapBase);
self::$ldapBaseGroups = OC_Appconfig::getValue('user_ldap', 'ldap_base_groups', self::$ldapBase);
self::$ldapTLS = OC_Appconfig::getValue('user_ldap', 'ldap_tls',0);
self::$ldapNoCase = OC_Appconfig::getValue('user_ldap', 'ldap_nocase', 0);
self::$ldapUserDisplayName = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME);
@ -163,6 +192,8 @@ class OC_LDAP {
|| ( empty(self::$ldapAgentName) && empty(self::$ldapAgentPassword))
)
&& !empty(self::$ldapBase)
&& !empty(self::$ldapBaseUsers)
&& !empty(self::$ldapBaseGroups)
&& !empty(self::$ldapUserDisplayName)
)
{

View File

@ -1,7 +1,11 @@
/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
This file is licensed under the Affero General Public License version 3 or later.
See the COPYING-README file. */
ul.multiselectoptions { z-index:49; position:absolute; background-color:#fff; padding-top:.5em; border:1px solid #ddd; border-top:none; -moz-border-radius-bottomleft:.5em; -webkit-border-bottom-left-radius:.5em; border-bottom-left-radius:.5em; -moz-border-radius-bottomright:.5em; -webkit-border-bottom-right-radius:.5em; border-bottom-right-radius:.5em; -moz-box-shadow:0 1px 1px #ddd; -webkit-box-shadow:0 1px 1px #ddd; box-shadow:0 1px 1px #ddd; }
ul.multiselectoptions>li{ white-space:nowrap; overflow: hidden; }
div.multiselect { padding-right:.6em; display:inline; position:relative; display:inline-block; vertical-align: bottom; }
div.multiselect { padding-right:.6em; display:inline; position:relative; display:inline-block; vertical-align: bottom; min-width:100px; max-width:400px; }
div.multiselect.active { background-color:#fff; border-bottom:none; border-bottom-left-radius:0; border-bottom-right-radius:0; z-index:50; position:relative }
div.multiselect>span:first-child { margin-right:2em; float:left; }
div.multiselect>span:last-child { float:right; position:relative }
div.multiselect>span:first-child { margin-right:2em; float:left; width:90%; overflow:hidden; text-overflow:ellipsis; }
div.multiselect>span:last-child { position:absolute; right:.8em; }
ul.multiselectoptions input.new{ margin:0; padding-bottom:0.2em; padding-top:0.2em; border-top-left-radius:0; border-top-right-radius:0; }

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2011, Jan-Christoph Borchardt
/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
This file is licensed under the Affero General Public License version 3 or later.
See the COPYING-README file. */

View File

@ -88,6 +88,9 @@ class OC{
elseif(strpos($className,'OC_')===0){
require_once strtolower(str_replace('_','/',substr($className,3)) . '.php');
}
elseif(strpos($className,'OCP\\')===0){
require_once 'public/'.strtolower(str_replace('\\','/',substr($className,3)) . '.php');
}
elseif(strpos($className,'Sabre_')===0) {
require_once str_replace('_','/',$className) . '.php';
}
@ -436,4 +439,4 @@ if(!function_exists('get_temp_dir')) {
}
}
OC::init();
OC::init();

60
lib/public/util.php Normal file
View File

@ -0,0 +1,60 @@
<?php
/**
* ownCloud
*
* @author Frank Karlitschek
* @copyright 2010 Frank Karlitschek karlitschek@kde.org
*
* 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/>.
*
*/
/**
* Public interface of ownCloud for apps to use.
* Utility Class.
*
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
class Util {
/**
* send an email
*
* @param string $toaddress
* @param string $toname
* @param string $subject
* @param string $mailtext
* @param string $fromaddress
* @param string $fromname
* @param bool $html
*/
public static function sendmail($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='',$bcc='') {
// call the internal mail class
OC_MAIL::send($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='',$bcc='');
}
}
?>

View File

@ -1,3 +1,7 @@
/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
This file is licensed under the Affero General Public License version 3 or later.
See the COPYING-README file. */
#searchresults { list-style:none; position:fixed; top:3.5em; right:0; z-index:75; background-color:#fff; overflow:hidden; text-overflow:ellipsis; max-height:80%; width:26.5em; padding-bottom:1em; -moz-box-shadow:0 0 10px #000; -webkit-box-shadow:0 0 10px #000; box-shadow:0 0 10px #000; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; }
#searchresults li.resultHeader { font-size:1.2em; font-weight:bold; border-bottom:solid 1px #CCC; padding:.2em; background-color:#eee; }
#searchresults li.result { margin-left:2em; }

View File

@ -1,3 +1,7 @@
/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
This file is licensed under the Affero General Public License version 3 or later.
See the COPYING-README file. */
select#languageinput, select#timezone { width:15em; }
input#openid, input#webdav { width:20em; }