mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-27 00:52:45 +00:00
Monotone-Parent: e2159d82254439aa0954efbb3e1730d45a41c2d6
Monotone-Revision: 7d01af187554df2b24caa2526dd92eea0e8454ee Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-04-17T14:30:12 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,5 +1,18 @@
|
||||
2007-04-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoFolder.m ([SOGoFolder
|
||||
-aclsForObjectAtPath:objectPathArray]): new method generic to GCS
|
||||
based folders. This method is derived from the code that was in
|
||||
UIxAclFolder before its removal.
|
||||
([SOGoFolder -aclsForUser:uidforObjectAtPath:objectPathArray]):
|
||||
idem.
|
||||
([SOGoFolder
|
||||
-removeAclsForUsers:usersforObjectAtPath:objectPathArray]): idem.
|
||||
([SOGoFolder
|
||||
-setRoles:rolesforUser:uidforObjectAtPath:objectPathArray]): idem.
|
||||
([SOGoFolder -setRoleForUsers:uidsto:role])
|
||||
([SOGoFolder -setRoleForUsers:uidsto:role]): removed method.
|
||||
|
||||
* SoObjects/SOGo/SOGoObject.m ([SOGoObject -acls]): stub method
|
||||
that requires overriding by subclasses.
|
||||
([SOGoObject -aclsForUser:uid]): idem.
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
@class NSString, NSArray, NSDictionary;
|
||||
@class GCSFolder;
|
||||
@class SOGoAclsFolder;
|
||||
|
||||
/*
|
||||
SOGoFolder
|
||||
@@ -67,6 +66,16 @@
|
||||
- (BOOL) create;
|
||||
- (NSException *) delete;
|
||||
|
||||
/* acls as a container */
|
||||
- (NSArray *) aclsForObjectAtPath: (NSArray *) objectPathArray;
|
||||
- (NSArray *) aclsForUser: (NSString *) uid
|
||||
forObjectAtPath: (NSArray *) objectPathArray;
|
||||
- (void) setRoles: (NSString *) roles
|
||||
forUser: (NSString *) uid
|
||||
forObjectAtPath: (NSArray *) objectPathArray;
|
||||
- (void) removeAclsForUsers: (NSArray *) users
|
||||
forObjectAtPath: (NSArray *) objectPathArray;
|
||||
|
||||
@end
|
||||
|
||||
@interface SOGoFolder (GroupDAVExtensions)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#import <NGObjWeb/SoObject.h>
|
||||
#import <GDLAccess/EOAdaptorChannel.h>
|
||||
#import <GDLContentStore/GCSFolderManager.h>
|
||||
#import <GDLContentStore/GCSFolder.h>
|
||||
#import <GDLContentStore/GCSFolderType.h>
|
||||
@@ -29,8 +30,6 @@
|
||||
#import <unistd.h>
|
||||
#import <stdlib.h>
|
||||
|
||||
#import "SOGoAclsFolder.h"
|
||||
|
||||
@implementation SOGoFolder
|
||||
|
||||
+ (int)version {
|
||||
@@ -239,6 +238,106 @@
|
||||
return names;
|
||||
}
|
||||
|
||||
/* acls as a container */
|
||||
|
||||
- (NSArray *) aclsForObjectAtPath: (NSArray *) objectPathArray;
|
||||
{
|
||||
EOQualifier *qualifier;
|
||||
NSString *qs;
|
||||
|
||||
qs = [NSString stringWithFormat: @"c_object = '/%@'",
|
||||
[objectPathArray componentsJoinedByString: @"/"]];
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
|
||||
|
||||
return [[self ocsFolder] fetchAclMatchingQualifier: qualifier];
|
||||
}
|
||||
|
||||
- (NSArray *) aclsForUser: (NSString *) uid
|
||||
forObjectAtPath: (NSArray *) objectPathArray
|
||||
{
|
||||
EOQualifier *qualifier;
|
||||
NSArray *records;
|
||||
NSString *qs;
|
||||
|
||||
qs = [NSString stringWithFormat: @"(c_object = '/%@') AND (c_uid = '%@')",
|
||||
[objectPathArray componentsJoinedByString: @"/"], uid];
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
|
||||
records = [[self ocsFolder] fetchAclMatchingQualifier: qualifier];
|
||||
|
||||
return [records valueForKey: @"c_role"];
|
||||
}
|
||||
|
||||
- (void) removeAclsForUsers: (NSArray *) users
|
||||
forObjectAtPath: (NSArray *) objectPathArray
|
||||
{
|
||||
EOQualifier *qualifier;
|
||||
NSString *uids, *qs;
|
||||
|
||||
if ([users count] > 0)
|
||||
{
|
||||
uids = [users componentsJoinedByString: @"') OR (c_uid = '"];
|
||||
qs = [NSString
|
||||
stringWithFormat: @"(c_object = '/%@') AND ((c_uid = '%@'))",
|
||||
[objectPathArray componentsJoinedByString: @"/"], uids];
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
|
||||
[[self ocsFolder] deleteAclMatchingQualifier: qualifier];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setRoles: (NSString *) roles
|
||||
forUser: (NSString *) uid
|
||||
forObjectAtPath: (NSArray *) objectPathArray
|
||||
{
|
||||
EOAdaptorChannel *channel;
|
||||
GCSFolder *folder;
|
||||
NSString *SQL;
|
||||
|
||||
[self removeAclsForUsers: [NSArray arrayWithObject: uid]
|
||||
forObjectAtPath: objectPathArray];
|
||||
folder = [self ocsFolder];
|
||||
channel = [folder acquireAclChannel];
|
||||
SQL = [NSString stringWithFormat: @"INSERT INTO %@"
|
||||
@" (c_object, c_uid, c_role)"
|
||||
@" VALUES ('/%@', '%@', '%@')", [folder aclTableName],
|
||||
[objectPathArray componentsJoinedByString: @"/"],
|
||||
uid, roles];
|
||||
[channel evaluateExpressionX: SQL];
|
||||
|
||||
[folder releaseChannel: channel];
|
||||
}
|
||||
|
||||
/* acls */
|
||||
- (NSString *) defaultAclRoles
|
||||
{
|
||||
#warning this should be changed to something useful
|
||||
return @"tourist";
|
||||
}
|
||||
|
||||
- (NSArray *) acls
|
||||
{
|
||||
return [self aclsForObjectAtPath: [self pathArrayToSoObject]];
|
||||
}
|
||||
|
||||
- (NSArray *) aclsForUser: (NSString *) uid
|
||||
{
|
||||
return [self aclsForUser: uid
|
||||
forObjectAtPath: [self pathArrayToSoObject]];
|
||||
}
|
||||
|
||||
- (void) setRoles: (NSString *) roles
|
||||
forUser: (NSString *) uid
|
||||
{
|
||||
return [self setRoles: roles
|
||||
forUser: uid
|
||||
forObjectAtPath: [self pathArrayToSoObject]];
|
||||
}
|
||||
|
||||
- (void) removeAclsForUsers: (NSArray *) users
|
||||
{
|
||||
return [self removeAclsForUsers: users
|
||||
forObjectAtPath: [self pathArrayToSoObject]];
|
||||
}
|
||||
|
||||
/* WebDAV */
|
||||
|
||||
- (BOOL)davIsCollection {
|
||||
|
||||
Reference in New Issue
Block a user