Projects
Kolab:3.4
kolab-webadmin
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 10
View file
kolab-webadmin.spec
Changed
@@ -34,14 +34,13 @@ %global kolabr_group_id 414 Name: kolab-webadmin -Version: 3.1 -Release: 0.1.dev20130712.git3b093b%{?dist} +Version: 3.1.0 +Release: 1%{?dist} Summary: Kolab Groupware Server Web Administration Interface License: AGPLv3+ Group: Productivity/Office/Organizers Url: http://www.kolab.org -# From http://git.kolab.org/kolab-wap/snapshot/f11818cff39f33021ff1017c1e8a1c6a8b3b093b.tar.gz Source0: http://mirror.kolabsys.com/pub/releases/kolab-webadmin-%{version}.tar.gz BuildArch: noarch @@ -142,6 +141,9 @@ %attr(0770,%{httpd_user},%{httpd_group}) %{_var}/log/%{name} %changelog +* Fri Sep 13 2013 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 3.1.0-1 +- New upstream release + * Fri Jul 12 2013 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 3.1-0.1 - Check in today's development snapshot - Make sure replicas and replication agreements are created when adding
View file
debian.changelog
Changed
@@ -1,3 +1,9 @@ +kolab-webadmin (3.1.0-1) unstable; urgency=low + + * Version 3.1.0 + + -- Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Fri, 13 Sep 2013 09:49:12 -0400 + kolab-webadmin (3.1~dev20130712-1) unstable; urgency=low * Version 3.1 development snapshot for Kolab 3.1
View file
kolab-webadmin-3.1.tar.gz/doc/sample-insert-user_types.php -> kolab-webadmin-3.1.0.tar.gz/doc/sample-insert-user_types.php
Changed
@@ -407,7 +407,6 @@ "uid" => Array( "data" => Array( "givenname", - "preferredlanguage", "sn", ), ),
View file
kolab-webadmin-3.1.tar.gz/doc/sample-kolab.conf -> kolab-webadmin-3.1.0.tar.gz/doc/sample-kolab.conf
Changed
@@ -17,6 +17,18 @@ archving = openbenno default_quota = 2097152 virtual_domains = userid +primary_mail = %(givenname)s.%(surname)s@%(domain)s +secondary_mail = { + 0: { + "{0}.{1}@{2}": "format('%(givenname)s'[0:1].capitalize(), '%(surname)s', '%(domain)s')" + }, + 1: { + "{0}@{1}": "format('%(uid)s', '%(domain)s')" + }, + 2: { + "{0}@{1}": "format('%(givenname)s.%(surname)s', '%(domain)s')" + } + } [ldap] uri = ldap://ldap.klab.cc @@ -76,15 +88,3 @@ [klab.cc] default_quota = 131072 -primary_mail = %(givenname)s.%(surname)s@%(domain)s -secondary_mail = { - 0: { - "{0}.{1}@{2}": "format('%(givenname)s'[0:1].capitalize(), '%(surname)s', '%(domain)s')" - }, - 1: { - "{0}@{1}": "format('%(uid)s', '%(domain)s')" - }, - 2: { - "{0}@{1}": "format('%(givenname)s.%(surname)s', '%(domain)s')" - } - }
View file
kolab-webadmin-3.1.tar.gz/lib/Auth.php -> kolab-webadmin-3.1.0.tar.gz/lib/Auth.php
Changed
@@ -297,7 +297,7 @@ public function list_users($domain = NULL, $attributes = array(), $search = array(), $params = array()) { - return $this->auth_instance()->list_users($attributes, $search, $params); + return $this->auth_instance($domain)->list_users($attributes, $search, $params); } public function list_groups($domain = NULL, $attributes = array(), $search = array(), $params = array())
View file
kolab-webadmin-3.1.tar.gz/lib/Auth/LDAP.php -> kolab-webadmin-3.1.0.tar.gz/lib/Auth/LDAP.php
Changed
@@ -46,12 +46,13 @@ $this->config_set("debug", true); $this->config_set("log_hook", array($this, "_log")); - //$this->config_set("vlv", false); $this->config_set("config_root_dn", "cn=config"); - $this->config_set("service_bind_dn", $this->conf->get("service_bind_dn")); $this->config_set("service_bind_pw", $this->conf->get("service_bind_pw")); + $this->config_set("login_filter", $this->conf->get("kolab_wap", "login_filter")); + $this->config_set("vlv", $this->conf->get("ldap", "vlv", Conf::AUTO)); + // See if we are to connect to any domain explicitly defined. if (empty($domain)) { // If not, attempt to get the domain from the session. @@ -67,7 +68,7 @@ } // Continue and default to the primary domain. - $this->domain = $domain ? $domain : $this->conf->get('primary_domain'); + $this->domain = $domain ? $domain : $this->conf->get('primary_domain'); $unique_attr = $this->conf->get($domain, 'unique_attribute'); @@ -204,6 +205,7 @@ ); $replica_hosts = $this->list_replicas(); + if (!empty($replica_hosts)) { foreach ($replica_hosts as $replica_host) { Log::trace("Iterating over replication partners (now: $replica_host)"); @@ -264,7 +266,6 @@ 'nsslapd-dncachememsize' => '10485760' ); - $replica_hosts = $this->list_replicas(); if (!empty($replica_hosts)) { foreach ($replica_hosts as $replica_host) { $ldap = new Net_LDAP3($this->config); @@ -370,7 +371,6 @@ ), ); - $replica_hosts = $this->list_replicas(); if (!empty($replica_hosts)) { foreach ($replica_hosts as $replica_host) { $ldap = new Net_LDAP3($this->config); @@ -508,8 +508,9 @@ $domain_filter = "(&" . $domain_filter . "(" . $domain_name_attribute . "=" . $domain . "))"; $this->_log(LOG_DEBUG, "Auth::LDAP::domain_info() uses _search()"); - $result = $this->_search($domain_base_dn, $domain_filter, $attributes); - $result = $result->entries(true); + if ($result = $this->_search($domain_base_dn, $domain_filter, $attributes)) { + $result = $result->entries(true); + } } else { $this->_log(LOG_DEBUG, "Auth::LDAP::domain_info() uses _read()"); @@ -531,6 +532,19 @@ */ public function effective_rights($subject) { + $cache = $this->get_cache(); + $ckey = $_SESSION['user']->user_bind_dn . '#' + . md5($this->domain . '::' . $subject . '::' . $_SESSION['user']->user_bind_pw); + + // use memcache + if ($cache && ($result = $cache->get($ckey))) { + return $result; + } + // use internal cache + else if (isset($this->icache[$ckey])) { + return $this->icache[$ckey]; + } + // Ensure we are bound with the user's credentials $this->bind($_SESSION['user']->user_bind_dn, $_SESSION['user']->user_bind_pw); @@ -539,6 +553,7 @@ switch ($subject) { case "domain": $result = parent::effective_rights($this->conf->get("ldap", "domain_base_dn")); + break; case "group": case "resource": @@ -546,23 +561,33 @@ case "sharedfolder": case "user": $result = parent::effective_rights($this->_subject_base_dn($subject)); + break; default: $result = parent::effective_rights($subject); } if (!$result) { - return $this->legacy_rights($subject); - } else { - return $result; + $result = $this->legacy_rights($subject); } + + if ($cache) { + if (!$cache->replace($ckey, $result, MEMCACHE_COMPRESSED, 3600)) { + $cache->set($ckey, $result, MEMCACHE_COMPRESSED, 3600); + } + } + else { + $this->icache[$ckey] = $result; + } + + return $result; } public function find_recipient($address) { $this->bind($_SESSION['user']->user_bind_dn, $_SESSION['user']->user_bind_pw); - $mail_attrs = $this->conf->get_list('mail_attributes', array('mail', 'alias')); + $mail_attrs = $this->conf->get_list('mail_attributes') ?: array('mail', 'alias'); $search = array('operator' => 'OR'); foreach ($mail_attrs as $num => $attr) { @@ -989,6 +1014,29 @@ } /** + * Returns attributes available in specified object classes + */ + public function attributes_allowed($objectclasses = array()) + { + $attributes = parent::attributes_allowed($objectclasses); + + // additional special attributes that aren't in LDAP schema + $additional_attributes = array( + 'top' => array('nsRoleDN'), + ); + + if (!empty($attributes)) { + foreach ($additional_attributes as $class => $attrs) { + if (in_array($class, $objectclasses)) { + $attributes['may'] = array_merge($attributes['may'], $attrs); + } + } + } + + return $attributes; + } + + /** * Wrapper for search_entries() */ protected function _list($base_dn, $filter, $scope, $attributes, $search, $params) @@ -1228,7 +1276,7 @@ 'attributeLevelRights' => array(), ); - $subject = $this->_search($subject_dn); + $subject = $this->_search($subject_dn); if (!$subject) { return $rights; @@ -1365,7 +1413,7 @@ $domain_name_attribute = 'associateddomain'; } - $domain_filter = "(&" . $domain_filter . "(" . $domain_name_attribute . "=" . $domain . "))"; + $domain_filter = "(&" . $domain_filter . "(" . $domain_name_attribute . "=" . $domain . "))"; $result = $this->_search($domain_base_dn, $domain_filter); @@ -1373,8 +1421,8 @@ return $this->_standard_root_dn($domain); } - $entries = $result->entries(true); - $entry_dn = key($entries); + $entries = $result->entries(true); + $entry_dn = key($entries); $entry_attrs = $entries[$entry_dn]; if (is_array($entry_attrs)) { @@ -1483,4 +1531,66 @@ return "dc=" . implode(',dc=', explode('.', $relevant_associatedDomain)); } + /** + * Get global handle for memcache access + * + * @return object Memcache + */ + public function get_cache() + { + if (!isset($this->memcache)) { + // no memcache support in PHP + if (!class_exists('Memcache')) { + $this->memcache = false; + return false; + } + // add all configured hosts to pool + $pconnect = $this->conf->get('kolab_wap', 'memcache_pconnect', Conf::BOOL); + $hosts = $this->conf->get('kolab_wap', 'memcache_hosts'); + + if ($hosts) { + $this->memcache = new Memcache; + $this->mc_available = 0; + + $hosts = explode(',', $hosts); + foreach ($hosts as $host) { + $host = trim($host); + if (substr($host, 0, 7) != 'unix://') { + list($host, $port) = explode(':', $host); + if (!$port) $port = 11211; + } + else { + $port = 0; + } + + $this->mc_available += intval($this->memcache->addServer( + $host, $port, $pconnect, 1, 1, 15, false, array($this, 'memcache_failure'))); + } + } + + // test connection and failover (will result in $this->mc_available == 0 on complete failure) + $this->memcache->increment('__CONNECTIONTEST__', 1); // NOP if key doesn't exist + + if (!$this->mc_available) { + $this->memcache = false; + } + } + + return $this->memcache; + } + + /** + * Callback for memcache failure + */ + public function memcache_failure($host, $port) + { + static $seen = array(); + + // only report once + if (!$seen["$host:$port"]++) { + $this->mc_available--; + Log::error("Memcache failure on host $host:$port"); + } + } + }
View file
kolab-webadmin-3.1.tar.gz/lib/Conf.php -> kolab-webadmin-3.1.0.tar.gz/lib/Conf.php
Changed
@@ -34,6 +34,7 @@ const BOOL = 1; const INT = 2; const FLOAT = 3; + const AUTO = 4; /** * This implements the 'singleton' design pattern @@ -70,10 +71,15 @@ switch ($type) { case self::INT: return intval($value); + case self::FLOAT: return floatval($value); + case self::BOOL: return (bool) preg_match('/^(true|1|on|enabled|yes)$/i', $value); + + case self::AUTO: + return $this->auto($value); } return (string) $value; @@ -81,8 +87,7 @@ public function get_list($key1, $key2 = NULL) { - $list = array(); - + $list = array(); $value = $this->get($key1, $key2); $value_components = explode(',', $value); @@ -112,26 +117,41 @@ } } + // If section is specified, but requested setting doesn't exist there + // we fall back to (global) 'kolab' section + if ($key2) { + if (isset($this->_conf['kolab'][$key2])) { + return $this->_conf['kolab'][$key2]; + } +/* + // fall back to primary domain section + $primary_domain = $this->_conf['kolab']['primary_domain']; + if ($primary_domain && isset($this->_conf[$primary_domain])) { + if (isset($this->_conf[$primary_domain][$key2])) { + return $this->_conf[$primary_domain][$key2]; + } + } +*/ + return null; + } + // Simple (global) settings may be obtained by calling the key and // omitting the section. This goes for sections 'kolab', and whatever // is the equivalent of 'kolab', 'auth_mechanism', such as getting // 'ldap_uri', which is in the [$domain] section, or in section 'ldap', // and we can try and iterate over it. - // First, try the most exotic. + // First, try user domain. if (isset($_SESSION['user']) && method_exists($_SESSION['user'], 'get_domain')) { try { - $domain_section_name = $_SESSION['user']->get_domain(); - if (isset($this->_conf[$domain_section_name]) && isset($this->_conf[$domain_section_name][$key1])) { - return $this->_conf[$domain_section_name][$key1]; - } - } catch (Exception $e) { - if ($domain_section_name = $this->_conf['kolab']['primary_domain']) { - if (isset($this->_conf[$domain_section_name]) && isset($this->_conf[$domain_section_name][$key1])) { - return $this->_conf[$domain_section_name][$key1]; + $domain = $_SESSION['user']->get_domain(); + + if ($domain && isset($this->_conf[$domain])) { + if (isset($this->_conf[$domain][$key1])) { + return $this->_conf[$domain][$key1]; } } - } + } catch (Exception $e) { } } // Fall back to whatever is the equivalent of auth_mechanism as the @@ -211,4 +231,30 @@ } } } + + /** + * Auto-detection and conversion of config value + */ + private function auto($value) + { + if (preg_match('/^(true|on|enabled|yes|false|off|disabled|no)$/i', $value)) { + return (bool) preg_match('/^(true|on|enabled|yes)$/i', $value); + } + + if (is_numeric($value)) { + if (strpos($value, '.')) { + return floatval($value); + } + else { + return intval($value); + } + } + + // array in JSON format + if ($value[0] == '{' || $value[0] == '[') { + return json_decode($value, true); + } + + return (string) $value; + } }
View file
kolab-webadmin-3.1.tar.gz/lib/api/kolab_api_service_domain.php -> kolab-webadmin-3.1.0.tar.gz/lib/api/kolab_api_service_domain.php
Changed
@@ -135,11 +135,9 @@ return false; } - $domain_attributes = $this->parse_input_attributes('domain', $postdata); - $domain = $postdata['id']; - - $auth = Auth::get_instance(); - $result = $auth->domain_edit($postdata['id'], $domain_attributes, $postdata['type_id']); + $auth = Auth::get_instance(); + $attributes = $this->parse_input_attributes('domain', $postdata); + $result = $auth->domain_edit($postdata['id'], $attributes, $postdata['type_id']); // @TODO: return unique attribute or all attributes as domain_add() if ($result) { @@ -152,9 +150,8 @@ public function domain_effective_rights($getdata, $postdata) { $auth = Auth::get_instance(); - $conf = Conf::get_instance(); - $dna = $conf->get('domain_name_attribute'); + $dna = $conf->get('domain_name_attribute'); if (empty($dna)) { $dna = 'associateddomain'; @@ -171,7 +168,6 @@ } } else { - $conf = Conf::get_instance(); $entry_dn = $conf->get('ldap', 'domain_base_dn'); } @@ -184,9 +180,8 @@ public function domain_find($getdata, $postdata) { - $auth = Auth::get_instance(); $conf = Conf::get_instance(); - $dna = $conf->get('domain_name_attribute'); + $dna = $conf->get('domain_name_attribute'); if (empty($dna)) { $dna = 'associateddomain'; @@ -197,7 +192,8 @@ return false; } - $domain = $auth->domain_find_by_attribute(array($dna => $getdata[$dna])); + $auth = Auth::get_instance(); + $domain = $auth->domain_find_by_attribute(array($dna => $getdata[$dna])); if (!empty($domain)) { return $domain; @@ -230,7 +226,7 @@ $result = $this->parse_result_attributes('domain', $result); if (empty($result['id'])) { - $result['id'] = $getdata[$dna]; + $result['id'] = $getdata['id']; } if ($result) {
View file
kolab-webadmin-3.1.tar.gz/lib/api/kolab_api_service_domain_types.php -> kolab-webadmin-3.1.0.tar.gz/lib/api/kolab_api_service_domain_types.php
Changed
@@ -28,6 +28,33 @@ */ class kolab_api_service_domain_types extends kolab_api_service { + public static $DEFAULT_TYPE_ATTRS = array( + 'auto_form_fields' => array(), + 'form_fields' => array( + 'associateddomain' => array( + 'type' => 'list' + ), + 'inetdomainbasedn' => array( + 'optional' => true, + ), + 'inetdomainstatus' => array( + 'optional' => true, + 'type' => 'select', + 'values' => array( + '', 'active', 'suspended', + ), + ), + ), + 'fields' => array( + 'objectclass' => array( + 'top', + 'domainrelatedobject', + 'inetdomain', + ), + ), + ); + + /** * Returns service capabilities. * @@ -55,31 +82,10 @@ // @TODO: move to database $types = array( 1 => array( - 'key' => 'standard', - 'name' => 'Standard domain', + 'key' => 'standard', + 'name' => 'Standard domain', 'description' => 'A standard domain name space', - 'attributes' => array( - 'auto_form_fields' => array(), - 'form_fields' => array( - 'associateddomain' => array( - 'type' => 'list', - ), - 'inetdomainbasedn' => array( - 'optional' => 'true', - ), - 'inetdomainstatus' => array( - 'type' => 'checkbox', - 'optional' => true, - ), - ), - 'fields' => array( - 'objectclass' => array( - 'top', - 'domainrelatedobject', - 'inetdomain', - ), - ), - ), + 'attributes' => self::$DEFAULT_TYPE_ATTRS, ), );
View file
kolab-webadmin-3.1.tar.gz/lib/api/kolab_api_service_form_value.php -> kolab-webadmin-3.1.0.tar.gz/lib/api/kolab_api_service_form_value.php
Changed
@@ -223,13 +223,13 @@ } } - if (array_key_exists($attr_name, $attribs['form_fields'])) { + if (array_key_exists($attr_name, (array) $attribs['form_fields'])) { if (empty($attribs['form_fields'][$attr_name]['optional'])) { $attribs['form_fields'][$attr_name]['optional'] = false; } } - if (array_key_exists($attr_name, $attribs['form_fields'])) { + if (array_key_exists($attr_name, (array) $attribs['form_fields'])) { if (empty($attribs['form_fields'][$attr_name]['validate'])) { $attribs['form_fields'][$attr_name]['validate'] = true; } @@ -257,8 +257,8 @@ { $rcpt_pol_aliases = $this->generate_secondary_mail($postdata, $attribs); - $service = $this->controller->get_service('user'); - $user_attrs = $service->user_info(array('id' => $postdata['id']), null); + $service = $this->controller->get_service('user'); + $user_attrs = $service->user_info(array('id' => $postdata['id']), null); if (!empty($user_attrs['alias'])) { $cur_aliases = $user_attrs['alias']; @@ -485,31 +485,42 @@ // TODO: Take a policy to use a known group ID, a known group (by name?) // and/or create user private groups. - $search = Array( - 'params' => Array( - 'objectclass' => Array( - 'type' => 'exact', - 'value' => 'posixgroup', - ), - ), - ); - - $groups = $auth->list_groups(NULL, Array('gidnumber'), $search); + // groups search parameters + $params = array('page_size' => 200); + $search = array( + 'operator' => 'AND', + 'params' => array( + 'objectclass' => array( + 'type' => 'exact', + 'value' => 'posixgroup', + ), + 'gidnumber' => array( + 'type' => '>=', + ) + ), + ); $highest_gidnumber = $conf->get('gidnumber_lower_barrier'); if (!$highest_gidnumber) { $highest_gidnumber = 999; } - foreach ($groups['list'] as $dn => $attributes) { - if (!array_key_exists('gidnumber', $attributes)) { - continue; - } + do { + $search['params']['gidnumber']['value'] = $highest_gidnumber; + + $groups = $auth->list_groups(NULL, array('gidnumber'), $search, $params); - if ($attributes['gidnumber'] > $highest_gidnumber) { - $highest_gidnumber = $attributes['gidnumber']; + foreach ($groups['list'] as $dn => $attributes) { + if (!array_key_exists('gidnumber', $attributes)) { + continue; + } + + if ($attributes['gidnumber'] > $highest_gidnumber) { + $highest_gidnumber = $attributes['gidnumber']; + } } } + while ($groups['count'] == $params['page_size']); $gidnumber = ($highest_gidnumber + 1); $postdata['gidnumber'] = $gidnumber; @@ -830,33 +841,45 @@ private function generate_uidnumber($postdata, $attribs = array()) { if (isset($attribs['auto_form_fields']) && isset($attribs['auto_form_fields']['uidnumber'])) { + $auth = Auth::get_instance($_SESSION['user']->get_domain()); + $conf = Conf::get_instance(); + + // users search parameters + $params = array('page_size' => 200); $search = array( - 'params' => array( + 'operator' => 'AND', + 'params' => array( 'objectclass' => array( 'type' => 'exact', 'value' => 'posixaccount', ), + 'uidnumber' => array( + 'type' => '>=', + ), ), ); - $auth = Auth::get_instance($_SESSION['user']->get_domain()); - $conf = Conf::get_instance(); - $users = $auth->list_users(NULL, Array('uidnumber'), $search); - $highest_uidnumber = $conf->get('uidnumber_lower_barrier'); if (!$highest_uidnumber) { $highest_uidnumber = 999; } - foreach ($users['list'] as $dn => $attributes) { - if (!array_key_exists('uidnumber', $attributes)) { - continue; - } + do { + $search['params']['uidnumber']['value'] = $highest_uidnumber; + + $users = $auth->list_users(NULL, array('uidnumber'), $search, $params); - if ($attributes['uidnumber'] > $highest_uidnumber) { - $highest_uidnumber = $attributes['uidnumber']; + foreach ($users['list'] as $dn => $attributes) { + if (!array_key_exists('uidnumber', $attributes)) { + continue; + } + + if ($attributes['uidnumber'] > $highest_uidnumber) { + $highest_uidnumber = $attributes['uidnumber']; + } } } + while ($users['count'] == $params['page_size']); $uidnumber = ($highest_uidnumber + 1); $postdata['uidnumber'] = $uidnumber; @@ -1153,8 +1176,16 @@ private function validate_mailquota($value) { - //return (int)($value); - return $value; + // convert MB/GB into KB + if (preg_match('/^([0-9]+)\s*(KB|MB|GB)$/i', $value, $m)) { + switch (strtoupper($m[2])) { + case 'KB': $value = $m[1]; break; + case 'MB': $value = $m[1] * 1024; break; + case 'GB': $value = $m[1] * 1024 * 1024; break; + } + } + + return (int) $value; } private function validate_mailalternateaddress($value)
View file
kolab-webadmin-3.1.tar.gz/lib/api/kolab_api_service_group.php -> kolab-webadmin-3.1.0.tar.gz/lib/api/kolab_api_service_group.php
Changed
@@ -39,7 +39,7 @@ { //console("kolab_api_service_group::capabilities"); - $auth = Auth::get_instance(); + $auth = Auth::get_instance($domain); $effective_rights = $auth->list_rights('group'); $rights = array();
View file
kolab-webadmin-3.1.tar.gz/lib/api/kolab_api_service_resource.php -> kolab-webadmin-3.1.0.tar.gz/lib/api/kolab_api_service_resource.php
Changed
@@ -39,7 +39,7 @@ { //console("kolab_api_service_group::capabilities"); - $auth = Auth::get_instance(); + $auth = Auth::get_instance($domain); $effective_rights = $auth->list_rights('resource'); $rights = array();
View file
kolab-webadmin-3.1.tar.gz/lib/api/kolab_api_service_role.php -> kolab-webadmin-3.1.0.tar.gz/lib/api/kolab_api_service_role.php
Changed
@@ -39,7 +39,7 @@ { //console("kolab_api_service_role::capabilities"); - $auth = Auth::get_instance(); + $auth = Auth::get_instance($domain); $effective_rights = $auth->list_rights('role'); $rights = array();
View file
kolab-webadmin-3.1.tar.gz/lib/api/kolab_api_service_sharedfolder.php -> kolab-webadmin-3.1.0.tar.gz/lib/api/kolab_api_service_sharedfolder.php
Changed
@@ -39,7 +39,7 @@ { //console("kolab_api_service_group::capabilities"); - $auth = Auth::get_instance(); + $auth = Auth::get_instance($domain); $effective_rights = $auth->list_rights('sharedfolder'); $rights = array();
View file
kolab-webadmin-3.1.tar.gz/lib/api/kolab_api_service_user.php -> kolab-webadmin-3.1.0.tar.gz/lib/api/kolab_api_service_user.php
Changed
@@ -39,7 +39,7 @@ { //console("kolab_api_service_group::capabilities"); - $auth = Auth::get_instance(); + $auth = Auth::get_instance($domain); $effective_rights = $auth->list_rights('user'); @@ -125,13 +125,6 @@ { //console("\$postdata to user_edit()", $postdata); - if ($postdata['mailquota-unit'] == 'gb') { - $postdata['mailquota'] *= 1024*1024; - } - if ($postdata['mailquota-unit'] == 'mb') { - $postdata['mailquota'] *= 1024; - } - $user_attributes = $this->parse_input_attributes('user', $postdata); $user = $postdata['id'];
View file
kolab-webadmin-3.1.tar.gz/lib/client/kolab_client_task_domain.php -> kolab-webadmin-3.1.0.tar.gz/lib/client/kolab_client_task_domain.php
Changed
@@ -30,6 +30,12 @@ 'add' => 'domain.add', ); + protected $search_attribs = array( + 'name' => array('associateddomain'), + ); + + protected $list_attribs = array('associateddomain'); + /** * Default action. */ @@ -63,130 +69,7 @@ } } - $page_size = 20; - $page = (int) self::get_input('page', 'POST'); - if (!$page || $page < 1) { - $page = 1; - } - - // request parameters - $post = array( - 'attributes' => array('associateddomain'), -// 'sort_order' => 'ASC', - 'sort_by' => 'associateddomain', - 'page_size' => $page_size, - 'page' => $page, - ); - - // search parameters - if (!empty($_POST['search'])) { - $search = self::get_input('search', 'POST', true); - $field = self::get_input('field', 'POST'); - $method = self::get_input('method', 'POST'); - - $search_request = array( - $field => array( - 'value' => $search, - 'type' => $method, - ), - ); - } - else if (!empty($_POST['search_request'])) { - $search_request = self::get_input('search_request', 'POST'); - $search_request = @unserialize(base64_decode($search_request)); - } - - if (!empty($search_request)) { - $post['search'] = $search_request; - $post['search_operator'] = 'OR'; - } - - // get domains list - $result = $this->api_post('domains.list', null, $post); - $count = (int) $result->get('count'); - $result = (array) $result->get('list'); - - // calculate records - if ($count) { - $start = 1 + max(0, $page - 1) * $page_size; - $end = min($start + $page_size - 1, $count); - } - - $rows = $head = $foot = array(); - $cols = array('name'); - $i = 0; - - // table header - $head[0]['cells'][] = array('class' => 'name', 'body' => $this->translate('domain.list')); - - // table footer (navigation) - if ($count) { - $pages = ceil($count / $page_size); - $prev = max(0, $page - 1); - $next = $page < $pages ? $page + 1 : 0; - - $count_str = kolab_html::span(array( - 'content' => $this->translate('list.records', $start, $end, $count)), true); - $prev = kolab_html::a(array( - 'class' => 'prev' . ($prev ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $prev ? "kadm.command('domain.list', {page: $prev})" : "return false", - )); - $next = kolab_html::a(array( - 'class' => 'next' . ($next ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $next ? "kadm.command('domain.list', {page: $next})" : "return false", - )); - - $foot_body = kolab_html::span(array('content' => $prev . $count_str . $next)); - } - $foot[0]['cells'][] = array('class' => 'listnav', 'body' => $foot_body); - - // table body - if (!empty($result)) { - foreach ($result as $idx => $item) { - //console($idx); - if (!is_array($item) || empty($item['associateddomain'])) { - continue; - } - - $i++; - $cells = array(); - - if (is_array($item['associateddomain'])) { - $domain_name = $item['associateddomain'][0]; - } else { - $domain_name = $item['associateddomain']; - } - - $cells[] = array('class' => 'name', 'body' => kolab_html::escape($domain_name), - 'onclick' => "kadm.command('domain.info', '$idx')"); - $rows[] = array('id' => $i, 'class' => 'selectable', 'cells' => $cells); - } - } - else { - $rows[] = array('cells' => array( - 0 => array('class' => 'empty-body', 'body' => $this->translate('domain.norecords') - ))); - } - - $table = kolab_html::table(array( - 'id' => 'domainlist', - 'class' => 'list', - 'head' => $head, - 'body' => $rows, - 'foot' => $foot, - )); - - if ($this->action == 'list') { - $this->output->command('set_watermark', 'taskcontent'); - } - - $this->output->set_env('search_request', $search_request ? base64_encode(serialize($search_request)) : null); - $this->output->set_env('list_page', $page); - $this->output->set_env('list_count', $count); - $this->output->set_env('list_size', $i); - $this->output->set_object('domainlist', $table); + parent::action_list(); } /** @@ -194,13 +77,13 @@ */ public function action_info() { - $id = $this->get_input('id', 'POST'); + $id = $this->get_input('id', 'POST'); //console("action_info() on", $id); $result = $this->api_get('domain.info', array('id' => $id)); //console("action_info() \$result", $result); - $domain = $result->get(); + $domain = $result->get(); //console("action_info() \$domain", $domain); $output = $this->domain_form(array_keys($domain), $domain); @@ -305,37 +188,14 @@ } /** - * Users search form. - * - * @return string HTML output of the form + * List item handler */ - public function search_form() + protected function list_item_handler($item) { - $form = new kolab_form(array('id' => 'search-form')); - - $form->add_section('criteria', kolab_html::escape($this->translate('search.criteria'))); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.field'), - 'name' => 'field', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'associateddomain' => kolab_html::escape($this->translate('search.name')), - ), - )); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.method'), - 'name' => 'method', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'both' => kolab_html::escape($this->translate('search.contains')), - 'exact' => kolab_html::escape($this->translate('search.is')), - 'prefix' => kolab_html::escape($this->translate('search.prefix')), - ), - )); + if (is_array($item['associateddomain'])) { + return $item['associateddomain'][0]; + } - return $form->output(); + return $item['associateddomain']; } - }
View file
kolab-webadmin-3.1.tar.gz/lib/client/kolab_client_task_group.php -> kolab-webadmin-3.1.0.tar.gz/lib/client/kolab_client_task_group.php
Changed
@@ -30,6 +30,8 @@ 'add' => 'group.add', ); + protected $list_attribs = array('cn'); + /** * Default action. */ @@ -51,129 +53,6 @@ } /** - * Groups list action. - */ - public function action_list() - { - $page_size = 20; - $page = (int) self::get_input('page', 'POST'); - if (!$page || $page < 1) { - $page = 1; - } - - // request parameters - $post = array( - 'attributes' => array('cn'), -// 'sort_order' => 'ASC', - 'sort_by' => 'cn', - 'page_size' => $page_size, - 'page' => $page, - ); - - // search parameters - if (!empty($_POST['search'])) { - $search = self::get_input('search', 'POST', true); - $field = self::get_input('field', 'POST'); - $method = self::get_input('method', 'POST'); - - $search_request = array( - $field => array( - 'value' => $search, - 'type' => $method, - ), - ); - } - else if (!empty($_POST['search_request'])) { - $search_request = self::get_input('search_request', 'POST'); - $search_request = @unserialize(base64_decode($search_request)); - } - - if (!empty($search_request)) { - $post['search'] = $search_request; - $post['search_operator'] = 'OR'; - } - - // get groups list - $result = $this->api_post('groups.list', null, $post); - $count = (int) $result->get('count'); - $result = (array) $result->get('list'); - - // calculate records - if ($count) { - $start = 1 + max(0, $page - 1) * $page_size; - $end = min($start + $page_size - 1, $count); - } - - $rows = $head = $foot = array(); - $cols = array('name'); - $i = 0; - - // table header - $head[0]['cells'][] = array('class' => 'name', 'body' => $this->translate('group.list')); - - // table footer (navigation) - if ($count) { - $pages = ceil($count / $page_size); - $prev = max(0, $page - 1); - $next = $page < $pages ? $page + 1 : 0; - - $count_str = kolab_html::span(array( - 'content' => $this->translate('list.records', $start, $end, $count)), true); - $prev = kolab_html::a(array( - 'class' => 'prev' . ($prev ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $prev ? "kadm.command('group.list', {page: $prev})" : "return false", - )); - $next = kolab_html::a(array( - 'class' => 'next' . ($next ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $next ? "kadm.command('group.list', {page: $next})" : "return false", - )); - - $foot_body = kolab_html::span(array('content' => $prev . $count_str . $next)); - } - $foot[0]['cells'][] = array('class' => 'listnav', 'body' => $foot_body); - - // table body - if (!empty($result)) { - foreach ($result as $idx => $item) { - if (!is_array($item) || empty($item['cn'])) { - continue; - } - - $i++; - $cells = array(); - $cells[] = array('class' => 'name', 'body' => kolab_html::escape($item['cn']), - 'onclick' => "kadm.command('group.info', '$idx')"); - $rows[] = array('id' => $i, 'class' => 'selectable', 'cells' => $cells); - } - } - else { - $rows[] = array('cells' => array( - 0 => array('class' => 'empty-body', 'body' => $this->translate('group.norecords') - ))); - } - - $table = kolab_html::table(array( - 'id' => 'grouplist', - 'class' => 'list', - 'head' => $head, - 'body' => $rows, - 'foot' => $foot, - )); - - if ($this->action == 'list') { - $this->output->command('set_watermark', 'taskcontent'); - } - - $this->output->set_env('search_request', $search_request ? base64_encode(serialize($search_request)) : null); - $this->output->set_env('list_page', $page); - $this->output->set_env('list_count', $count); - $this->output->set_env('list_size', count($result)); - $this->output->set_object('grouplist', $table); - } - - /** * Group information (form) action. */ public function action_info() @@ -291,40 +170,4 @@ return $list; } - - /** - * Users search form. - * - * @return string HTML output of the form - */ - public function search_form() - { - $form = new kolab_form(array('id' => 'search-form')); - - $form->add_section('criteria', kolab_html::escape($this->translate('search.criteria'))); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.field'), - 'name' => 'field', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'cn' => kolab_html::escape($this->translate('search.name')), - 'mail' => kolab_html::escape($this->translate('search.email')), - ), - )); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.method'), - 'name' => 'method', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'both' => kolab_html::escape($this->translate('search.contains')), - 'exact' => kolab_html::escape($this->translate('search.is')), - 'prefix' => kolab_html::escape($this->translate('search.prefix')), - ), - )); - - return $form->output(); - } - }
View file
kolab-webadmin-3.1.tar.gz/lib/client/kolab_client_task_resource.php -> kolab-webadmin-3.1.0.tar.gz/lib/client/kolab_client_task_resource.php
Changed
@@ -30,6 +30,8 @@ 'add' => 'resource.add', ); + protected $list_attribs = array('cn'); + /** * Default action. */ @@ -51,131 +53,6 @@ } /** - * Users list action. - */ - public function action_list() - { - $page_size = 20; - $page = (int) self::get_input('page', 'POST'); - if (!$page || $page < 1) { - $page = 1; - } - - // request parameters - $post = array( - 'attributes' => array('cn'), -// 'sort_order' => 'ASC', - 'sort_by' => array('cn'), - 'page_size' => $page_size, - 'page' => $page, - ); - - // search parameters - if (!empty($_POST['search'])) { - $search = self::get_input('search', 'POST', true); - $field = self::get_input('field', 'POST'); - $method = self::get_input('method', 'POST'); - - $search_request = array( - $field => array( - 'value' => $search, - 'type' => $method, - ), - ); - } - else if (!empty($_POST['search_request'])) { - $search_request = self::get_input('search_request', 'POST'); - $search_request = @unserialize(base64_decode($search_request)); - } - - if (!empty($search_request)) { - $post['search'] = $search_request; - $post['search_operator'] = 'OR'; - } - - // get resources list - $result = $this->api_post('resources.list', null, $post); - $count = $result->get('count'); - $result = (array) $result->get('list'); - - //console($result); - - // calculate records - if ($count) { - $start = 1 + max(0, $page - 1) * $page_size; - $end = min($start + $page_size - 1, $count); - } - - $rows = $head = $foot = array(); - $cols = array('name'); - $i = 0; - - // table header - $head[0]['cells'][] = array('class' => 'name', 'body' => $this->translate('resource.list')); - - // table footer (navigation) - if ($count) { - $pages = ceil($count / $page_size); - $prev = max(0, $page - 1); - $next = $page < $pages ? $page + 1 : 0; - - $count_str = kolab_html::span(array( - 'content' => $this->translate('list.records', $start, $end, $count)), true); - $prev = kolab_html::a(array( - 'class' => 'prev' . ($prev ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $prev ? "kadm.command('resource.list', {page: $prev})" : "return false", - )); - $next = kolab_html::a(array( - 'class' => 'next' . ($next ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $next ? "kadm.command('resource.list', {page: $next})" : "return false", - )); - - $foot_body = kolab_html::span(array('content' => $prev . $count_str . $next)); - } - $foot[0]['cells'][] = array('class' => 'listnav', 'body' => $foot_body); - - // table body - if (!empty($result)) { - foreach ($result as $idx => $item) { - if (!is_array($item) || empty($item['cn'])) { - continue; - } - - $i++; - $cells = array(); - $cells[] = array('class' => 'name', 'body' => kolab_html::escape($item['cn']), - 'onclick' => "kadm.command('resource.info', '$idx')"); - $rows[] = array('id' => $i, 'class' => 'selectable', 'cells' => $cells); - } - } - else { - $rows[] = array('cells' => array( - 0 => array('class' => 'empty-body', 'body' => $this->translate('resource.norecords') - ))); - } - - $table = kolab_html::table(array( - 'id' => 'resourcelist', - 'class' => 'list', - 'head' => $head, - 'body' => $rows, - 'foot' => $foot, - )); - - if ($this->action == 'list') { - $this->output->command('set_watermark', 'taskcontent'); - } - - $this->output->set_env('search_request', $search_request ? base64_encode(serialize($search_request)) : null); - $this->output->set_env('list_page', $page); - $this->output->set_env('list_count', $count); - $this->output->set_env('list_size', count($result)); - $this->output->set_object('resourcelist', $table); - } - - /** * Resource adding (form) action. */ public function action_add() @@ -299,40 +176,4 @@ return $form->output(); } - - /** - * Users search form. - * - * @return string HTML output of the form - */ - public function search_form() - { - $form = new kolab_form(array('id' => 'search-form')); - - $form->add_section('criteria', kolab_html::escape($this->translate('search.criteria'))); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.field'), - 'name' => 'field', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'cn' => kolab_html::escape($this->translate('search.name')), - 'email' => kolab_html::escape($this->translate('search.email')), - 'uid' => kolab_html::escape($this->translate('search.uid')), - ), - )); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.method'), - 'name' => 'method', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'both' => kolab_html::escape($this->translate('search.contains')), - 'exact' => kolab_html::escape($this->translate('search.is')), - 'prefix' => kolab_html::escape($this->translate('search.prefix')), - ), - )); - - return $form->output(); - } }
View file
kolab-webadmin-3.1.tar.gz/lib/client/kolab_client_task_role.php -> kolab-webadmin-3.1.0.tar.gz/lib/client/kolab_client_task_role.php
Changed
@@ -30,6 +30,8 @@ 'add' => 'role.add', ); + protected $list_attribs = array('cn'); + /** * Default action. */ @@ -51,129 +53,6 @@ } /** - * Roles list action. - */ - public function action_list() - { - $page_size = 20; - $page = (int) self::get_input('page', 'POST'); - if (!$page || $page < 1) { - $page = 1; - } - - // request parameters - $post = array( - 'attributes' => array('cn'), -// 'sort_order' => 'ASC', - 'sort_by' => 'cn', - 'page_size' => $page_size, - 'page' => $page, - ); - - // search parameters - if (!empty($_POST['search'])) { - $search = self::get_input('search', 'POST', true); - $field = self::get_input('field', 'POST'); - $method = self::get_input('method', 'POST'); - - $search_request = array( - $field => array( - 'value' => $search, - 'type' => $method, - ), - ); - } - else if (!empty($_POST['search_request'])) { - $search_request = self::get_input('search_request', 'POST'); - $search_request = @unserialize(base64_decode($search_request)); - } - - if (!empty($search_request)) { - $post['search'] = $search_request; - $post['search_operator'] = 'OR'; - } - - // get roles list - $result = $this->api_post('roles.list', null, $post); - $count = (int) $result->get('count'); - $result = (array) $result->get('list'); - - // calculate records - if ($count) { - $start = 1 + max(0, $page - 1) * $page_size; - $end = min($start + $page_size - 1, $count); - } - - $rows = $head = $foot = array(); - $cols = array('name'); - $i = 0; - - // table header - $head[0]['cells'][] = array('class' => 'name', 'body' => $this->translate('role.list')); - - // table footer (navigation) - if ($count) { - $pages = ceil($count / $page_size); - $prev = max(0, $page - 1); - $next = $page < $pages ? $page + 1 : 0; - - $count_str = kolab_html::span(array( - 'content' => $this->translate('list.records', $start, $end, $count)), true); - $prev = kolab_html::a(array( - 'class' => 'prev' . ($prev ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $prev ? "kadm.command('role.list', {page: $prev})" : "return false", - )); - $next = kolab_html::a(array( - 'class' => 'next' . ($next ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $next ? "kadm.command('role.list', {page: $next})" : "return false", - )); - - $foot_body = kolab_html::span(array('content' => $prev . $count_str . $next)); - } - $foot[0]['cells'][] = array('class' => 'listnav', 'body' => $foot_body); - - // table body - if (!empty($result)) { - foreach ($result as $idx => $item) { - if (!is_array($item) || empty($item['cn'])) { - continue; - } - - $i++; - $cells = array(); - $cells[] = array('class' => 'name', 'body' => kolab_html::escape($item['cn']), - 'onclick' => "kadm.command('role.info', '$idx')"); - $rows[] = array('id' => $i, 'class' => 'selectable', 'cells' => $cells); - } - } - else { - $rows[] = array('cells' => array( - 0 => array('class' => 'empty-body', 'body' => $this->translate('role.norecords') - ))); - } - - $table = kolab_html::table(array( - 'id' => 'rolelist', - 'class' => 'list', - 'head' => $head, - 'body' => $rows, - 'foot' => $foot, - )); - - if ($this->action == 'list') { - $this->output->command('set_watermark', 'taskcontent'); - } - - $this->output->set_env('search_request', $search_request ? base64_encode(serialize($search_request)) : null); - $this->output->set_env('list_page', $page); - $this->output->set_env('list_count', $count); - $this->output->set_env('list_size', count($result)); - $this->output->set_object('rolelist', $table); - } - - /** * Role information (form) action. */ public function action_info() @@ -292,39 +171,4 @@ return $list; } - /** - * Users search form. - * - * @return string HTML output of the form - */ - public function search_form() - { - $form = new kolab_form(array('id' => 'search-form')); - - $form->add_section('criteria', kolab_html::escape($this->translate('search.criteria'))); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.field'), - 'name' => 'field', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'cn' => kolab_html::escape($this->translate('search.name')), - 'mail' => kolab_html::escape($this->translate('search.email')), - ), - )); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.method'), - 'name' => 'method', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'both' => kolab_html::escape($this->translate('search.contains')), - 'exact' => kolab_html::escape($this->translate('search.is')), - 'prefix' => kolab_html::escape($this->translate('search.prefix')), - ), - )); - - return $form->output(); - } - }
View file
kolab-webadmin-3.1.tar.gz/lib/client/kolab_client_task_sharedfolder.php -> kolab-webadmin-3.1.0.tar.gz/lib/client/kolab_client_task_sharedfolder.php
Changed
@@ -30,6 +30,8 @@ 'add' => 'sharedfolder.add', ); + protected $list_attribs = array('cn'); + /** * Default action. */ @@ -51,131 +53,6 @@ } /** - * Users list action. - */ - public function action_list() - { - $page_size = 20; - $page = (int) self::get_input('page', 'POST'); - if (!$page || $page < 1) { - $page = 1; - } - - // request parameters - $post = array( - 'attributes' => array('cn'), -// 'sort_order' => 'ASC', - 'sort_by' => array('cn'), - 'page_size' => $page_size, - 'page' => $page, - ); - - // search parameters - if (!empty($_POST['search'])) { - $search = self::get_input('search', 'POST', true); - $field = self::get_input('field', 'POST'); - $method = self::get_input('method', 'POST'); - - $search_request = array( - $field => array( - 'value' => $search, - 'type' => $method, - ), - ); - } - else if (!empty($_POST['search_request'])) { - $search_request = self::get_input('search_request', 'POST'); - $search_request = @unserialize(base64_decode($search_request)); - } - - if (!empty($search_request)) { - $post['search'] = $search_request; - $post['search_operator'] = 'OR'; - } - - // get shared folders list - $result = $this->api_post('sharedfolders.list', null, $post); - $count = $result->get('count'); - $result = (array) $result->get('list'); - - //console($result); - - // calculate records - if ($count) { - $start = 1 + max(0, $page - 1) * $page_size; - $end = min($start + $page_size - 1, $count); - } - - $rows = $head = $foot = array(); - $cols = array('name'); - $i = 0; - - // table header - $head[0]['cells'][] = array('class' => 'name', 'body' => $this->translate('sharedfolder.list')); - - // table footer (navigation) - if ($count) { - $pages = ceil($count / $page_size); - $prev = max(0, $page - 1); - $next = $page < $pages ? $page + 1 : 0; - - $count_str = kolab_html::span(array( - 'content' => $this->translate('list.records', $start, $end, $count)), true); - $prev = kolab_html::a(array( - 'class' => 'prev' . ($prev ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $prev ? "kadm.command('sharedfolder.list', {page: $prev})" : "return false", - )); - $next = kolab_html::a(array( - 'class' => 'next' . ($next ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $next ? "kadm.command('sharedfolder.list', {page: $next})" : "return false", - )); - - $foot_body = kolab_html::span(array('content' => $prev . $count_str . $next)); - } - $foot[0]['cells'][] = array('class' => 'listnav', 'body' => $foot_body); - - // table body - if (!empty($result)) { - foreach ($result as $idx => $item) { - if (!is_array($item) || empty($item['cn'])) { - continue; - } - - $i++; - $cells = array(); - $cells[] = array('class' => 'name', 'body' => kolab_html::escape($item['cn']), - 'onclick' => "kadm.command('sharedfolder.info', '$idx')"); - $rows[] = array('id' => $i, 'class' => 'selectable', 'cells' => $cells); - } - } - else { - $rows[] = array('cells' => array( - 0 => array('class' => 'empty-body', 'body' => $this->translate('sharedfolder.norecords') - ))); - } - - $table = kolab_html::table(array( - 'id' => 'sharedfolderlist', - 'class' => 'list', - 'head' => $head, - 'body' => $rows, - 'foot' => $foot, - )); - - if ($this->action == 'list') { - $this->output->command('set_watermark', 'taskcontent'); - } - - $this->output->set_env('search_request', $search_request ? base64_encode(serialize($search_request)) : null); - $this->output->set_env('list_page', $page); - $this->output->set_env('list_count', $count); - $this->output->set_env('list_size', count($result)); - $this->output->set_object('sharedfolderlist', $table); - } - - /** * Resource adding (form) action. */ public function action_add() @@ -299,40 +176,4 @@ return $form->output(); } - - /** - * Users search form. - * - * @return string HTML output of the form - */ - public function search_form() - { - $form = new kolab_form(array('id' => 'search-form')); - - $form->add_section('criteria', kolab_html::escape($this->translate('search.criteria'))); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.field'), - 'name' => 'field', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'cn' => kolab_html::escape($this->translate('search.name')), - 'email' => kolab_html::escape($this->translate('search.email')), - 'uid' => kolab_html::escape($this->translate('search.uid')), - ), - )); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.method'), - 'name' => 'method', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'both' => kolab_html::escape($this->translate('search.contains')), - 'exact' => kolab_html::escape($this->translate('search.is')), - 'prefix' => kolab_html::escape($this->translate('search.prefix')), - ), - )); - - return $form->output(); - } }
View file
kolab-webadmin-3.1.tar.gz/lib/client/kolab_client_task_user.php -> kolab-webadmin-3.1.0.tar.gz/lib/client/kolab_client_task_user.php
Changed
@@ -30,6 +30,8 @@ 'add' => 'user.add', ); + protected $list_attribs = array('displayname', 'cn'); + /** * Default action. */ @@ -51,129 +53,6 @@ } /** - * Users list action. - */ - public function action_list() - { - $page_size = 20; - $page = (int) self::get_input('page', 'POST'); - if (!$page || $page < 1) { - $page = 1; - } - - // request parameters - $post = array( - 'attributes' => array('displayname', 'cn'), -// 'sort_order' => 'ASC', - 'sort_by' => array('displayname', 'cn'), - 'page_size' => $page_size, - 'page' => $page, - ); - - // search parameters - if (!empty($_POST['search'])) { - $search = self::get_input('search', 'POST', true); - $field = self::get_input('field', 'POST'); - $method = self::get_input('method', 'POST'); - - $search_request = array( - $field => array( - 'value' => $search, - 'type' => $method, - ), - ); - } - else if (!empty($_POST['search_request'])) { - $search_request = self::get_input('search_request', 'POST'); - $search_request = @unserialize(base64_decode($search_request)); - } - - if (!empty($search_request)) { - $post['search'] = $search_request; - $post['search_operator'] = 'OR'; - } - - // get users list - $result = $this->api_post('users.list', null, $post); - $count = $result->get('count'); - $result = (array) $result->get('list'); - - // calculate records - if ($count) { - $start = 1 + max(0, $page - 1) * $page_size; - $end = min($start + $page_size - 1, $count); - } - - $rows = $head = $foot = array(); - $cols = array('name'); - $i = 0; - - // table header - $head[0]['cells'][] = array('class' => 'name', 'body' => $this->translate('user.list')); - - // table footer (navigation) - if ($count) { - $pages = ceil($count / $page_size); - $prev = max(0, $page - 1); - $next = $page < $pages ? $page + 1 : 0; - - $count_str = kolab_html::span(array( - 'content' => $this->translate('list.records', $start, $end, $count)), true); - $prev = kolab_html::a(array( - 'class' => 'prev' . ($prev ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $prev ? "kadm.command('user.list', {page: $prev})" : "return false", - )); - $next = kolab_html::a(array( - 'class' => 'next' . ($next ? '' : ' disabled'), - 'href' => '#', - 'onclick' => $next ? "kadm.command('user.list', {page: $next})" : "return false", - )); - - $foot_body = kolab_html::span(array('content' => $prev . $count_str . $next)); - } - $foot[0]['cells'][] = array('class' => 'listnav', 'body' => $foot_body); - - // table body - if (!empty($result)) { - foreach ($result as $idx => $item) { - if (!is_array($item) || (empty($item['displayname']) && empty($item['cn']))) { - continue; - } - - $i++; - $cells = array(); - $cells[] = array('class' => 'name', 'body' => kolab_html::escape(empty($item['displayname']) ? $item['cn'] : $item['displayname']), - 'onclick' => "kadm.command('user.info', '$idx')"); - $rows[] = array('id' => $i, 'class' => 'selectable', 'cells' => $cells); - } - } - else { - $rows[] = array('cells' => array( - 0 => array('class' => 'empty-body', 'body' => $this->translate('user.norecords') - ))); - } - - $table = kolab_html::table(array( - 'id' => 'userlist', - 'class' => 'list', - 'head' => $head, - 'body' => $rows, - 'foot' => $foot, - )); - - if ($this->action == 'list') { - $this->output->command('set_watermark', 'taskcontent'); - } - - $this->output->set_env('search_request', $search_request ? base64_encode(serialize($search_request)) : null); - $this->output->set_env('list_page', $page); - $this->output->set_env('list_count', $count); - $this->output->set_env('list_size', count($result)); - $this->output->set_object('userlist', $table); - } - - /** * User information (form) action. */ public function action_info() @@ -369,39 +248,11 @@ } /** - * Users search form. - * - * @return string HTML output of the form + * List item handler */ - public function search_form() + protected function list_item_handler($item) { - $form = new kolab_form(array('id' => 'search-form')); - - $form->add_section('criteria', kolab_html::escape($this->translate('search.criteria'))); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.field'), - 'name' => 'field', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'displayname' => kolab_html::escape($this->translate('search.name')), - 'email' => kolab_html::escape($this->translate('search.email')), - 'uid' => kolab_html::escape($this->translate('search.uid')), - ), - )); - $form->add_element(array( - 'section' => 'criteria', - 'label' => $this->translate('search.method'), - 'name' => 'method', - 'type' => kolab_form::INPUT_SELECT, - 'options' => array( - 'both' => kolab_html::escape($this->translate('search.contains')), - 'exact' => kolab_html::escape($this->translate('search.is')), - 'prefix' => kolab_html::escape($this->translate('search.prefix')), - ), - )); - - return $form->output(); + return empty($item['displayname']) ? $item['cn'] : $item['displayname']; } }
View file
kolab-webadmin-3.1.tar.gz/lib/ext/Net/LDAP3.php -> kolab-webadmin-3.1.0.tar.gz/lib/ext/Net/LDAP3.php
Changed
@@ -885,7 +885,7 @@ ")"); if ($entries) { - $groups = array_keys($entries->entries(TRUE)); + $groups = array_keys($entries->entries(TRUE)); } return $groups; @@ -993,7 +993,7 @@ return $replica_hosts; } - $this->_debug("Replication agreements found: " . var_export($result->entries(TRUE), TRUE)); + $this->_debug("Replication agreements found: " . var_export($result->entries(TRUE), TRUE)); foreach ($result->entries(TRUE) as $dn => $attrs) { if (!in_array($attrs['nsds5replicahost'], $replica_hosts)) { @@ -1171,6 +1171,10 @@ $entry = $this->search($dn); + if (!$entry) { + return array(); + } + $this->_debug("ENTRIES for \$dn $dn", $entry); foreach ($entry[$dn] as $attribute => $value) { @@ -1598,21 +1602,36 @@ return null; } - $filter = ''; + $operators = array('=', '~=', '>=', '<='); + $filter = ''; + foreach ((array) $search['params'] as $field => $param) { switch ((string)$param['type']) { case 'prefix': $prefix = ''; $suffix = '*'; break; + case 'suffix': $prefix = '*'; $suffix = ''; break; + case 'exact': + case '=': + case '~=': + case '>=': + case '<=': $prefix = ''; $suffix = ''; break; + + case 'exists': + $prefix = '*'; + $suffix = ''; + $param['value'] = ''; + break; + case 'both': default: $prefix = '*'; @@ -1620,17 +1639,19 @@ break; } + $operator = $param['type'] && in_array($param['type'], $operators) ? $param['type'] : '='; + if (is_array($param['value'])) { $val_filter = array(); foreach ($param['value'] as $val) { $value = self::_quote_string($val); - $val_filter[] = "($field=$prefix" . $value . "$suffix)"; + $val_filter[] = "(" . $field . $operator . $prefix . $value . $suffix . ")"; } $filter .= "(|" . implode($val_filter, '') . ")"; } else { $value = self::_quote_string($param['value']); - $filter .= "($field=$prefix" . $value . "$suffix)"; + $filter .= "(" . $field . $operator . $prefix . $value . $suffix . ")"; } } @@ -1829,37 +1850,34 @@ return false; } - if (empty($this->_vlv_indexes_and_searches)) { - $this->_debug("No VLV information available yet, refreshing"); - $this->find_vlv_indexes_and_searches(true); - } + $vlv_indexes = $this->find_vlv_indexes_and_searches(); - if (empty($this->_vlv_indexes_and_searches) && !is_array($this->_vlv_indexes_and_searches)) { + if (empty($vlv_indexes)) { return false; } - $this->_debug("Existing vlv index and search information", $this->_vlv_indexes_and_searches); + $this->_debug("Existing vlv index and search information", $vlv_indexes); - if (array_key_exists($base_dn, $this->_vlv_indexes_and_searches) && !empty($this->_vlv_indexes_and_searches[$base_dn])) { + if (!empty($vlv_indexes[$base_dn])) { $this->_debug("Found a VLV for base_dn: " . $base_dn); - if ($this->_vlv_indexes_and_searches[$base_dn]['filter'] == $filter) { + if ($vlv_indexes[$base_dn]['filter'] == $filter) { $this->_debug("Filter matches"); - if ($this->_vlv_indexes_and_searches[$base_dn]['scope'] == $scope) { + if ($vlv_indexes[$base_dn]['scope'] == $scope) { $this->_debug("Scope matches"); // Not passing any sort attributes means you don't care if (!empty($sort_attrs)) { - if (in_array($sort_attrs, $this->_vlv_indexes_and_searches[$base_dn]['sort'])) { + if (in_array($sort_attrs, $vlv_indexes[$base_dn]['sort'])) { return $sort_attrs; } else { return false; } } else { - return $this->_vlv_indexes_and_searches[$base_dn]['sort'][0]; + return $vlv_indexes[$base_dn]['sort'][0]; } } else { - $this->_debug("Scope does not match. VLV: " . var_export($this->_vlv_indexes_and_searches[$base_dn]['scope'], true) . " while looking for " . var_export($scope, true)); + $this->_debug("Scope does not match. VLV: " . var_export($vlv_indexes[$base_dn]['scope'], true) . " while looking for " . var_export($scope, true)); return false; } } else { @@ -1878,27 +1896,32 @@ */ private function find_vlv_indexes_and_searches($refresh = false) { - if (!empty($this->config['vlv'])) { + if (isset($this->config['vlv'])) { if ($this->config['vlv'] === false) { return array(); - } else { + } + else if (is_array($this->config['vlv'])) { return $this->config['vlv']; } } - if (!$this->_vlv_indexes_and_searches === null) { + if ($this->_vlv_indexes_and_searches !== null) { if (!$refresh) { return $this->_vlv_indexes_and_searches; } } + $this->_vlv_indexes_and_searches = array(); + $return_attributes = $this->return_attributes; + $config_root_dn = $this->config_get('config_root_dn', null); - $config_root_dn = $this->config_get('config_root_dn', null); if (empty($config_root_dn)) { return array(); } + $this->_debug("No VLV information available yet, refreshing"); + $this->return_attributes = array('*'); $search_result = ldap_search( @@ -1911,22 +1934,25 @@ 0 ); + if ($search_result === false) { + $this->_debug("Search for '(objectclass=vlvsearch)' on '$config_root_dn' failed:".ldap_error($this->conn)); + $this->return_attributes = $return_attributes; + return; + } + $vlv_searches = new Net_LDAP3_Result($this->conn, $config_root_dn, '(objectclass=vlvsearch)', 'sub', $search_result); if ($vlv_searches->count() < 1) { $this->_debug("Empty result from search for '(objectclass=vlvsearch)' on '$config_root_dn'"); $this->return_attributes = $return_attributes; return; - } else { - $vlv_searches = $vlv_searches->entries(true); } - foreach ($vlv_searches as $vlv_search_dn => $vlv_search_attrs) { - + foreach ($vlv_searches->entries(true) as $vlv_search_dn => $vlv_search_attrs) { // The attributes we are interested in are as follows: $_vlv_base_dn = $vlv_search_attrs['vlvbase']; - $_vlv_scope = $vlv_search_attrs['vlvscope']; - $_vlv_filter = $vlv_search_attrs['vlvfilter']; + $_vlv_scope = $vlv_search_attrs['vlvscope']; + $_vlv_filter = $vlv_search_attrs['vlvfilter']; // Multiple indexes may exist $index_result = ldap_search( @@ -1939,12 +1965,14 @@ 0 ); + if ($index_result === false) { + $this->_debug("Search for '(objectclass=vlvindex)' on '$vlv_search_dn' failed:".ldap_error($this->conn)); + continue; + } $vlv_indexes = new Net_LDAP3_Result($this->conn, $vlv_search_dn, '(objectclass=vlvindex)', 'sub', $index_result); $vlv_indexes = $vlv_indexes->entries(true); - $this->_debug("find_vlv() vlvindex result: " . var_export($vlv_indexes, true)); - // Reset this one for each VLV search. $_vlv_sort = array(); @@ -1953,16 +1981,17 @@ } $this->_vlv_indexes_and_searches[$_vlv_base_dn] = array( - 'scope' => self::scopeint2str($_vlv_scope), - 'filter' => $_vlv_filter, - 'sort' => $_vlv_sort, - ); - + 'scope' => self::scopeint2str($_vlv_scope), + 'filter' => $_vlv_filter, + 'sort' => $_vlv_sort, + ); } $this->return_attributes = $return_attributes; $this->_debug("Refreshed VLV: " . var_export($this->_vlv_indexes_and_searches, true)); + + return $this->_vlv_indexes_and_searches; } private function init_schema()
View file
kolab-webadmin-3.1.tar.gz/lib/kolab_api_controller.php -> kolab-webadmin-3.1.0.tar.gz/lib/kolab_api_controller.php
Changed
@@ -378,7 +378,7 @@ foreach ($this->services as $sname => $handler) { $service = $this->get_service($sname); - foreach ($service->capabilities($domain) as $method => $type) { + foreach ($service->capabilities($domain_name) as $method => $type) { $actions["$sname.$method"] = array('type' => $type); } } @@ -413,11 +413,16 @@ * * @param array $request GET request parameters * - * @return bool + * @return bool|array Domain attributes or False on failure */ - private function select_domain($request) { + private function select_domain($request) + { if (!empty($request['domain']) && is_string($request['domain'])) { - return $_SESSION['user']->set_domain($request['domain']); + if ($_SESSION['user']->set_domain($request['domain'])) { + $service = $this->get_service('domain'); + $domain = $service->domain_info(array('id' => $request['domain']), null); + return $domain; + } } return false;
View file
kolab-webadmin-3.1.tar.gz/lib/kolab_api_service.php -> kolab-webadmin-3.1.0.tar.gz/lib/kolab_api_service.php
Changed
@@ -80,30 +80,10 @@ if (empty($object_types[$type_id])) { if ($object_name == 'domain') { - $result = array( - 'auto_form_fields' => array(), - 'form_fields' => array( - 'aci' => array( - 'type' => 'list', - 'optional' => true, - ), - 'associateddomain' => array( - 'type' => 'list' - ), - 'inetdomainbasedn' => array( - 'optional' => true, - ), - 'inetdomainstatus' => array( - 'optional' => true, - ), - ), - 'fields' => array( - 'objectclass' => array( - 'top', - 'domainrelatedobject', - 'inetdomain', - ), - ), + $result = kolab_api_service_domain_types::$DEFAULT_TYPE_ATTRS; + $result['form_fields']['aci'] = array( + 'type' => 'list', + 'optional' => true, ); return $result; @@ -313,7 +293,7 @@ Log::trace("kolab_api_service::parse_input_attributes() \$special_attr_validate: " . var_export($special_attr_validate, TRUE)); - $result = array(); + $result = array(); if (isset($type_attrs['form_fields'])) { foreach ($type_attrs['form_fields'] as $key => $value) {
View file
kolab-webadmin-3.1.tar.gz/lib/kolab_client_task.php -> kolab-webadmin-3.1.0.tar.gz/lib/kolab_client_task.php
Changed
@@ -41,12 +41,21 @@ */ protected $config; - protected $ajax_only = false; - protected $page_title = 'Kolab Web Admin Panel'; - protected $menu = array(); - protected $cache = array(); - protected $devel_mode = false; + protected $ajax_only = false; + protected $page_title = 'Kolab Web Admin Panel'; + protected $menu = array(); + protected $cache = array(); + protected $devel_mode = false; protected $object_types = array('user', 'group', 'role', 'resource', 'sharedfolder', 'domain'); + protected $page_size = 20; + protected $list_attribs = array(); + protected $list_module; + + protected $search_attribs = array( + 'name' => array('cn', 'displayname'), + 'email' => array('mail', 'alias', 'mailalternateaddress'), + 'uid' => array('uid'), + ); protected static $translation = array(); @@ -130,12 +139,10 @@ { $url = $this->config_get('api_url', ''); - // TODO: Debug logging - //console($url); - if (!$url) { - $url = kolab_utils::https_check() ? 'https://' : 'http://'; - $url .= $_SERVER['SERVER_NAME']; + $port = $_SERVER['SERVER_PORT']; + $url = kolab_utils::https_check() ? 'https://' : 'http://'; + $url .= $_SERVER['SERVER_NAME'] . ($port ? ":$port" : ''); $url .= preg_replace('/\/?\?.*$/', '', $_SERVER['REQUEST_URI']); $url .= '/api'; } @@ -1345,4 +1352,227 @@ return $form; } + /** + * Search form. + * + * @return string HTML output of the form + */ + public function search_form() + { + $attribs = $this->get_search_attribs(); + + if (empty($attribs)) { + return ''; + } + + $options = array(); + foreach (array_keys($attribs) as $key) { + $options[$key] = kolab_html::escape($this->translate('search.' . $key)); + } + + $form = new kolab_form(array('id' => 'search-form')); + + $form->add_section('criteria', kolab_html::escape($this->translate('search.criteria'))); + $form->add_element(array( + 'section' => 'criteria', + 'label' => $this->translate('search.field'), + 'name' => 'field', + 'type' => kolab_form::INPUT_SELECT, + 'options' => $options, + )); + $form->add_element(array( + 'section' => 'criteria', + 'label' => $this->translate('search.method'), + 'name' => 'method', + 'type' => kolab_form::INPUT_SELECT, + 'options' => array( + 'both' => kolab_html::escape($this->translate('search.contains')), + 'exact' => kolab_html::escape($this->translate('search.is')), + 'prefix' => kolab_html::escape($this->translate('search.prefix')), + ), + )); + + return $form->output(); + } + + /** + * Returns list of attributes assigned to search field(s) + * + * @param string $name Optional search field name + * + * @return array List of attributes + */ + protected function get_search_attribs($name = null) + { + $task = $this->get_task(); + $types = $this->object_types($task); + $attribs = array(); + + foreach ($this->search_attribs as $key => $value) { + foreach ((array)$value as $idx => $attr) { + $found = false; + foreach ($types as $type) { + if (array_key_exists($attr, (array)$type['attributes']['auto_form_fields']) + || array_key_exists($attr, (array)$type['attributes']['form_fields']) + || array_key_exists($attr, (array)$type['attributes']['fields']) + ) { + $found = true; + break; + } + } + + if (!$found) { + unset($value[$idx]); + } + } + + if (!empty($value)) { + $attribs[$key] = $value; + } + } + + return $name ? $attribs[$name] : $attribs; + } + + /** + * Object list (and search handler) + */ + public function action_list() + { + if (empty($this->list_attribs)) { + return; + } + + $task = $this->get_task(); + $page = (int) self::get_input('page', 'POST'); + + if (!$page || $page < 1) { + $page = 1; + } + + // request parameters + $post = array( + 'attributes' => $this->list_attribs, + 'sort_by' => $this->list_attribs, +// 'sort_order' => 'ASC', + 'page_size' => $this->page_size, + 'page' => $page, + ); + + // search parameters + if (!empty($_POST['search'])) { + $search = self::get_input('search', 'POST', true); + $field = self::get_input('field', 'POST'); + $method = self::get_input('method', 'POST'); + $attrs = $this->get_search_attribs($field); + $search_request = array(); + + foreach ($attrs as $attr) { + $search_request[$attr] = array( + 'value' => $search, + 'type' => $method, + ); + } + } + else if (!empty($_POST['search_request'])) { + $search_request = self::get_input('search_request', 'POST'); + $search_request = @unserialize(base64_decode($search_request)); + } + + if (!empty($search_request)) { + $post['search'] = $search_request; + $post['search_operator'] = 'OR'; + } + + // get users list + $module = $this->list_module ? $this->list_module : $task . 's'; + $result = $this->api_post($module . '.list', null, $post); + $count = $result->get('count'); + $result = (array) $result->get('list'); + + // calculate records + if ($count) { + $start = 1 + max(0, $page - 1) * $this->page_size; + $end = min($start + $this->page_size - 1, $count); + } + + $rows = $head = $foot = array(); + $cols = array('name'); + $i = 0; + + // table header + $head[0]['cells'][] = array('class' => 'name', 'body' => $this->translate($task . '.list')); + + // table footer (navigation) + if ($count) { + $pages = ceil($count / $this->page_size); + $prev = max(0, $page - 1); + $next = $page < $pages ? $page + 1 : 0; + + $count_str = kolab_html::span(array( + 'content' => $this->translate('list.records', $start, $end, $count)), true); + $prev = kolab_html::a(array( + 'class' => 'prev' . ($prev ? '' : ' disabled'), + 'href' => '#', + 'onclick' => $prev ? "kadm.command('$task.list', {page: $prev})" : "return false", + )); + $next = kolab_html::a(array( + 'class' => 'next' . ($next ? '' : ' disabled'), + 'href' => '#', + 'onclick' => $next ? "kadm.command('$task.list', {page: $next})" : "return false", + )); + + $foot_body = kolab_html::span(array('content' => $prev . $count_str . $next)); + } + $foot[0]['cells'][] = array('class' => 'listnav', 'body' => $foot_body); + + // table body + if (!empty($result)) { + foreach ($result as $idx => $item) { + if (!is_array($item)) { + continue; + } + + if (method_exists($this, 'list_item_handler')) { + $item = $this->list_item_handler($item); + } + else { + $item = array_shift($item); + } + + if (empty($item)) { + continue; + } + + $i++; + $cells = array(); + $cells[] = array('class' => 'name', 'body' => kolab_html::escape($item), + 'onclick' => "kadm.command('$task.info', '$idx')"); + $rows[] = array('id' => $i, 'class' => 'selectable', 'cells' => $cells); + } + } + else { + $rows[] = array('cells' => array( + 0 => array('class' => 'empty-body', 'body' => $this->translate($task . '.norecords') + ))); + } + + $table = kolab_html::table(array( + 'id' => $task . 'list', + 'class' => 'list', + 'head' => $head, + 'body' => $rows, + 'foot' => $foot, + )); + + if ($this->action == 'list') { + $this->output->command('set_watermark', 'taskcontent'); + } + + $this->output->set_env('search_request', $search_request ? base64_encode(serialize($search_request)) : null); + $this->output->set_env('list_page', $page); + $this->output->set_env('list_count', $count); + $this->output->set_env('list_size', count($result)); + $this->output->set_object($task . 'list', $table); + } }
View file
kolab-webadmin-3.1.tar.gz/lib/kolab_html.php -> kolab-webadmin-3.1.0.tar.gz/lib/kolab_html.php
Changed
@@ -154,7 +154,7 @@ } /** - * Input element for mail quota. user can select the unit (GB, MB) + * Input element for mail quota. user can select the unit (GB, MB, KB) * * @param array $attribs Element attributes * @@ -164,20 +164,32 @@ { $elem_attribs = array_merge(self::$input_attribs, self::$input_event_attribs, self::$common_attribs, self::$event_attribs); - $selected_option_mb = $selected_option_gb = ""; - $selected_option_kb = "selected"; - if ($attribs['value'] >= 1024 && $attribs['value'] % 1024 == 0) { - $attribs['value'] /= 1024; - $selected_option_kb = ""; - $selected_option_mb = "selected"; + + if ($attribs['value'] % 1024 == 0) { + if ($attribs['value'] >= 1024) { + $attribs['value'] /= 1024; + $unit = 'mb'; + } + if ($attribs['value'] >= 1024) { + $attribs['value'] /= 1024; + $unit = 'gb'; + } } - if ($attribs['value'] >= 1024 && $attribs['value'] % 1024 == 0) { - $attribs['value'] /= 1024; - $selected_option_mb = ""; - $selected_option_gb = "selected"; + + $options = array(); + foreach (array('kb', 'mb', 'gb') as $u) { + $options[] = '<option value="' . $u . '"' . ($unit == $u ? ' selected' : '') . '>' + . strtoupper($u) . '</option>'; + } + + $attribs['data-type'] = 'quota'; + + if (empty($attribs['size'])) { + $attribs['size'] = 10; } - return sprintf('<input%s /><select name="%s-unit"><option value="kb" %s>KB</option><option value="mb" %s>MB</option><option value="gb" %s>GB</option></select>', self::attrib_string($attribs, $elem_attribs), $attribs['name'], $selected_option_kb, $selected_option_mb, $selected_option_gb); + return sprintf('<input%s /><select name="%s-unit">%s</select>', + self::attrib_string($attribs, $elem_attribs), $attribs['name'], implode($options)); } /**
View file
kolab-webadmin-3.1.tar.gz/lib/kolab_recipient_policy.php -> kolab-webadmin-3.1.0.tar.gz/lib/kolab_recipient_policy.php
Changed
@@ -132,17 +132,14 @@ static function primary_mail($userdata) { $userdata = self::normalize_userdata($userdata); + $conf = Conf::get_instance(); - $conf = Conf::get_instance(); - - if (isset($userdata['domain'])) { - $primary_mail = $conf->get_raw($userdata['domain'], 'primary_mail'); - } else { - $primary_mail = $conf->get_raw($_SESSION['user']->get_domain(), 'primary_mail'); - // Also append the domain to the userdata + if (empty($userdata['domain'])) { $userdata['domain'] = $_SESSION['user']->get_domain(); } + $primary_mail = $conf->get_raw($userdata['domain'], 'primary_mail'); + preg_match_all('/%\((\w+)\)s/', $primary_mail, $substrings); // Update userdata array @@ -206,19 +203,18 @@ ); $userdata = self::normalize_userdata($userdata); + $conf = Conf::get_instance(); + if (!array_key_exists('mail', $userdata)) { $userdata['mail'] = self::primary_mail($userdata); } - $conf = Conf::get_instance(); - - if (isset($userdata['domain'])) { - $secondary_mail = $conf->get_raw($userdata['domain'], 'secondary_mail'); - } else { - $secondary_mail = $conf->get_raw($_SESSION['user']->get_domain(), 'secondary_mail'); + if (empty($userdata['domain'])) { $userdata['domain'] = $_SESSION['user']->get_domain(); } + $secondary_mail = $conf->get_raw($userdata['domain'], 'secondary_mail'); + $secondary_mail = preg_replace('/^{\d:\s*/','',$secondary_mail); $secondary_mail = preg_replace('/\s*}$/','',$secondary_mail); $secondary_mail = preg_replace('/,\d+:\s*/',',',$secondary_mail); @@ -284,7 +280,8 @@ return $secondary_mail_addresses; } - static public function transliterate($mystring, $locale) { + static public function transliterate($mystring, $locale) + { $locale_translit_map = Array( 'ru_RU' => 'cyrillic' ); @@ -367,16 +364,16 @@ return $mystring; } - static public function uid($userdata) { + static public function uid($userdata) + { $conf = Conf::get_instance(); - if (isset($userdata['domain'])) { - $policy_uid = $conf->get_raw($userdata['domain'], 'policy_uid'); - } else { - $policy_uid = $conf->get_raw($_SESSION['user']->get_domain(), 'policy_uid'); + if (empty($userdata['domain'])) { $userdata['domain'] = $_SESSION['user']->get_domain(); } + $policy_uid = $conf->get_raw($userdata['domain'], 'policy_uid'); + if (empty($policy_uid)) { $policy_uid = "%(surname)s.lower()"; }
View file
kolab-webadmin-3.1.tar.gz/lib/locale/en_US.php -> kolab-webadmin-3.1.0.tar.gz/lib/locale/en_US.php
Changed
@@ -43,6 +43,7 @@ $LANG['domain.edit'] = 'Edit domain'; $LANG['domain.edit.success'] = 'Domain updated successfully.'; $LANG['domain.inetdomainbasedn'] = 'Custom Root DN(s)'; +$LANG['domain.inetdomainstatus'] = 'Status'; $LANG['domain.list'] = 'Domains List'; $LANG['domain.norecords'] = 'No domain records found!'; $LANG['domain.o'] = 'Organization';
View file
kolab-webadmin-3.1.tar.gz/public_html/js/kolab_admin.js -> kolab-webadmin-3.1.0.tar.gz/public_html/js/kolab_admin.js
Changed
@@ -761,6 +761,14 @@ data.json = kadm.form_url_element_submit(this.name, data.json, form); }); + // quota inputs + $('input[data-type="quota"]', form).each(function() { + var unit = $('select[name="' + this.name + '-unit"]').val(); + if (unit && this.value) + data.json[this.name] = this.value + unit; + delete data.json[this.name + '-unit']; + }); + return data; };
View file
kolab-webadmin.dsc
Changed
@@ -2,7 +2,7 @@ Source: kolab-webadmin Binary: kolab-webadmin Architecture: all -Version: 3.1~dev20130712-1 +Version: 3.1.0-1 Maintainer: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Uploaders: Paul Klos <kolab@klos2day.nl> Homepage: http://www.kolab.org/ @@ -13,5 +13,5 @@ Package-List: kolab-webadmin deb admin extra Files: - 00000000000000000000000000000000 0 kolab-webadmin-3.1.tar.gz + 00000000000000000000000000000000 0 kolab-webadmin-3.1.0.tar.gz 00000000000000000000000000000000 0 debian.tar.gz
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.