mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-06 04:20:33 +00:00
Monotone-Parent: 2b7da1953bd3d0e1018f3b8e76d30617561de8ef
Monotone-Revision: f9371ddfd88be3a6ce7eea9043b11d375984c77d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-05-17T23:09:46 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
2007-05-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoFolder.m ([SOGoFolder
|
||||
-setRoles:rolesforUser:uidforObjectAtPath:objectPathArray]):
|
||||
ignore the "AuthorizedSubscriber" role and add the "None" role
|
||||
when no other role is found.
|
||||
|
||||
* UI/Common/UIxAclEditor.m: added a button for the new default
|
||||
user roles feature.
|
||||
|
||||
|
||||
+35
-22
@@ -31,8 +31,6 @@
|
||||
#import <unistd.h>
|
||||
#import <stdlib.h>
|
||||
|
||||
static NSString *defaultUser = @"<default>";
|
||||
|
||||
@implementation SOGoFolder
|
||||
|
||||
+ (int) version
|
||||
@@ -341,8 +339,9 @@ static NSString *defaultUser = @"<default>";
|
||||
[self _cacheRoles: acls forUser: uid forObjectAtPath: objectPath];
|
||||
}
|
||||
|
||||
if (!([acls count] || [uid isEqualToString: defaultUser]))
|
||||
acls = [self aclsForUser: defaultUser forObjectAtPath: objectPathArray];
|
||||
if (!([acls count] || [uid isEqualToString: SOGoDefaultUserID]))
|
||||
acls = [self aclsForUser: SOGoDefaultUserID
|
||||
forObjectAtPath: objectPathArray];
|
||||
|
||||
return acls;
|
||||
}
|
||||
@@ -369,19 +368,14 @@ static NSString *defaultUser = @"<default>";
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setRoles: (NSArray *) roles
|
||||
forUser: (NSString *) uid
|
||||
forObjectAtPath: (NSArray *) objectPathArray
|
||||
- (void) _commitRoles: (NSArray *) roles
|
||||
forUID: (NSString *) uid
|
||||
forObject: (NSString *) objectPath
|
||||
{
|
||||
EOAdaptorChannel *channel;
|
||||
GCSFolder *folder;
|
||||
NSEnumerator *userRoles;
|
||||
NSString *SQL, *currentRole, *objectPath;
|
||||
|
||||
[self removeAclsForUsers: [NSArray arrayWithObject: uid]
|
||||
forObjectAtPath: objectPathArray];
|
||||
objectPath = [objectPathArray componentsJoinedByString: @"/"];
|
||||
[self _cacheRoles: roles forUser: uid forObjectAtPath: objectPath];
|
||||
NSString *SQL, *currentRole;
|
||||
|
||||
folder = [self ocsFolder];
|
||||
channel = [folder acquireAclChannel];
|
||||
@@ -389,21 +383,40 @@ static NSString *defaultUser = @"<default>";
|
||||
currentRole = [userRoles nextObject];
|
||||
while (currentRole)
|
||||
{
|
||||
if (![currentRole isEqualToString: SOGoRole_AuthorizedSubscriber])
|
||||
{
|
||||
SQL = [NSString stringWithFormat: @"INSERT INTO %@"
|
||||
@" (c_object, c_uid, c_role)"
|
||||
@" VALUES ('/%@', '%@', '%@')",
|
||||
[folder aclTableName],
|
||||
objectPath, uid, currentRole];
|
||||
[channel evaluateExpressionX: SQL];
|
||||
}
|
||||
SQL = [NSString stringWithFormat: @"INSERT INTO %@"
|
||||
@" (c_object, c_uid, c_role)"
|
||||
@" VALUES ('/%@', '%@', '%@')",
|
||||
[folder aclTableName],
|
||||
objectPath, uid, currentRole];
|
||||
[channel evaluateExpressionX: SQL];
|
||||
currentRole = [userRoles nextObject];
|
||||
}
|
||||
|
||||
[folder releaseChannel: channel];
|
||||
}
|
||||
|
||||
- (void) setRoles: (NSArray *) roles
|
||||
forUser: (NSString *) uid
|
||||
forObjectAtPath: (NSArray *) objectPathArray
|
||||
{
|
||||
NSString *objectPath;
|
||||
NSMutableArray *newRoles;
|
||||
|
||||
[self removeAclsForUsers: [NSArray arrayWithObject: uid]
|
||||
forObjectAtPath: objectPathArray];
|
||||
|
||||
newRoles = [NSMutableArray arrayWithArray: roles];
|
||||
[newRoles removeObject: SOGoRole_AuthorizedSubscriber];
|
||||
[newRoles removeObject: SOGoRole_None];
|
||||
objectPath = [objectPathArray componentsJoinedByString: @"/"];
|
||||
[self _cacheRoles: newRoles forUser: uid
|
||||
forObjectAtPath: objectPath];
|
||||
if (![newRoles count])
|
||||
[newRoles addObject: SOGoRole_None];
|
||||
|
||||
[self _commitRoles: newRoles forUID: uid forObject: objectPath];
|
||||
}
|
||||
|
||||
/* acls */
|
||||
- (NSArray *) defaultAclRoles
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user