2 Copyright (C) 2002-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 @implementation SoUser
27 - (id)initWithLogin:(NSString *)_login roles:(NSArray *)_roles {
32 if ((self = [super init])) {
33 self->login = [_login copy];
34 self->roles = [_roles copy];
39 return [self initWithLogin:nil roles:nil];
43 [self->login release];
44 [self->roles release];
56 - (NSArray *)rolesInContext:(id)_ctx {
60 - (NSArray *)rolesForObject:(id)_object inContext:(id)_ctx {
61 NSArray *aroles, *localRoles;
63 aroles = [self rolesInContext:_ctx];
64 if (aroles == nil) aroles = [NSArray array];
67 TODO: collect all local roles (of the object and its parents, local
68 roles are stored in __ac_local_roles__ of the object in Zope. Note
69 that this attribute can be a callable returning the roles !
78 - (id)valueForUndefinedKey:(NSString *)_key {
84 - (NSString *)description {
87 ms = [NSMutableString stringWithCapacity:16];
88 [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
89 [ms appendFormat:@" login=%@", self->login];
90 [ms appendFormat:@" roles=%@", [self->roles componentsJoinedByString:@","]];
91 [ms appendString:@">"];