mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-23 03:08:54 +00:00
feat(acccount): Add read only account
This commit is contained in:
1 parent
01f545b0b3
commit
370a4a433c
9 files changed
+120
-40
No files matched your search
@@ -37,7 +37,7 @@
|
||||
|
||||
- (BOOL) mailCustomFromEnabled;
|
||||
- (BOOL) mailAuxiliaryUserAccountsEnabled;
|
||||
|
||||
- (BOOL) mailAuxiliaryUserAccountsReadOnly;
|
||||
- (BOOL) mailDisableXForward;
|
||||
- (NSString *) mailDomain;
|
||||
- (NSString *) imapServer;
|
||||
|
||||
@@ -106,6 +106,11 @@
|
||||
return [self boolForKey: @"SOGoMailAuxiliaryUserAccountsEnabled"];
|
||||
}
|
||||
|
||||
- (BOOL) mailAuxiliaryUserAccountsReadOnly
|
||||
{
|
||||
return [self boolForKey: @"SOGoMailAuxiliaryUserAccountsReadOnly"];
|
||||
}
|
||||
|
||||
- (BOOL) mailDisableXForward
|
||||
{
|
||||
return [self boolForKey: @"SOGoMailDisableXForward"];
|
||||
|
||||
@@ -276,6 +276,7 @@
|
||||
NSURL * smtpUrl;
|
||||
SOGoUser* user;
|
||||
SOGoSystemDefaults *sd;
|
||||
SOGoDomainDefaults *domainDefaults;
|
||||
BOOL doSmtpAuth;
|
||||
|
||||
result = nil;
|
||||
@@ -325,6 +326,16 @@
|
||||
{
|
||||
login = [currentAcount objectForKey: @"userName"];
|
||||
password = [currentAcount objectForKey: @"password"];
|
||||
domainDefaults = [[woContext activeUser] domainDefaults];
|
||||
if(!password && [domainDefaults mailAuxiliaryUserAccountsReadOnly] && [currentAcount objectForKey: @"readOnly"])
|
||||
{
|
||||
//If aux account is read only with no password, user the current user one instead
|
||||
protocol = @"imap";
|
||||
if ([encryption isEqualToString: @"ssl"] || [encryption isEqualToString: @"tls"])
|
||||
protocol = @"imaps";
|
||||
server = [NSString stringWithFormat: @"%@://%@", protocol, [currentAcount objectForKey: @"serverName"]];
|
||||
password = [authenticator smtpPasswordInContext: woContext forURL: server];
|
||||
}
|
||||
smtpAuthMethod = @"plain"; //Only support plain for auxiliary account
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1068,6 +1068,8 @@
|
||||
[self _appendSystemMailAccountWithDelegatedIdentities: appendDeletegatedIdentities];
|
||||
if ([[self domainDefaults] mailAuxiliaryUserAccountsEnabled])
|
||||
{
|
||||
|
||||
//If we are in read-only, only add account with this param
|
||||
auxAccounts = [[self userDefaults] auxiliaryMailAccounts];
|
||||
if (auxAccounts)
|
||||
{
|
||||
@@ -1085,7 +1087,8 @@
|
||||
account = [auxAccounts objectAtIndex: i];
|
||||
if (![[account objectForKey: @"password"] isKindOfClass: [NSDictionary class]])
|
||||
{
|
||||
[self errorWithFormat:@"Can't decrypt the password for auxiliary account %@, is not a dictionnary",
|
||||
if(![account objectForKey: @"readOnly"]) //Read only account can have no password
|
||||
[self errorWithFormat:@"Can't decrypt the password for auxiliary account %@, is not a dictionnary",
|
||||
[account objectForKey: @"name"]];
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user