Improve display of S/MIME certificates

This commit is contained in:
Francis Lachapelle
2018-01-23 13:30:56 -05:00
parent 511aa63a34
commit 7ebdac5525
17 changed files with 291 additions and 60 deletions
@@ -239,6 +239,12 @@
"Unable to subscribe to that folder!"
= "Unable to subscribe to that folder.";
/* security */
"Security" = "Security";
"Uninstall" = "Uninstall";
"Error reading the card certificate." = "Error reading the card certificate.";
"No certificate associated to card." = "No certificate associated to card.";
/* acls */
"Access rights to" = "Access rights to";
"For user" = "For user";
+46 -1
View File
@@ -1,6 +1,6 @@
/* UIxContactActions.m - this file is part of SOGo
*
* Copyright (C) 2010-2016 Inverse inc.
* Copyright (C) 2010-2018 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
@@ -19,6 +19,7 @@
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <NGExtensions/NSString+misc.h>
@@ -30,6 +31,8 @@
#import <Contacts/SOGoContactGCSEntry.h>
#import <Mailer/NSData+SMIME.h>
#import <SOGoUI/SOGoDirectAction.h>
@interface NGVCard (SOGoActionCategory)
@@ -147,4 +150,46 @@
return response;
}
- (WOResponse *) certificateAction
{
NSData *pkcs7;
NSDictionary *data;
WOResponse *response;
pkcs7 = [[[self clientObject] vCard] certificate];
if (pkcs7)
{
data = [[pkcs7 convertPKCS7ToPEM] certificateDescription];
if (data)
{
response = [self responseWithStatus: 200 andJSONRepresentation: data];
}
else
{
data = [NSDictionary
dictionaryWithObject: [self labelForKey: @"Error reading the card certificate."]
forKey: @"message"];
response = [self responseWithStatus: 500 andJSONRepresentation: data];
}
}
else
{
data = [NSDictionary
dictionaryWithObject: [self labelForKey: @"No certificate associated to card."]
forKey: @"message"];
response = [self responseWithStatus: 404 andJSONRepresentation: data];
}
return response;
}
- (WOResponse *) removeCertificateAction
{
[[[self clientObject] vCard] setCertificate: nil];
return [self responseWith204];
}
@end
+6 -1
View File
@@ -252,6 +252,7 @@
* @apiSuccess (Success 200) {String[]} allCategories All available categories
* @apiSuccess (Success 200) {Object[]} [categories] Categories assigned to the card
* @apiSuccess (Success 200) {String} categories.value Category name
* @apiSuccess (Success 200) {Number} hasCertificate 1 if contact has a mail certificate
* @apiSuccess (Success 200) {Object[]} [addresses] Postal addresses
* @apiSuccess (Success 200) {String} addresses.type Type (e.g., home or work)
* @apiSuccess (Success 200) {String} addresses.postoffice Post office box
@@ -330,6 +331,10 @@
[data setObject: [values subarrayWithRange: NSMakeRange(1, [values count] - 1)] forKey: @"orgs"];
}
o = [card certificate];
if ([o length])
[data setObject: [NSNumber numberWithBool: YES] forKey: @"hasCertificate"];
o = [card birthday];
if (o)
[data setObject: [o descriptionWithCalendarFormat: @"%Y-%m-%d"]
@@ -361,7 +366,7 @@
if ((o = [[card uniqueChildWithTag: @"custom1"] flattenedValuesForKey: @""]) && [o length])
[customFields setObject: o forKey: @"1"];
if ((o = [[card uniqueChildWithTag: @"custom2"] flattenedValuesForKey: @""]) && [o length])
if ((o = [[card uniqueChildWithTag: @"custom2"] flattenedValuesForKey: @""]) && [o length])
[customFields setObject: o forKey: @"2"];
if ((o = [[card uniqueChildWithTag: @"custom3"] flattenedValuesForKey: @""]) && [o length])
+10
View File
@@ -234,6 +234,16 @@
actionClass = "UIxContactActions";
actionName = "raw";
};
certificate = {
protectedBy = "View";
actionClass = "UIxContactActions";
actionName = "certificate";
};
removeCertificate = {
protectedBy = "Change Images And Files";
actionClass = "UIxContactActions";
actionName = "removeCertificate";
};
};
};