From 8abae60dcaf7faf237a36085cdc0440e81a02d76 Mon Sep 17 00:00:00 2001 From: alec Date: Wed, 25 May 2011 13:05:46 +0000 Subject: - Add support for anyone/anonymous ACL git-svn-id: https://svn.roundcube.net/trunk@4809 208e9e7b-5314-0410-a742-e7e81cd9613c --- plugins/acl/acl.js | 59 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 16 deletions(-) (limited to 'plugins/acl/acl.js') diff --git a/plugins/acl/acl.js b/plugins/acl/acl.js index 0bf194804..4efe55f14 100644 --- a/plugins/acl/acl.js +++ b/plugins/acl/acl.js @@ -1,7 +1,7 @@ /** * ACL plugin script * - * @version 0.1 + * @version 0.2 * @author Aleksander Machniak */ @@ -45,13 +45,18 @@ rcube_webmail.prototype.acl_delete = function() // Save ACL data rcube_webmail.prototype.acl_save = function() { - var user = $('#acluser').val(), rights = ''; + var user = $('#acluser').val(), rights = '', type; $(':checkbox', this.env.acl_advanced ? $('#advancedrights') : sim_ul = $('#simplerights')).map(function() { if (this.checked) rights += this.value; }); + if (type = $('input:checked[name=usertype]').val()) { + if (type != 'user') + user = type; + } + if (!user) { alert(this.get_label('acl.nouser')); return; @@ -148,10 +153,15 @@ rcube_webmail.prototype.acl_get_usernames = function() selection = list.get_selection(); for (n=0, len=selection.length; n= 0) { + users.push(selection[n]); + } + else { + row = list.rows[selection[n]].obj; + cell = $('td.user', row); + if (cell.length == 1) + users.push(cell.text()); + } } return users; @@ -169,7 +179,7 @@ rcube_webmail.prototype.acl_remove_row = function(id) // Adds ACL table row rcube_webmail.prototype.acl_add_row = function(o, sel) { - var n, len, ids = [], id = o.id, list = this.acl_list, + var n, len, ids = [], spec = [], id = o.id, list = this.acl_list, items = this.env.acl_advanced ? [] : this.env.acl_items, table = this.gui_objects.acltable, row = $('thead > tr', table).clone(); @@ -193,10 +203,17 @@ rcube_webmail.prototype.acl_add_row = function(o, sel) this.env.acl[id] = o.acl; // sorting... (create an array of user identifiers, then sort it) - for (n in this.env.acl) - if (this.env.acl[n]) - ids.push(n); + for (n in this.env.acl) { + if (this.env.acl[n]) { + if (this.env.acl_specials.length && $.inArray(n, this.env.acl_specials) >= 0) + spec.push(n); + else + ids.push(n); + } + } ids.sort(); + // specials on the top + ids = spec.concat(ids); // find current id for (n=0, len=ids.length; n