(sogo-tool) Fix ACLs restore in single store mode

Fixes #4256
Fixes #4385
Fixes #4390
This commit is contained in:
Francis Lachapelle
2018-04-27 12:34:55 -04:00
parent b8958b931e
commit f31892044b
3 changed files with 16 additions and 6 deletions

1
NEWS
View File

@@ -7,6 +7,7 @@ Enhancements
Bug fixes
- [core] properly update the last-modified attribute (#4313)
- [core] fixed default data value for c_hascertificate (#4442)
- [core] fixed ACLs restoration with sogo-tool in single store mode (#4385)
- [web] prevent deletion of special folders using del key
- [web] fixed SAML2 session timeout handling during XHR requests
- [web] fixed renaming a folder under iOS

View File

@@ -1650,11 +1650,13 @@ andAttribute: (EOAttribute *)_attribute
sql = [NSMutableString stringWithCapacity:256];
[sql appendString:@"DELETE FROM "];
[sql appendString:[self aclTableName]];
if ([GCSFolderManager singleStoreMode])
[sql appendFormat:@" WHERE c_folder_id = %@", folderId];
qSql = [self _sqlForQualifier: [_fs qualifier]];
if (qSql)
{
if ([GCSFolderManager singleStoreMode])
[sql appendFormat:@" WHERE c_folder_id = %@ AND (%@)", folderId, qSql];
[sql appendFormat:@" AND (%@)", qSql];
else
[sql appendFormat:@" WHERE %@", qSql];
}

View File

@@ -348,11 +348,18 @@
userRoles = [[acl objectForKey: currentUser] objectEnumerator];
while ((currentRole = [userRoles nextObject]))
{
SQL = [NSString stringWithFormat: @"INSERT INTO %@"
@" (c_object, c_uid, c_role)"
@" VALUES ('%@', '%@', '%@')",
aclTableName,
folderPath, currentUser, currentRole];
if ([GCSFolderManager singleStoreMode])
SQL = [NSString stringWithFormat: @"INSERT INTO %@"
@" (c_object, c_uid, c_role, c_folder_id)"
@" VALUES ('%@', '%@', '%@', %@)",
aclTableName,
folderPath, currentUser, currentRole, [gcsFolder folderId]];
else
SQL = [NSString stringWithFormat: @"INSERT INTO %@"
@" (c_object, c_uid, c_role)"
@" VALUES ('%@', '%@', '%@')",
aclTableName,
folderPath, currentUser, currentRole];
[channel evaluateExpressionX: SQL];
}
}