From: helge Date: Tue, 12 Jul 2005 09:20:10 +0000 (+0000) Subject: added SOGoUser object X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b824758ec47932eb10a755903d11cb554586a41;p=scalable-opengroupware.org added SOGoUser object git-svn-id: http://svn.opengroupware.org/SOGo/trunk@713 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/Main/ChangeLog b/SOGo/Main/ChangeLog index e11f6fd3..4c5e846f 100644 --- a/SOGo/Main/ChangeLog +++ b/SOGo/Main/ChangeLog @@ -1,3 +1,13 @@ +2005-07-12 Helge Hess + + * v0.9.30 + + * SOGoAuthenticator.m: create SOGoUser objects + + * added 'SOGoUser' object/class as a subclass of SoUser, using this + object various Agenor properties like cn or email can be determined + (will use the AgenorUserManager to retrieve such) + 2005-07-08 Marcus Mueller * README: updated for new default 'SOGoAllowsUnrestrictedAccess' diff --git a/SOGo/Main/GNUmakefile b/SOGo/Main/GNUmakefile index 9a8d7e92..e2134055 100644 --- a/SOGo/Main/GNUmakefile +++ b/SOGo/Main/GNUmakefile @@ -18,6 +18,7 @@ $(SOGOD)_OBJC_FILES += \ SOGo.m \ SOGoProductLoader.m \ SOGoAuthenticator.m \ + SOGoUser.m \ # product diff --git a/SOGo/Main/SOGoAuthenticator.h b/SOGo/Main/SOGoAuthenticator.h index 31e7afcb..f49e7c56 100644 --- a/SOGo/Main/SOGoAuthenticator.h +++ b/SOGo/Main/SOGoAuthenticator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #ifndef __Main_SOGoAuthenticator_H__ #define __Main_SOGoAuthenticator_H__ diff --git a/SOGo/Main/SOGoAuthenticator.m b/SOGo/Main/SOGoAuthenticator.m index e40cec1a..bb1b7a2a 100644 --- a/SOGo/Main/SOGoAuthenticator.m +++ b/SOGo/Main/SOGoAuthenticator.m @@ -20,6 +20,7 @@ */ #include "SOGoAuthenticator.h" +#include "SOGoUser.h" #include "common.h" @implementation SOGoAuthenticator @@ -42,4 +43,27 @@ static SOGoAuthenticator *auth = nil; // THREAD return YES; } +/* create SOGoUser */ + +- (SoUser *)userInContext:(WOContext *)_ctx { + static SoUser *anonymous = nil; + NSString *login; + NSArray *uroles; + + if (anonymous == nil) { + NSArray *ar = [NSArray arrayWithObject:SoRole_Anonymous]; + anonymous = [[SOGoUser alloc] initWithLogin:@"anonymous" roles:ar]; + } + + if ((login = [self checkCredentialsInContext:_ctx]) == nil) + /* some error (otherwise result would have been anonymous */ + return nil; + + if ([login isEqualToString:@"anonymous"]) + return anonymous; + + uroles = [self rolesForLogin:login]; + return [[[SOGoUser alloc] initWithLogin:login roles:uroles] autorelease]; +} + @end /* SOGoAuthenticator */ diff --git a/SOGo/Main/SOGoUser.h b/SOGo/Main/SOGoUser.h new file mode 100644 index 00000000..743ff54b --- /dev/null +++ b/SOGo/Main/SOGoUser.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#ifndef __SOGoUser_H__ +#define __SOGoUser_H__ + +#include + +/* + SOGoUser + + This adds some additional SOGo properties to the SoUser object. The + properties are (currently) looked up using the AgenorUserManager. +*/ + +@class NSString, NSURL; + +@interface SOGoUser : SoUser +{ + NSString *cn; + NSString *email; +} + +/* properties */ + +- (NSString *)email; +- (NSString *)cn; +- (NSString *)primaryIMAP4AccountString; +- (NSString *)primaryMailServer; +- (NSArray *)additionalIMAP4AccountStrings; +- (NSArray *)additionalEMailAddresses; +- (NSURL *)freeBusyURL; + +@end + +#endif /* __SOGoUser_H__ */ diff --git a/SOGo/Main/SOGoUser.m b/SOGo/Main/SOGoUser.m new file mode 100644 index 00000000..cc131098 --- /dev/null +++ b/SOGo/Main/SOGoUser.m @@ -0,0 +1,74 @@ +/* + Copyright (C) 2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include "SOGoUser.h" +#include +#include "common.h" + +@implementation SOGoUser + +- (void)dealloc { + [self->cn release]; + [self->email release]; + [super dealloc]; +} + +/* internals */ + +- (AgenorUserManager *)userManager { + static AgenorUserManager *um = nil; + if (um == nil) um = [[AgenorUserManager sharedUserManager] retain]; + return um; +} + +/* properties */ + +- (NSString *)email { + if (self->email == nil) + self->email = [[[self userManager] getEmailForUID:[self login]] copy]; + return self->email; +} + +- (NSString *)cn { + if (self->cn == nil) + self->cn = [[[self userManager] getCNForUID:[self login]] copy]; + return self->cn; +} + +- (NSString *)primaryIMAP4AccountString { + return [[self userManager] getIMAPAccountStringForUID:[self login]]; +} +- (NSString *)primaryMailServer { + return [[self userManager] getServerForUID:[self login]]; +} + +- (NSArray *)additionalIMAP4AccountStrings { + return [[self userManager]getSharedMailboxAccountStringsForUID:[self login]]; +} +- (NSArray *)additionalEMailAddresses { + return [[self userManager] getSharedMailboxEMailsForUID:[self login]]; +} + +- (NSURL *)freeBusyURL { + return [[self userManager] getFreeBusyURLForUID:[self login]]; +} + +@end /* SOGoUser */ diff --git a/SOGo/Main/Version b/SOGo/Main/Version index c7e764ff..ce7ecb1f 100644 --- a/SOGo/Main/Version +++ b/SOGo/Main/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=29 +SUBMINOR_VERSION:=30 # v0.9.24 requires libWEExtensions v4.5.67 # v0.9.16 requires libNGExtensions v4.5.136 diff --git a/SOGo/UI/Templates/UIxPageFrame.wox b/SOGo/UI/Templates/UIxPageFrame.wox index 26270767..4c6f9f99 100644 --- a/SOGo/UI/Templates/UIxPageFrame.wox +++ b/SOGo/UI/Templates/UIxPageFrame.wox @@ -174,7 +174,7 @@ - 2000-2004 SKYRIX Software AG. We welcome your