From b56702c30cd4e09a1063be7801f87b2921bee927 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 17 Apr 2007 14:02:07 +0000 Subject: [PATCH] Monotone-Parent: e2af315b632622df78228e2f3175bd974e1b5a8d Monotone-Revision: 661ae1fcba69b174478dbc3404b4d50caf90da97 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-04-17T14:02:07 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++ UI/Common/UIxObjectActions.h | 36 ++++++++++++++++++++ UI/Common/UIxObjectActions.m | 66 ++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 UI/Common/UIxObjectActions.h create mode 100644 UI/Common/UIxObjectActions.m diff --git a/ChangeLog b/ChangeLog index c5bdb43e5..45fc4bcf2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-04-17 Wolfgang Sourdeau + * UI/Common/UIxObjectActions.m: new module implementing the web + actions common to SOGoObject and all its subclasses. + ([UIxObjectActions -addUserInAclsAction]): new method that adds a + user with the clientObject defaults user rights to the object's + acl. + * UI/Common/UIxAclEditor.m: modified module so as to simplify it to the point where it will only list the users (and their name) associated with an object acl. diff --git a/UI/Common/UIxObjectActions.h b/UI/Common/UIxObjectActions.h new file mode 100644 index 000000000..30ed17422 --- /dev/null +++ b/UI/Common/UIxObjectActions.h @@ -0,0 +1,36 @@ +/* UIxObjectActions.h - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef UIXOBJECTACTIONS_H +#define UIXOBJECTACTIONS_H + +#import + +@class WOResponse; + +@interface UIxObjectActions : WODirectAction + +- (WOResponse *) addUserInAclsAction; + +@end + +#endif /* UIXOBJECTACTIONS_H */ diff --git a/UI/Common/UIxObjectActions.m b/UI/Common/UIxObjectActions.m new file mode 100644 index 000000000..143f677fe --- /dev/null +++ b/UI/Common/UIxObjectActions.m @@ -0,0 +1,66 @@ +/* UIxObjectActions.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import +#import +#import +#import +#import +#import +#import + +#import "UIxObjectActions.h" + +@implementation UIxObjectActions + +- (WOResponse *) addUserInAclsAction +{ + WOResponse *response; + WORequest *request; + NSString *uid, *email; + unsigned int code; + AgenorUserManager *um; + SOGoObject *clientObject; + + code = 403; + request = [context request]; + uid = [request formValueForKey: @"uid"]; + if ([uid length] > 0) + { + um = [AgenorUserManager sharedUserManager]; + email = [um getEmailForUID: uid]; + if ([email length] > 0) + { + clientObject = [self clientObject]; + [clientObject setRoles: [clientObject defaultAclRoles] + forUser: uid]; + code = 204; + } + } + + response = [context response]; + [response setStatus: code]; + + return response; +} + +@end