return [contactFolders allValues];
}
-- (NSString *) roleOfUser: (NSString *) uid
-{
- NSArray *roles, *traversalPath;
- NSString *objectName, *role;
-
- role = nil;
- traversalPath = [context objectForKey: @"SoRequestTraversalPath"];
- if ([traversalPath count] > 2)
- {
- objectName = [traversalPath objectAtIndex: 2];
- roles = [[context activeUser]
- rolesForObject: [self lookupName: objectName
- inContext: context
- acquire: NO]
- inContext: context];
- if ([roles containsObject: SOGoRole_Assistant]
- || [roles containsObject: SOGoRole_Delegate])
- role = SOGoRole_Assistant;
- }
-
- return role;
-}
+// - (NSString *) roleOfUser: (NSString *) uid
+// {
+// NSArray *roles, *traversalPath;
+// NSString *objectName, *role;
+
+// role = nil;
+// traversalPath = [context objectForKey: @"SoRequestTraversalPath"];
+// if ([traversalPath count] > 2)
+// {
+// objectName = [traversalPath objectAtIndex: 2];
+// roles = [[context activeUser]
+// rolesForObject: [self lookupName: objectName
+// inContext: context
+// acquire: NO]
+// inContext: context];
+// if ([roles containsObject: SOGoRole_Assistant]
+// || [roles containsObject: SOGoRole_Delegate])
+// role = SOGoRole_Assistant;
+// }
+
+// return role;
+// }
- (BOOL) davIsCollection
{
classes = {
SOGoContactFolders = {
- superclass = "SOGoObject";
+ superclass = "SOGoFolder";
+ protectedBy = "<public>";
+ defaultAccess = "allow";
defaultRoles = {
- "Add Documents, Images, and Files" = ( "Owner", "Delegate" );
- "View" = ( "Owner", "Delegate", "Assistant" );
- "WebDAV Access" = ( "Owner", "Delegate", "Assistant" );
- "Access Contents Information" = ( "Owner", "Assistant", "Delegate" );
- "ReadAcls" = ( "Owner", "Delegate", "Assistant" );
- "SaveAcls" = ( "Owner" );
+ "View" = ( "Owner" );
};
};
/* listing the available mailboxes */
-- (BOOL)isInHomeFolderBranchOfLoggedInAccount:(id)_ctx {
- id user;
-
- user = [_ctx activeUser];
- return [[[self container] nameInContainer] isEqualToString:[user login]];
+- (BOOL) isInHomeFolderBranchOfLoggedInAccount: (NSString *) userLogin
+{
+ return [[[self container] nameInContainer] isEqualToString: userLogin];
}
- (NSArray *)toManyRelationshipKeys {
- id user;
+ SOGoUser *user;
id account;
NSArray *shares;
+ NSString *userLogin;
/*
Note: this is not strictly correct. The accounts being retrieved should be
=> TODO
*/
user = [context activeUser];
+ userLogin = [user login];
/* for now: return nothing if the home-folder does not belong to the login */
- if (![self isInHomeFolderBranchOfLoggedInAccount: context]) {
+ if (![self isInHomeFolderBranchOfLoggedInAccount: userLogin]) {
[self warnWithFormat:@"User %@ tried to access mail hierarchy of %@",
[user login], [[self container] nameInContainer]];
return nil;
}
- account = [user valueForKey:@"primaryIMAP4AccountString"];
+ account = [user primaryIMAP4AccountString];
if ([account isNotNull]) account = [NSArray arrayWithObject:account];
if ([self isInternetRequest]) /* only show primary mailbox in Internet */
return [ct autorelease];
}
-- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
+- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag
+{
id obj;
+ NSString *userLogin;
+
+ userLogin = [[context activeUser] login];
/* first check attributes directly bound to the application */
if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]))
return obj;
- if (![self isInHomeFolderBranchOfLoggedInAccount:_ctx]) {
+ if (![self isInHomeFolderBranchOfLoggedInAccount: userLogin]) {
[self warnWithFormat:@"User %@ tried to access mail hierarchy of %@",
- [[_ctx activeUser] login], [[self container] nameInContainer]];
+ userLogin, [[self container] nameInContainer]];
return [NSException exceptionWithHTTPStatus:403 /* Forbidden */
reason:@"Tried to access the mail of another user"];
if (sogoRoles)
[rolesForObject addObjectsFromArray: sogoRoles];
}
- if ([object respondsToSelector: @selector (rolesOfUser:inContext:)])
+ if ([object respondsToSelector: @selector (rolesOfUser:)])
{
sogoRoles = [object rolesOfUser: login];
if (sogoRoles)
[rolesForObject addObjectsFromArray: sogoRoles];
}
- if ([object respondsToSelector: @selector (roleOfUser:inContext:)])
+ if ([object respondsToSelector: @selector (roleOfUser:)])
{
role = [object roleOfUser: login];
if (role)
superclass = "SOGoFolder";
protectedBy = "<public>";
defaultAccess = "allow";
+ defaultRoles = {
+ "View" = ( "Owner" );
+ };
/* protectedBy = "HomePage Access"; */
};
SOGoFolder = {
SOGoRootPage = {
};
SOGoUserFolder = {
+ methods = {
+ view = {
+ protectedBy = "View";
+ pageName = "SOGoUserHomePage";
+ };
+ };
};
SOGoGroupsFolder = {
methods = {