Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F257003
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/config/config.inc.php.dist b/config/config.inc.php.dist
index c82b389..b858095 100644
--- a/config/config.inc.php.dist
+++ b/config/config.inc.php.dist
@@ -1,130 +1,133 @@
<?php
// This file contains Chwala configuration options.
// Real config file must contain or include Roundcube Framework config.
// ------------------------------------------------
// Global settings
// ------------------------------------------------
// Main files source, backend driver which handles
// authentication and configuration of Chwala
// Note: Currently only 'kolab' is supported
$config['fileapi_backend'] = 'kolab';
// Enabled external storage drivers
// Note: Currenty only 'seafile' and webdav is available
$config['fileapi_drivers'] = array('seafile', 'webdav');
// Pre-defined list of external storage sources.
// Here admins can define sources which will be "mounted" into users folder tree
/*
$config['fileapi_sources'] = array(
'Seafile' => array(
'driver' => 'seafile',
'host' => 'seacloud.cc',
// when username is set to '%u' current user name and password
// will be used to authenticate to this storage source
'username' => '%u',
),
'Public-Files' => array(
'driver' => 'webdav',
'baseuri' => 'https://some.host.tld/Files',
'username' => 'admin',
'password' => 'pass',
),
);
*/
// Default values for sources configuration dialog.
// Note: use driver names as the array keys.
// Note: %u variable will be resolved to the current username.
/*
$config['fileapi_presets'] = array(
'seafile' => array(
'host' => 'seacloud.cc',
'username' => '%u',
),
'webdav' => array(
'baseuri' => 'https://some.host.tld/Files',
'username' => '%u',
),
);
*/
// Manticore service URL. Enables use of WebODF collaborative editor.
// Note: this URL should be accessible from Chwala host and Roundcube host as well.
$config['fileapi_manticore'] = null;
// WOPI/Office service URL. Enables use of collaborative editor supporting WOPI.
// Note: this URL should be accessible from Chwala host and Roundcube host as well.
$config['fileapi_wopi_office'] = null;
// Name of the user interface skin.
$config['file_api_skin'] = 'default';
// Chwala UI communicates with Chwala API via HTTP protocol
// The URL here is a location of Chwala API service. By default
// the UI location is used with addition of /api/ suffix.
$config['file_api_url'] = '';
// Type of Chwala cache. Supported values: 'db', 'apc' and 'memcache'.
// Note: This is only for some additional data like WOPI capabilities.
$config['fileapi_cache'] = 'db';
// lifetime of Chwala cache
// possible units: s, m, h, d, w
$config['fileapi_cache_ttl'] = '1d';
// LDAP addressbook that would be searched for user names autocomplete.
// That should be an array refering to the Roundcube's $config['ldap_public']
// array key or complete addressbook configuration array.
$config['fileapi_users_source'] = 'kolab_addressbook';
// The LDAP attribute which will be used as ACL user identifier
$config['fileapi_users_field'] = 'mail';
// The LDAP search filter will be combined with search queries
$config['fileapi_users_filter'] = '';
+// Prefix added to the group name to build IMAP ACL identifier
+$config['fileapi_groups'] = false;
+
// Prefix added to the group name to build IMAP ACL identifier
$config['fileapi_group_prefix'] = 'group:';
// The LDAP attribute (or field name) which will be used as ACL group identifier
$config['fileapi_group_field'] = 'name';
// ------------------------------------------------
// SeaFile driver settings
// ------------------------------------------------
// Enables SeaFile Web API conversation log
$config['fileapi_seafile_debug'] = false;
// Enables caching of some SeaFile information e.g. folders list
// Note: 'db', 'apc' and 'memcache' are supported
$config['fileapi_seafile_cache'] = 'db';
// Expiration time of SeaFile cache entries
$config['fileapi_seafile_cache_ttl'] = '7d';
// Default SeaFile Web API host
// Note: http:// and https:// (default) prefixes can be used here
$config['fileapi_seafile_host'] = 'localhost';
// Enables SSL certificates validation when connecting
// with any SeaFile server
$config['fileapi_seafile_ssl_verify_host'] = false;
$config['fileapi_seafile_ssl_verify_peer'] = false;
// To support various Seafile configurations when fetching a file
// from Seafile server we proxy it via Chwala server.
// Enable this option to allow direct downloading of files
// from Seafile server to user browser.
$config['fileapi_seafile_allow_redirects'] = false;
// ------------------------------------------------
// WebDAV driver settings
// ------------------------------------------------
// Default URI location for WebDAV storage
$config['fileapi_webdav_baseuri'] = 'https://localhost/iRony';
diff --git a/lib/drivers/kolab/kolab_file_autocomplete.php b/lib/drivers/kolab/kolab_file_autocomplete.php
index b2a04da..dc4b197 100644
--- a/lib/drivers/kolab/kolab_file_autocomplete.php
+++ b/lib/drivers/kolab/kolab_file_autocomplete.php
@@ -1,170 +1,171 @@
<?php
/*
+--------------------------------------------------------------------------+
| This file is part of the Kolab File API |
| |
| Copyright (C) 2012-2018, Kolab Systems AG |
| |
| This program is free software: you can redistribute it and/or modify |
| it under the terms of the GNU Affero General Public License as published |
| by the Free Software Foundation, either version 3 of the License, or |
| (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public License |
| along with this program. If not, see <http://www.gnu.org/licenses/> |
+--------------------------------------------------------------------------+
| Author: Aleksander Machniak <machniak@kolabsys.com> |
+--------------------------------------------------------------------------+
*/
class kolab_file_autocomplete
{
private $rc;
private $ldap;
/**
* Class constructor
*/
public function __construct()
{
$this->rc = rcube::get_instance();
}
/**
* Search users/groups
*/
public function search($search, $with_groups = false)
{
if (!$this->init_ldap()) {
return false;
}
$max = (int) $this->rc->config->get('autocomplete_max', 15);
$mode = (int) $this->rc->config->get('addressbook_search_mode');
$me = $this->rc->get_user_name();
$this->ldap->set_pagesize($max);
$result = $this->ldap->search('*', $search, $mode);
$users = array();
$index = array();
foreach ($result->records as $record) {
$user = $record['uid'];
if (is_array($user)) {
$user = array_filter($user);
$user = $user[0];
}
if (in_array($me, rcube_addressbook::get_col_values('email', $record, true))) {
continue;
}
if ($user) {
$display = rcube_addressbook::compose_search_name($record);
$user = array('name' => $user, 'display' => $display);
$users[] = $user;
$index[] = $display ?: $user['name'];
}
}
- $group_prefix = $this->rc->config->get('fileapi_group_prefix');
- $group_field = $this->rc->config->get('fileapi_group_field', 'name');
+ $group_support = $this->rc->config->get('fileapi_groups');
+ $group_prefix = $this->rc->config->get('fileapi_group_prefix');
+ $group_field = $this->rc->config->get('fileapi_group_field', 'name');
- if ($with_groups && $group_field) {
+ if ($with_groups && $group_support && $group_field) {
$result = $this->ldap->list_groups($search, $mode);
foreach ($result as $record) {
$group = $record['name'];
$group_id = is_array($record[$group_field]) ? $record[$group_field][0] : $record[$group_field];
if ($group) {
$users[] = array('name' => ($group_prefix ? $group_prefix : '') . $group_id, 'display' => $group, 'type' => 'group');
$index[] = $group;
}
}
}
if (count($users)) {
array_multisort($index, SORT_ASC, SORT_LOCALE_STRING, $users);
}
if (count($users) > $max) {
$users = array_slice($users, 0, $max);
}
return $users;
}
/**
* Initializes autocomplete LDAP backend
*/
private function init_ldap()
{
if ($this->ldap) {
return $this->ldap->ready;
}
// get LDAP config
$config = $this->rc->config->get('fileapi_users_source');
if (empty($config)) {
return false;
}
// not an array, use configured ldap_public source
if (!is_array($config)) {
$ldap_config = (array) $this->rc->config->get('ldap_public');
$config = $ldap_config[$config];
}
$uid_field = $this->rc->config->get('fileapi_users_field', 'mail');
$filter = $this->rc->config->get('fileapi_users_filter');
$debug = $this->rc->config->get('ldap_debug');
$domain = $this->rc->config->mail_domain($_SESSION['imap_host']);
if (empty($uid_field) || empty($config)) {
return false;
}
// get name attribute
if (!empty($config['fieldmap'])) {
$name_field = $config['fieldmap']['name'];
}
// ... no fieldmap, use the old method
if (empty($name_field)) {
$name_field = $config['name_field'];
}
// add UID field to fieldmap, so it will be returned in a record with name
$config['fieldmap']['name'] = $name_field;
$config['fieldmap']['uid'] = $uid_field;
// search in UID and name fields
// $name_field can be in a form of <field>:<modifier> (#1490591)
$name_field = preg_replace('/:.*$/', '', $name_field);
$search = array_unique(array($name_field, $uid_field));
$config['search_fields'] = $search;
$config['required_fields'] = array($uid_field);
// set search filter
if ($filter) {
$config['filter'] = $filter;
}
// disable vlv
$config['vlv'] = false;
// Initialize LDAP connection
$this->ldap = new rcube_ldap($config, $debug, $domain);
return $this->ldap->ready;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Jun 10, 10:20 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
197054
Default Alt Text
(11 KB)
Attached To
Mode
R26 chwala
Attached
Detach File
Event Timeline
Log In to Comment