diff --git a/UI/Common/UIxFolderActions.h b/UI/Common/UIxFolderActions.h index 8d77775ec..83d1a34c9 100644 --- a/UI/Common/UIxFolderActions.h +++ b/UI/Common/UIxFolderActions.h @@ -1,6 +1,6 @@ /* UIxFolderActions.h - this file is part of SOGo * - * Copyright (C) 2007-2013 Inverse inc. + * Copyright (C) 2007-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,6 +48,7 @@ - (WOResponse *) canAccessContentAction; - (WOResponse *) activateFolderAction; - (WOResponse *) deactivateFolderAction; +- (WOResponse *) newguidAction; @end diff --git a/UI/Common/UIxFolderActions.m b/UI/Common/UIxFolderActions.m index 48c684ac0..332c98b9e 100644 --- a/UI/Common/UIxFolderActions.m +++ b/UI/Common/UIxFolderActions.m @@ -1,6 +1,6 @@ /* UIxFolderActions.m - this file is part of SOGo * - * Copyright (C) 2007-2013 Inverse inc. + * Copyright (C) 2007-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -192,6 +192,40 @@ return [self _realFolderActivation: NO]; } +- (WOResponse *) newguidAction +{ + NSString *objectId, *folderId; + NSDictionary *data; + WOResponse *response; + SOGoFolder *co; + SoSecurityManager *sm; + + co = [self clientObject]; + objectId = [co globallyUniqueObjectId]; + if ([objectId length] > 0) + { + sm = [SoSecurityManager sharedSecurityManager]; + if (![sm validatePermission: SoPerm_AddDocumentsImagesAndFiles + onObject: co + inContext: context]) + { + folderId = [co nameInContainer]; + } + else + { + folderId = @"personal"; + } + data = [NSDictionary dictionaryWithObjectsAndKeys: objectId, @"id", folderId, @"pid", nil]; + response = [self responseWithStatus: 200 + andString: [data jsonRepresentation]]; + } + else + response = [NSException exceptionWithHTTPStatus: 500 /* Internal Error */ + reason: @"could not create a unique ID"]; + + return response; +} + - (WOResponse *) renameFolderAction { WOResponse *response; diff --git a/UI/Common/product.plist b/UI/Common/product.plist index 160e4155f..84b835fc5 100644 --- a/UI/Common/product.plist +++ b/UI/Common/product.plist @@ -74,6 +74,15 @@ }; }; }; + SOGoFolder = { + methods = { + newguid = { + protectedBy = ""; + actionClass = "UIxFolderActions"; + actionName = "newguid"; + }; + }; + }; SOGoGCSFolder = { methods = { subscribe = {