Merge branch 'master' into feature-gdpr

This commit is contained in:
smizrahi
2023-10-18 13:29:29 +02:00
14 changed files with 88 additions and 53 deletions
+2 -2
View File
@@ -2627,17 +2627,17 @@ FIXME
// We first check of any of the collections we want to sync are already
// in an other sync process. If that's the case, we do not do anything
// and we return immediately. So we'll let the other sync process terminate
globalMetadata = [self globalMetadataForDevice];
for (j = 0; j < [allCollections count]; j++)
{
aCollection = [allCollections objectAtIndex: j];
globalMetadata = [self globalMetadataForDevice];
key = [NSString stringWithFormat: @"SyncRequest+%@", [[[(id)[aCollection getElementsByTagName: @"CollectionId"] lastObject] textValue] stringByUnescapingURL]];
if (!([[globalMetadata objectForKey: key] isEqual: processIdentifier]))
{
if (debugOn)
[self logWithFormat: @"EAS - Discard response %@", [self globalMetadataForDevice]];
[self logWithFormat: @"EAS - Discard response %@", globalMetadata];
[output appendString: @"<Status>13</Status>"];
[output appendString: @"</Sync>"];
+2 -2
View File
@@ -37,8 +37,8 @@ typedef enum
}
+ (NSString *)plistForCalendarsWithContext:(WOContext *)context andPath:(NSString *)path;
+ (NSString *)plistForContactsWithContext:(WOContext *)context andPath:(NSString *)path;
+ (NSString *)plistForCalendarsWithContext:(WOContext *)context andPath:(NSString *)path andName:(NSString *)name;
+ (NSString *)plistForContactsWithContext:(WOContext *)context andPath:(NSString *)path andName:(NSString *)name;
@end
+11 -10
View File
@@ -23,10 +23,11 @@
#import "SOGoMobileProvision.h"
#import "SOGoUser.h"
#import "NSString+Crypto.h"
@implementation SOGoMobileProvision
+ (NSString *)_plistWithContext:(WOContext *)context andPath:(NSString *)path andType:(ProvisioningType) provisioningType
+ (NSString *)_plistWithContext:(WOContext *)context andPath:(NSString *)path andType:(ProvisioningType) provisioningType andName:(NSString *)name
{
NSData *plistData;
SOGoUser *activeUser;
@@ -58,23 +59,23 @@
provisioning = [NSDictionary dictionaryWithObjectsAndKeys:
[NSArray arrayWithObject: [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithFormat:@"%@ %@", type, [activeUser login]], [NSString stringWithFormat:@"%@%@", prefix, @"AccountDescription"],
[NSString stringWithFormat:@"%@ %@", type, name], [NSString stringWithFormat:@"%@%@", prefix, @"AccountDescription"],
[serverURL host], [NSString stringWithFormat:@"%@%@", prefix, @"HostName"],
[serverURL port], [NSString stringWithFormat:@"%@%@", prefix, @"Port"],
path, [NSString stringWithFormat:@"%@%@", prefix, @"PrincipalURL"],
[NSNumber numberWithBool:[[serverURL scheme] isEqualToString:@"https"]], [NSString stringWithFormat:@"%@%@", prefix, @"UseSSL"],
[activeUser login], [NSString stringWithFormat:@"%@%@", prefix, @"Username"],
[NSString stringWithFormat: @"SOGo %@ provisioning", prefix], @"PayloadDescription",
[NSString stringWithFormat:@"%@ %@", type, [activeUser login]], @"PayloadDisplayName",
[NSString stringWithFormat:@"%@.apple.%@", [serverURL host], [prefix lowercaseString]], @"PayloadIdentifier",
[NSString stringWithFormat:@"%@ %@", type, name], @"PayloadDisplayName",
[NSString stringWithFormat:@"%@.%@.apple.%@", [serverURL host], [name asMD5String], [prefix lowercaseString]], @"PayloadIdentifier",
[serverURL host], @"PayloadOrganization",
payloadType, @"PayloadType",
[SOGoObject globallyUniqueObjectId], @"PayloadUUID",
[NSNumber numberWithInt: 1], @"PayloadVersion",
nil]], @"PayloadContent",
[NSString stringWithFormat:@"SOGo %@ provisioning", prefix], @"PayloadDescription",
[NSString stringWithFormat: @"%@ (%@)", [activeUser login], type], @"PayloadDisplayName",
[NSString stringWithFormat:@"%@.%@.apple", [prefix lowercaseString], [serverURL host]], @"PayloadIdentifier",
[NSString stringWithFormat: @"%@ (%@)", name, type], @"PayloadDisplayName",
[NSString stringWithFormat:@"%@.%@.%@.apple", [prefix lowercaseString], [serverURL host], [name asMD5String]], @"PayloadIdentifier",
@"SOGo", @"PayloadOrganization",
[NSNumber numberWithBool: NO], @"PayloadRemovalDisallowed",
@"Configuration", @"PayloadType",
@@ -88,12 +89,12 @@
error: &error];
}
+ (NSString *)plistForCalendarsWithContext:(WOContext *)context andPath:(NSString *)path
+ (NSString *)plistForCalendarsWithContext:(WOContext *)context andPath:(NSString *)path andName:(NSString *)name
{
NSData *plistData;
SOGoUser *activeUser;
plistData = [self _plistWithContext: context andPath: path andType: ProvisioningTypeCalendar];
plistData = [self _plistWithContext: context andPath: path andType: ProvisioningTypeCalendar andName: name];
if (nil != plistData) {
return [[[NSString alloc] initWithData:plistData encoding:NSUTF8StringEncoding] autorelease];
} else {
@@ -102,12 +103,12 @@
}
}
+ (NSString *)plistForContactsWithContext:(WOContext *)context andPath:(NSString *)path
+ (NSString *)plistForContactsWithContext:(WOContext *)context andPath:(NSString *)path andName:(NSString *)name
{
NSData *plistData;
SOGoUser *activeUser;
plistData = [self _plistWithContext: context andPath: path andType: ProvisioningTypeContact];
plistData = [self _plistWithContext: context andPath: path andType: ProvisioningTypeContact andName: name];
if (nil != plistData) {
return [[[NSString alloc] initWithData:plistData encoding:NSUTF8StringEncoding] autorelease];
} else {
+2 -1
View File
@@ -103,7 +103,8 @@
/* ownership */
- (void) setOwner: (NSString *) newOwner;
- (NSString *)owner;
- (void)setOwner:(NSString *)newOwner;
- (NSString *) ownerInContext: (id) _ctx;
/* a helper that determines whether access rights can be ignored on
+5
View File
@@ -211,6 +211,11 @@
/* ownership */
- (NSString *) owner
{
return owner;
}
- (void) setOwner: (NSString *) newOwner
{
NSString *uid;
+26
View File
@@ -51,6 +51,7 @@
#import <SoObjects/Contacts/SOGoContactGCSFolder.h>
#import <SOGo/NSString+Utilities.h>
#import <SOGo/SOGoMobileProvision.h>
#import "UIxContactFolderActions.h"
@@ -463,4 +464,29 @@ static NSArray *photoTags = nil;
return rc;
}
- (WOResponse *) mobileconfigAction
{
SOGoContactGCSFolder *folder;
NSString *davURL, *plistContent, *disposition;
WOResponse *response;
folder = [self clientObject];
davURL = [folder davURLAsString];
plistContent = [SOGoMobileProvision plistForContactsWithContext: context andPath: davURL andName: [NSString stringWithFormat: @"%@ - %@", [folder owner], [folder realNameInContainer]]];
if (nil != plistContent) {
response = [self responseWithStatus: 200
andString: plistContent];
[response setHeader: @"application/x-plist; charset=utf-8"
forKey: @"content-type"];
disposition = [NSString stringWithString: @"attachment; filename=\"contacts.mobileconfig\""];
[response setHeader: disposition forKey: @"Content-Disposition"];
} else {
response = [self responseWithStatus: 500
andString: @"Error while generating profile"];
}
return response;
}
@end /* UIxContactFolderActions */
-26
View File
@@ -35,7 +35,6 @@
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoUserManager.h>
#import <SOGo/SOGoMobileProvision.h>
#import <Contacts/NGVCard+SOGo.h>
#import <Contacts/SOGoContactObject.h>
@@ -450,29 +449,4 @@
return [NSString stringWithFormat: @"%@/photo", [soURL absoluteString]];
}
- (WOResponse *) mobileconfigAction
{
SOGoContactFolders *folders;
NSString *davURL, *plistContent, *disposition;
WOResponse *response;
folders = [self clientObject];
davURL = [[folders container] davURLAsString];
plistContent = [SOGoMobileProvision plistForContactsWithContext: context andPath: davURL];
if (nil != plistContent) {
response = [self responseWithStatus: 200
andString: plistContent];
[response setHeader: @"application/x-plist; charset=utf-8"
forKey: @"content-type"];
disposition = [NSString stringWithString: @"attachment; filename=\"contacts.mobileconfig\""];
[response setHeader: disposition forKey: @"Content-Disposition"];
} else {
response = [self responseWithStatus: 500
andString: @"Error while generating profile"];
}
return response;
}
@end /* UIxContactView */
+5 -5
View File
@@ -50,11 +50,6 @@
pageName = "UIxContactFoldersView";
actionName = "saveDragHandleState";
};
mobileconfig = {
protectedBy = "Access Contents Information";
actionClass = "UIxContactView";
actionName = "mobileconfig";
};
};
};
@@ -115,6 +110,11 @@
pageName = "UIxContactFolderProperties";
actionName = "saveProperties";
};
mobileconfig = {
protectedBy = "Access Contents Information";
actionClass = "UIxContactFolderActions";
actionName = "mobileconfig";
};
};
};
@@ -507,7 +507,7 @@
"Let SOGo handle everything" = "Let SOGo handle everything";
/* Password Recovery */
"Password recovery mode" = "Password recovery";
"Password recovery mode" = "Password recovery mode";
"Question" = "Question";
"Secondary e-mail" = "Secondary e-mail";
"Answer" = "Answer";
@@ -507,7 +507,7 @@
"Let SOGo handle everything" = "Laissez SOGo s'occuper de tout";
/* Password Recovery */
"Password recovery mode" = "Récupération de mot de passe";
"Password recovery mode" = "Mode de récupération de mot de passe";
"Question" = "Question";
"Secondary e-mail" = "E-mail secondaire";
"Answer" = "Réponse";
+1 -1
View File
@@ -666,7 +666,7 @@
folders = [self clientObject];
davURL = [[folders container] davURLAsString];
plistContent = [SOGoMobileProvision plistForCalendarsWithContext: context andPath: davURL];
plistContent = [SOGoMobileProvision plistForCalendarsWithContext: context andPath: davURL andName: [folders owner]];
if (nil != plistContent) {
response = [self responseWithStatus: 200
@@ -205,6 +205,12 @@
<var:string label:value="Export"/>
</md-button>
</md-menu-item>
<md-menu-divider><!-- divider --></md-menu-divider>
<md-menu-item>
<md-button ng-click="folder.downloadProvisioningProfile()">
 <var:string label:value="Download configuration profile"/>
</md-button>
</md-menu-item>
</md-menu-content>
</md-menu>
</md-list-item>
@@ -756,14 +756,25 @@
* @returns a promise of the HTTP operation
*/
AddressBook.prototype.downloadProvisioningProfile = function () {
var options;
var options, resource, index, ownerPaths, realOwnerId, path;
options = {
type: 'application/octet-stream',
filename: 'addressbook.mobileconfig'
}
return AddressBook.$$resource.open('', 'mobileconfig', null, options);
if (this.isSubscription) {
index = this.urls.cardDavURL.indexOf('/dav/');
ownerPaths = this.urls.cardDavURL.substring(index + 5).split(/\//);
realOwnerId = ownerPaths[0];
resource = AddressBook.$$resource.userResource(realOwnerId);
path = ownerPaths[1] + '/' + ownerPaths[2];
} else {
resource = AddressBook.$$resource;
path = this.id;
}
return resource.open(path, 'mobileconfig', null, options);
};
/**
@@ -583,14 +583,25 @@
* @returns a promise of the HTTP operation
*/
Calendar.prototype.downloadProvisioningProfile = function () {
var options;
var options, resource, index, ownerPaths, realOwnerId, path;
options = {
type: 'application/octet-stream',
filename: 'calendar.mobileconfig'
}
return Calendar.$$resource.open('', 'mobileconfig', null, options);
if (this.isSubscription) {
index = this.urls.webDavICSURL.indexOf('/dav/');
ownerPaths = this.urls.webDavICSURL.substring(index + 5).split(/\//);
realOwnerId = ownerPaths[0];
resource = Calendar.$$resource.userResource(realOwnerId);
path = 'Calendar';
} else {
resource = Calendar.$$resource;
path = '';
}
return resource.open(path, 'mobileconfig', null, options);
};
/**