Skip to content

Commit

Permalink
[jan] Fix losing shared users when adding invalid user name (Bug #144…
Browse files Browse the repository at this point in the history
…15).
  • Loading branch information
yunosh committed Jul 11, 2016
1 parent 837fe0f commit 3a827c5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
21 changes: 17 additions & 4 deletions kronolith/js/kronolith.js
Expand Up @@ -3435,7 +3435,9 @@ KronolithCore = {
var users = $F('kronolithC' + type + 'PUList').strip();
users = users ? users.split(/,\s*/) : [];
users.each(function(user) {
this.insertGroupOrUser(type, 'user', user, true);
if (!this.insertGroupOrUser(type, 'user', user, true)) {
return;
}
$('kronolithC' + type + 'PUshow_' + user).setValue(1);
$('kronolithC' + type + 'PUread_' + user).setValue(1);
if ($F('kronolithC' + type + 'PUPerms') == 'edit') {
Expand Down Expand Up @@ -3492,7 +3494,9 @@ KronolithCore = {
case 'groups':
if (!Object.isArray(perm.value)) {
$H(perm.value).each(function(group) {
this.insertGroupOrUser(type, 'group', group.key);
if (!this.insertGroupOrUser(type, 'group', group.key)) {
return;
}
if (!$('kronolithC' + type + 'PGshow_' + group.key)) {
// Group doesn't exist anymore.
delete perm.value[group.key];
Expand All @@ -3515,7 +3519,9 @@ KronolithCore = {
if (!Object.isArray(perm.value)) {
$H(perm.value).each(function(user) {
if (system || user.key != Kronolith.conf.user) {
this.insertGroupOrUser(type, 'user', user.key);
if (!this.insertGroupOrUser(type, 'user', user.key)) {
return;
}
if (!$('kronolithC' + type + 'PUshow_' + user.key)) {
// User doesn't exist anymore.
delete perm.value[user.key];
Expand Down Expand Up @@ -3707,6 +3713,8 @@ KronolithCore = {
* Defaults to the value of the drop down.
* @param stay_basic boolean Enforces to NOT switch to the advanced
* permissions screen.
*
* @return boolean Whether a row has been inserted.
*/
insertGroupOrUser: function(type, what, id, stay_basic)
{
Expand All @@ -3716,7 +3724,10 @@ KronolithCore = {
}
var value = elm.getValue();
if (!value) {
return;
if (id) {
HordeCore.notify(Kronolith.text.invalid_user + ': ' + id, 'horde.error');
}
return false;
}

var tr = elm.up('tr'),
Expand Down Expand Up @@ -3745,6 +3756,8 @@ KronolithCore = {
if (!stay_basic) {
this.activateAdvancedPerms(type);
}

return true;
},

/**
Expand Down
1 change: 1 addition & 0 deletions kronolith/lib/Ajax.php
Expand Up @@ -155,6 +155,7 @@ protected function _addBaseVars()
'geocode_error' => _("Unable to locate requested address"),
'hidelog' => _("Hide Notifications"),
'import_warning' => _("Importing calendar data. This may take a while..."),
'invalid_user' => _("User does not exist"),
'more' => _("more..."),
'no_assignee' => _("None"),
'no_calendar_title' => _("The calendar title must not be empty."),
Expand Down
2 changes: 2 additions & 0 deletions kronolith/package.xml
Expand Up @@ -2786,6 +2786,8 @@
<date>2016-07-01</date>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [jan] Fix losing shared users when adding invalid user name (Bug #14415).
* [mjr] Fix displaying tag search results (Bug #14412).
* [jan] Fix sender of event change notification messages.
</notes>
</release>
Expand Down

0 comments on commit 3a827c5

Please sign in to comment.