/**
* Folders Access Control Lists Management (RFC4314, RFC2086)
*
- * @version 0.6.1
+ * @version @package_version@
* @author Aleksander Machniak <alec@alec.pl>
*
*
$this->load_config();
$search = get_input_value('_search', RCUBE_INPUT_GPC, true);
+ $sid = get_input_value('_id', RCUBE_INPUT_GPC);
$users = array();
if ($this->init_ldap()) {
- $this->ldap->set_pagesize(15);
- $result = $this->ldap->search('*', $search);
+ $max = (int) $this->rc->config->get('autocomplete_max', 15);
+ $mode = (int) $this->rc->config->get('addressbook_search_mode');
+
+ $this->ldap->set_pagesize($max);
+ $result = $this->ldap->search('*', $search, $mode);
foreach ($result->records as $record) {
$user = $record['uid'];
sort($users, SORT_LOCALE_STRING);
- $this->rc->output->command('ksearch_query_results', $users, $search);
+ $this->rc->output->command('ksearch_query_results', $users, $search, $sid);
$this->rc->output->send();
}
'aclrights' => array($this, 'templ_rights'),
));
+ $this->rc->output->set_env('autocomplete_max', (int)$this->rc->config->get('autocomplete_max', 15));
+ $this->rc->output->set_env('autocomplete_min_length', $this->rc->config->get('autocomplete_min_length'));
+ $this->rc->output->add_label('autocompletechars', 'autocompletemore');
+
$args['form']['sharing'] = array(
'name' => Q($this->gettext('sharing')),
'content' => $this->rc->output->parse('acl.table', false, false),
$acl = trim(get_input_value('_acl', RCUBE_INPUT_GPC));
$oldid = trim(get_input_value('_old', RCUBE_INPUT_GPC));
- $acl = array_intersect(str_split($acl), $this->rights_supported());
+ $acl = array_intersect(str_split($acl), $this->rights_supported());
+ $users = $oldid ? array($user) : explode(',', $user);
- if (!empty($this->specials) && in_array($user, $this->specials)) {
- $username = $this->gettext($user);
- }
- else {
- if (!strpos($user, '@') && ($realm = $this->get_realm())) {
- $user .= '@' . rcube_idn_to_ascii(preg_replace('/^@/', '', $realm));
+ foreach ($users as $user) {
+ $user = trim($user);
+
+ if (!empty($this->specials) && in_array($user, $this->specials)) {
+ $username = $this->gettext($user);
+ }
+ else {
+ if (!strpos($user, '@') && ($realm = $this->get_realm())) {
+ $user .= '@' . rcube_idn_to_ascii(preg_replace('/^@/', '', $realm));
+ }
+ $username = $user;
}
- $username = $user;
- }
- if ($acl && $user && $user != $_SESSION['username'] && strlen($mbox)) {
- $result = $this->rc->imap->set_acl($mbox, $user, $acl);
+ if (!$acl || !$user || !strlen($mbox)) {
+ continue;
+ }
+
+ if ($user != $_SESSION['username'] && $username != $_SESSION['username']) {
+ if ($this->rc->imap->set_acl($mbox, $user, $acl)) {
+ $ret = array('id' => html_identifier($user),
+ 'username' => $username, 'acl' => implode($acl), 'old' => $oldid);
+ $this->rc->output->command('acl_update', $ret);
+ $result++;
+ }
+ }
}
if ($result) {
- $ret = array('id' => html_identifier($user),
- 'username' => $username, 'acl' => implode($acl), 'old' => $oldid);
- $this->rc->output->command('acl_update', $ret);
$this->rc->output->show_message($oldid ? 'acl.updatesuccess' : 'acl.createsuccess', 'confirmation');
}
else {
$user = explode(',', $user);
foreach ($user as $u) {
+ $u = trim($u);
if ($this->rc->imap->delete_acl($mbox, $u)) {
$this->rc->output->command('acl_remove_row', html_identifier($u));
}
$acl = $this->rc->imap->get_acl('INBOX');
if (is_array($acl)) {
$regexp = '/^' . preg_quote($_SESSION['username'], '/') . '@(.*)$/';
- $regexp = '/^' . preg_quote('aleksander.machniak', '/') . '@(.*)$/';
foreach (array_keys($acl) as $name) {
if (preg_match($regexp, $name, $matches)) {
$domain = $matches[1];