2007-05-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+ * UI/Common/UIxObjectActions.m ([UIxObjectActions
+ -removeUserFromAclsAction]): implemented this method which was
+ missing and is required to remove users from ACLs.
+
+ * UI/Common/UIxFolderActions.m ([UIxFolderActions
+ -subscribeAction]): folderDict was not autoreleased, resulting in
+ a leak...
+
+ * SoObjects/SOGo/AgenorUserDefaults.m ([AgenorUserDefaults
+ -primaryFetchProfile]): when building with libFoundation, don't
+ use the "propertyList" method from NSString. Rather, we convert
+ the string to an NSData instance and passit as parameter to
+ NSDeserializer. This way, we obtain a mutable dictionary rather
+ than an immutable one.
+
* SoObjects/Mailer/SOGoDraftObject.m ([SOGoDraftObject -bodyPartForText])
([SOGoDraftObject -mimeMessageForContentWithHeaderMap:]): use the
constant string "contentTypeValue".
NSString *sql, *value;
NSArray *attrs;
BOOL rc;
+#if LIB_FOUNDATION_LIBRARY
+ NSData *plistData;
+#endif
rc = NO;
/* remember values */
value = [row objectForKey: fieldName];
if ([value isNotNull])
- [values setDictionary: [value propertyList]];
+ {
+#if LIB_FOUNDATION_LIBRARY
+ plistData = [value dataUsingEncoding: NSUTF8StringEncoding];
+ [values setDictionary: [NSDeserializer
+ deserializePropertyListFromData: plistData
+ mutableContainers: YES]];
+
+#else
+ [values setDictionary: [value propertyList]];
+#endif
+ }
ASSIGN (lastFetch, [NSCalendarDate date]);
defFlags.modified = NO;
ASSIGN (fallbackIMAP4Server, [ud stringForKey: @"SOGoFallbackIMAP4Server"]);
}
-+ (SOGoUser *) userWithLogin: (NSString *) login
- roles: (NSArray *) roles
++ (SOGoUser *) userWithLogin: (NSString *) newLogin
+ roles: (NSArray *) newRoles
{
SOGoUser *user;
- user = [[self alloc] initWithLogin: login roles: roles];
+ user = [[self alloc] initWithLogin: newLogin roles: newRoles];
[user autorelease];
return user;
else
folderName = email;
- folderDict = [NSMutableDictionary new];
+ folderDict = [NSMutableDictionary dictionary];
[folderDict setObject: folderName forKey: @"displayName"];
[folderDict setObject: [NSNumber numberWithBool: NO] forKey: @"active"];
{
WOResponse *response;
WORequest *request;
- NSString *uid, *email;
+ NSString *uid;
unsigned int code;
LDAPUserManager *um;
SOGoObject *clientObject;
if ([uid length] > 0)
{
um = [LDAPUserManager sharedUserManager];
- email = [um getEmailForUID: uid];
- if ([email length] > 0)
+ if ([um contactInfosForUserWithUIDorEmail: uid])
{
clientObject = [self clientObject];
[clientObject setRoles: [clientObject defaultAclRoles]
return response;
}
+- (WOResponse *) removeUserFromAclsAction
+{
+ WOResponse *response;
+ WORequest *request;
+ NSString *uid;
+ unsigned int code;
+ LDAPUserManager *um;
+
+ code = 403;
+ request = [context request];
+ uid = [request formValueForKey: @"uid"];
+ if ([uid length] > 0)
+ {
+ um = [LDAPUserManager sharedUserManager];
+ if ([um contactInfosForUserWithUIDorEmail: uid])
+ {
+ [[self clientObject] removeAclsForUsers: [NSArray arrayWithObject: uid]];
+ code = 204;
+ }
+ }
+
+ response = [context response];
+ [response setStatus: code];
+
+ return response;
+}
+
@end
actionClass = "UIxObjectActions";
actionName = "addUserInAcls";
};
+ removeUserFromAcls = {
+ protectedBy = "SaveAcls";
+ actionClass = "UIxObjectActions";
+ actionName = "removeUserFromAcls";
+ };
acls = {
protectedBy = "ReadAcls";
pageName = "UIxAclEditor";
- (BOOL) statusPercentDisabled
{
- NSLog (@"status: '%@'", status);
return ([status length] == 0
|| [status isEqualToString: @"CANCELLED"]);
}
}
- (void)setHour:(id)_hour {
- NSLog (@"---------------- setHour:");
ASSIGN(hour, _hour);
}
- (void) setDayStartHour: (unsigned int) aStartHour
{
- NSLog (@"******************** setDayStartHour...");
startHour = aStartHour;
}
event.preventDefault();
}
+function removeUserCallback(http) {
+ var node = http.callbackData;
+
+ if (http.readyState == 4
+ && http.status == 204)
+ node.parentNode.removeChild(node);
+ else
+ log("error deleting user: " + node.getAttribute("id"));
+}
+
function onUserRemove(event) {
var userList = $("userList");
var nodes = userList.getSelectedRows();
- for (var i = 0; i < nodes.length; i++)
- userList.removeChild(nodes[i]);
+
+ var url = window.location.href;
+ var elements = url.split("/");
+ elements[elements.length-1] = "removeUserFromAcls?uid=";
+ var baseURL = elements.join("/");
+
+ for (var i = 0; i < nodes.length; i++) {
+ var userId = nodes[i].getAttribute("id");
+ triggerAjaxRequest(baseURL + userId, removeUserCallback, nodes[i]);
+ }
event.preventDefault();
}
this.addClassName("_chosen");
this.parentNode.chosenNode = this;
- log("classification: " + classification);
+// log("classification: " + classification);
var privacyInput = document.getElementById("privacy");
privacyInput.value = classification;
}