mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-11 03:15:10 +00:00
Improve display of S/MIME certificates
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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])
|
||||
|
||||
@@ -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";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user