diff --git a/ChangeLog b/ChangeLog index f2847208b..ee5fd8cb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-06-07 Wolfgang Sourdeau + + * UI/Common/UIxAclEditor.m (-isPublicAccessEnabled): we now expose + the state of public access in order to not show the "anonymous" + user when not needed. + 2010-06-05 Wolfgang Sourdeau * UI/Scheduler/UIxCalendarProperties.m (-calDavURL, -webDavICSURL) diff --git a/UI/Common/UIxAclEditor.m b/UI/Common/UIxAclEditor.m index 4c3589fac..55344e119 100644 --- a/UI/Common/UIxAclEditor.m +++ b/UI/Common/UIxAclEditor.m @@ -33,6 +33,7 @@ #import #import #import +#import #import #import @@ -121,8 +122,7 @@ ASSIGN (defaultUserID, [[self clientObject] defaultUserID]); aclsEnum = [[self aclsForObject] objectEnumerator]; - currentUID = [aclsEnum nextObject]; - while (currentUID) + while ((currentUID = [aclsEnum nextObject])) { if ([currentUID hasPrefix: @"@"]) // NOTE: don't remove the prefix if we want to identify the lists visually @@ -131,7 +131,6 @@ || [currentUID isEqualToString: defaultUserID] || [currentUID isEqualToString: @"anonymous"])) [users addObjectUniquely: currentUID]; - currentUID = [aclsEnum nextObject]; } prepared = YES; @@ -231,14 +230,10 @@ inContext: context]); } -// - (id ) addUserInAcls -// { -// SOGoObject *clientObject; -// NSString *uid; - -// uid = [self queryParameterForKey: @"uid"]; - -// clientObject = [self clientObject]; -// } +- (BOOL) isPublicAccessEnabled +{ + return [[SOGoSystemDefaults sharedSystemDefaults] + enablePublicAccess]; +} @end diff --git a/UI/Templates/UIxAclEditor.wox b/UI/Templates/UIxAclEditor.wox index 75ff5c8d0..0cb2ec0e2 100644 --- a/UI/Templates/UIxAclEditor.wox +++ b/UI/Templates/UIxAclEditor.wox @@ -8,15 +8,18 @@ xmlns:rsrc="OGo:url" className="UIxPageFrame" title="title" + const:toolbar="none" const:popup="YES"> - +
diff --git a/UI/WebServerResources/UIxAclEditor.js b/UI/WebServerResources/UIxAclEditor.js index 07bbe47f8..45d40c44d 100644 --- a/UI/WebServerResources/UIxAclEditor.js +++ b/UI/WebServerResources/UIxAclEditor.js @@ -16,13 +16,23 @@ function addUser(userName, userID) { var lis = ul.childNodesWithTag("li"); var newNode = nodeForUser(userName, userID, canSubscribeUsers); newNode.addClassName("normal-user"); - if (lis.length > 1) { - var publicNode = lis[lis.length-2]; - ul.insertBefore(newNode, publicNode); + + var count = lis.length - 1; + var nextLi = null; + while (count > -1 && !nextLi) { + log("current li: " + lis[count].id); + if (lis[count].hasClassName("normal-user")) { + nextLi = lis[count+1]; + } + else { + count--; + } } - else { - ul.appendChild(newNode); + if (!nextLi) { + nextLi = lis[0]; } + ul.insertBefore(newNode, nextLi); + var url = window.location.href; var elements = url.split("/"); elements[elements.length-1] = ("addUserInAcls?uid=" @@ -115,8 +125,11 @@ function onUserRemove(event) { var baseURL = elements.join("/"); for (var i = 0; i < nodes.length; i++) { - var userId = nodes[i].getAttribute("id"); - triggerAjaxRequest(baseURL + userId, removeUserCallback, nodes[i]); + var userId = nodes[i].id; + if (userId != defaultUserID && userId != "anonymous") { + triggerAjaxRequest(baseURL + userId, removeUserCallback, + nodes[i]); + } } preventDefault(event); } @@ -175,7 +188,7 @@ function onAclLoadHandler() { defaultUserID); userNode.addClassName("any-user"); ul.appendChild(userNode); - if (CurrentModule() != "Mail") { + if (isPublicAccessEnabled && CurrentModule() != "Mail") { userNode = nodeForUser(_("Public Access"), "anonymous"); userNode.addClassName("anonymous-user"); ul.appendChild(userNode);