mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-13 07:47:12 +00:00
Monotone-Parent: 36c59ea6f5d3705bff60a615e113d6b9e7a7501e
Monotone-Revision: 2ae12f2c67f3e74fddaf5d592a19e233d0806899 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-04-26T01:16:19 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
e17d43a24e
commit
27d801a9fc
14 files changed
+332
-142
No files matched your search
@@ -25,6 +25,7 @@
|
||||
#import <GDLContentStore/GCSFolder.h>
|
||||
#import <GDLContentStore/GCSFolderType.h>
|
||||
|
||||
#import "SOGoPermissions.h"
|
||||
#import "SOGoFolder.h"
|
||||
#import "common.h"
|
||||
#import <unistd.h>
|
||||
@@ -240,6 +241,7 @@
|
||||
|
||||
/* acls as a container */
|
||||
|
||||
#warning we should cache those data to avoid numerous accesses to the database
|
||||
- (NSArray *) aclsForObjectAtPath: (NSArray *) objectPathArray;
|
||||
{
|
||||
EOQualifier *qualifier;
|
||||
@@ -257,6 +259,7 @@
|
||||
{
|
||||
EOQualifier *qualifier;
|
||||
NSArray *records;
|
||||
NSMutableArray *acls;
|
||||
NSString *qs;
|
||||
|
||||
qs = [NSString stringWithFormat: @"(c_object = '/%@') AND (c_uid = '%@')",
|
||||
@@ -264,7 +267,14 @@
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
|
||||
records = [[self ocsFolder] fetchAclMatchingQualifier: qualifier];
|
||||
|
||||
return [records valueForKey: @"c_role"];
|
||||
acls = [NSMutableArray array];
|
||||
if ([records count] > 0)
|
||||
{
|
||||
[acls addObject: SOGoRole_AuthorizedSubscriber];
|
||||
[acls addObjectsFromArray: [records valueForKey: @"c_role"]];
|
||||
}
|
||||
|
||||
return acls;
|
||||
}
|
||||
|
||||
- (void) removeAclsForUsers: (NSArray *) users
|
||||
@@ -302,12 +312,15 @@
|
||||
currentRole = [userRoles nextObject];
|
||||
while (currentRole)
|
||||
{
|
||||
SQL = [NSString stringWithFormat: @"INSERT INTO %@"
|
||||
@" (c_object, c_uid, c_role)"
|
||||
@" VALUES ('/%@', '%@', '%@')", [folder aclTableName],
|
||||
[objectPathArray componentsJoinedByString: @"/"],
|
||||
uid, currentRole];
|
||||
[channel evaluateExpressionX: SQL];
|
||||
if (![currentRole isEqualToString: SOGoRole_AuthorizedSubscriber])
|
||||
{
|
||||
SQL = [NSString stringWithFormat: @"INSERT INTO %@"
|
||||
@" (c_object, c_uid, c_role)"
|
||||
@" VALUES ('/%@', '%@', '%@')", [folder aclTableName],
|
||||
[objectPathArray componentsJoinedByString: @"/"],
|
||||
uid, currentRole];
|
||||
[channel evaluateExpressionX: SQL];
|
||||
}
|
||||
currentRole = [userRoles nextObject];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user