mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-15 19:55:56 +00:00
Monotone-Parent: 25a776bd6b15aa10f240bacd8adc2804905b3aa3
Monotone-Revision: 120bebe836052f03cd990ffe1cf7418954873186 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-07-04T20:15:42 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
2007-07-04 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoUser.m ([SOGoUser +initialize]): read the
|
||||
SOGoSuperUsername user defaults.
|
||||
([SOGoUser -initWithLogin:newLoginroles:newRoles]): simplified
|
||||
method.
|
||||
([SOGoUser -rolesForObject:objectinContext:context]): if the
|
||||
current user is the superuser, grant him/her the "owner" role.
|
||||
|
||||
* SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -ocsFolder]): create
|
||||
the folder only if the current user is the owner of the future
|
||||
folder.
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
static NSTimeZone *serverTimeZone = nil;
|
||||
static NSString *fallbackIMAP4Server = nil;
|
||||
static NSString *defaultLanguage = nil;
|
||||
static NSString *superUsername = nil;
|
||||
static NSURL *AgenorProfileURL = nil;
|
||||
static BOOL acceptAnyUser = NO;
|
||||
|
||||
@@ -57,7 +58,7 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
NSString *tzName;
|
||||
NSString *tzName, *nsUsername;
|
||||
NSUserDefaults *ud;
|
||||
NSString *profileURL;
|
||||
|
||||
@@ -84,6 +85,12 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||
if (!defaultLanguage)
|
||||
ASSIGN (defaultLanguage, @"English");
|
||||
}
|
||||
if (!superUsername)
|
||||
{
|
||||
nsUsername = [ud stringForKey: @"SOGoSuperUsername"];
|
||||
if ([nsUsername length] > 0)
|
||||
ASSIGN (superUsername, nsUsername);
|
||||
}
|
||||
|
||||
acceptAnyUser = (![ud stringForKey: @"AuthentificationMethod"]);
|
||||
}
|
||||
@@ -120,21 +127,17 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||
LDAPUserManager *um;
|
||||
NSString *realUID;
|
||||
|
||||
if ([newLogin isEqualToString: @"anonymous"]
|
||||
if (acceptAnyUser
|
||||
|| [newLogin isEqualToString: @"anonymous"]
|
||||
|| [newLogin isEqualToString: @"freebusy"])
|
||||
self = [super initWithLogin: newLogin roles: newRoles];
|
||||
realUID = newLogin;
|
||||
else
|
||||
{
|
||||
if (acceptAnyUser)
|
||||
realUID = newLogin;
|
||||
else
|
||||
{
|
||||
um = [LDAPUserManager sharedUserManager];
|
||||
realUID = [[um contactInfosForUserWithUIDorEmail: newLogin]
|
||||
objectForKey: @"c_uid"];
|
||||
}
|
||||
self = [super initWithLogin: realUID roles: newRoles];
|
||||
um = [LDAPUserManager sharedUserManager];
|
||||
realUID = [[um contactInfosForUserWithUIDorEmail: newLogin]
|
||||
objectForKey: @"c_uid"];
|
||||
}
|
||||
self = [super initWithLogin: realUID roles: newRoles];
|
||||
|
||||
return self;
|
||||
}
|
||||
@@ -289,9 +292,10 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||
- (NSUserDefaults *) userDefaults
|
||||
{
|
||||
if (!userDefaults)
|
||||
userDefaults = [[AgenorUserDefaults alloc] initWithTableURL: AgenorProfileURL
|
||||
uid: login
|
||||
fieldName: @"defaults"];
|
||||
userDefaults
|
||||
= [[AgenorUserDefaults alloc] initWithTableURL: AgenorProfileURL
|
||||
uid: login
|
||||
fieldName: @"defaults"];
|
||||
|
||||
return userDefaults;
|
||||
}
|
||||
@@ -299,9 +303,10 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||
- (NSUserDefaults *) userSettings
|
||||
{
|
||||
if (!userSettings)
|
||||
userSettings = [[AgenorUserDefaults alloc] initWithTableURL: AgenorProfileURL
|
||||
uid: login
|
||||
fieldName: @"settings"];
|
||||
userSettings
|
||||
= [[AgenorUserDefaults alloc] initWithTableURL: AgenorProfileURL
|
||||
uid: login
|
||||
fieldName: @"settings"];
|
||||
|
||||
return userSettings;
|
||||
}
|
||||
@@ -356,8 +361,9 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||
if (folder != nil)
|
||||
return [folder isNotNull] ? folder : nil;
|
||||
|
||||
folder = [[WOApplication application] lookupName:[self login]
|
||||
inContext:_ctx acquire:NO];
|
||||
folder = [[WOApplication application] lookupName: [self login]
|
||||
inContext: _ctx
|
||||
acquire: NO];
|
||||
if ([folder isKindOfClass:[NSException class]])
|
||||
return folder;
|
||||
|
||||
@@ -403,7 +409,8 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||
if (sogoRoles)
|
||||
[rolesForObject addObjectsFromArray: sogoRoles];
|
||||
|
||||
if ([[object ownerInContext: context] isEqualToString: [self login]])
|
||||
if ((superUsername && [login isEqualToString: superUsername])
|
||||
|| [[object ownerInContext: context] isEqualToString: login])
|
||||
[rolesForObject addObject: SoRole_Owner];
|
||||
if ([object isKindOfClass: [SOGoObject class]])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user