diff --git a/ChangeLog b/ChangeLog index b3a5259d7..7e3a8de5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-04-27 Wolfgang Sourdeau + * UI/Contacts/UIxContactsUserRightsEditor.m + ([UIxContactsUserRightsEditor + -setUserCanCreateObjects:userCanCreateObjects]): new subclass + module to handle acls related to the address books. Partial + implementation. + * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -setRoles:rolesforUser:uidforObjectAtPath:objectPathArray]): cache newly set roles. diff --git a/UI/Contacts/English.lproj/Localizable.strings b/UI/Contacts/English.lproj/Localizable.strings index d94efb274..4233453d5 100644 --- a/UI/Contacts/English.lproj/Localizable.strings +++ b/UI/Contacts/English.lproj/Localizable.strings @@ -2,6 +2,7 @@ "Addressbook" = "Addressbook"; "Addresses" = "Addresses"; +"Update" = "Update"; "Cancel" = "Cancel"; "Common" = "Common"; "Contact editor" = "Contact editor"; @@ -100,3 +101,14 @@ = "You cannot subscribe to a folder that you own!"; "Unable to subscribe to that folder!" = "Unable to subscribe to that folder!"; + +"User rights for:" = "User rights for:"; + +"This person can add cards to this addressbook." += "This person can add cards to this addressbook."; +"This person can edit the cards of this addressbook." += "This person can edit the cards of this addressbook."; +"This person can view the cards of this addressbook." += "This person can view the cards of this addressbook."; +"This person can erase cards from this addressbook." += "This person can erase cards from this addressbook."; diff --git a/UI/Contacts/French.lproj/Localizable.strings b/UI/Contacts/French.lproj/Localizable.strings index 940de3a53..46f665719 100644 --- a/UI/Contacts/French.lproj/Localizable.strings +++ b/UI/Contacts/French.lproj/Localizable.strings @@ -12,6 +12,7 @@ "Address Books" = "Carnet d'adresses"; "Addresses" = "Adresses"; +"Update" = "Mettre à jour"; "Cancel" = "Annuler"; "Common" = "Identité"; "Contact editor" = "Éditer le contact"; @@ -113,3 +114,14 @@ = "Vous ne pouvez pas vous inscrire à un dossier qui vous appartient!"; "Unable to subscribe to that folder!" = "Impossible de vous inscrire à ce dossier!"; + +"User rights for:" = "Autorisations pour :"; + +"This person can add cards to this addressbook." += "Cette personne peut ajouter des fiches à ce carnet d'adresses."; +"This person can edit the cards of this addressbook." += "Cette personne peut éditer des fiches de ce carnet d'adresses."; +"This person can view the cards of this addressbook." += "Cette personne peut visionner des fiches de ce carnet d'adresses."; +"This person can erase cards from this addressbook." += "Cette personne peut effacer des fiches de ce carnet d'adresses."; diff --git a/UI/Contacts/GNUmakefile b/UI/Contacts/GNUmakefile index ed831d329..6f7ae7e86 100644 --- a/UI/Contacts/GNUmakefile +++ b/UI/Contacts/GNUmakefile @@ -11,6 +11,7 @@ ContactsUI_LANGUAGES = English French ContactsUI_OBJC_FILES = \ UIxContactsUserFolders.m \ UIxContactsMailerSelection.m \ + UIxContactsUserRightsEditor.m \ \ ContactsUIProduct.m \ UIxContactsFilterPanel.m \ diff --git a/UI/Contacts/UIxContactsUserRightsEditor.h b/UI/Contacts/UIxContactsUserRightsEditor.h new file mode 100644 index 000000000..733bb5e46 --- /dev/null +++ b/UI/Contacts/UIxContactsUserRightsEditor.h @@ -0,0 +1,46 @@ +/* UIxContactsUserRightsEditor.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 UIXCONTACTSUSERRIGHTSEDITOR_H +#define UIXCONTACTSUSERRIGHTSEDITOR_H + +#import + +@interface UIxContactsUserRightsEditor : UIxUserRightsEditor + +- (void) setUserCanCreateObjects: (BOOL) userCanCreateObjects; +- (BOOL) userCanCreateObjects; + +- (void) setUserCanEraseObjects: (BOOL) userCanEraseObjects; +- (BOOL) userCanEraseObjects; + +- (void) setUserCanEditObjects: (BOOL) userCanEditObjects; +- (BOOL) userCanEditObjects; + +- (void) setUserCanViewObjects: (BOOL) userCanViewObjects; +- (BOOL) userCanViewObjects; + +- (void) updateRights; + +@end + +#endif /* UIXCONTACTSUSERRIGHTSEDITOR_H */ diff --git a/UI/Contacts/UIxContactsUserRightsEditor.m b/UI/Contacts/UIxContactsUserRightsEditor.m new file mode 100644 index 000000000..a6d43ee01 --- /dev/null +++ b/UI/Contacts/UIxContactsUserRightsEditor.m @@ -0,0 +1,111 @@ +/* UIxContactsUserRightsEditor.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 "UIxContactsUserRightsEditor.h" + +@implementation UIxContactsUserRightsEditor + +- (void) setUserCanCreateObjects: (BOOL) userCanCreateObjects +{ + if (userCanCreateObjects) + [self appendRight: SOGoRole_ObjectCreator]; + else + [self removeRight: SOGoRole_ObjectCreator]; +} + +- (BOOL) userCanCreateObjects +{ + return [userRights containsObject: SOGoRole_ObjectCreator]; +} + +- (void) setUserCanEraseObjects: (BOOL) userCanEraseObjects +{ + if (userCanEraseObjects) + [self appendRight: SOGoRole_ObjectEraser]; + else + [self removeRight: SOGoRole_ObjectEraser]; +} + +- (BOOL) userCanEraseObjects +{ + return [userRights containsObject: SOGoRole_ObjectEraser]; +} + +- (void) setUserCanEditObjects: (BOOL) userCanEditObjects +{ + if (userCanEditObjects) + [self appendRight: SOGoRole_ObjectEditor]; + else + [self removeRight: SOGoRole_ObjectEditor]; +} + +- (BOOL) userCanEditObjects +{ + return [userRights containsObject: SOGoRole_ObjectEditor]; +} + +- (void) setUserCanViewObjects: (BOOL) userCanViewObjects +{ + if (userCanViewObjects) + [self appendRight: SOGoRole_ObjectViewer]; + else + [self removeRight: SOGoRole_ObjectViewer]; +} + +- (BOOL) userCanViewObjects +{ + return [userRights containsObject: SOGoRole_ObjectViewer]; +} + +- (void) updateRights +{ + WORequest *request; + + request = [context request]; + + if ([[request formValueForKey: @"ObjectCreator"] length] > 0) + [self appendRight: SOGoRole_ObjectCreator]; + else + [self removeRight: SOGoRole_ObjectCreator]; + + if ([[request formValueForKey: @"ObjectEditor"] length] > 0) + [self appendRight: SOGoRole_ObjectEditor]; + else + [self removeRight: SOGoRole_ObjectEditor]; + + if ([[request formValueForKey: @"ObjectViewer"] length] > 0) + [self appendRight: SOGoRole_ObjectViewer]; + else + [self removeRight: SOGoRole_ObjectViewer]; + + if ([[request formValueForKey: @"ObjectEraser"] length] > 0) + [self appendRight: SOGoRole_ObjectEraser]; + else + [self removeRight: SOGoRole_ObjectEraser]; +} + +@end diff --git a/UI/Contacts/product.plist b/UI/Contacts/product.plist index 663ab8d97..b1c479482 100644 --- a/UI/Contacts/product.plist +++ b/UI/Contacts/product.plist @@ -76,7 +76,7 @@ pageName = "UIxContactsListView"; }; new = { - protectedBy = "View"; + protectedBy = "Add Documents, Images, and Files"; pageName = "UIxContactEditor"; actionName = "new"; }; @@ -86,10 +86,19 @@ actionName = "mailerContacts"; }; delete = { - protectedBy = "View"; + protectedBy = "SaveAcls"; /* a hack to force "owner" */ pageName = "UIxContactsListView"; actionName = "delete"; }; + userRights = { + protectedBy = "ReadAcls"; + pageName = "UIxContactsUserRightsEditor"; + }; + saveUserRights = { + protectedBy = "SaveAcls"; + pageName = "UIxContactsUserRightsEditor"; + actionName = "saveUserRights"; + }; }; }; @@ -126,20 +135,20 @@ SOGoContactGCSEntry = { methods = { view = { - protectedBy = "View"; + protectedBy = "Access Contents Information"; pageName = "UIxContactView"; }; delete = { - protectedBy = "View"; + protectedBy = "Delete Objects"; pageName = "UIxContactView"; actionName = "delete"; }; edit = { - protectedBy = "View"; + protectedBy = "Change Images And Files"; pageName = "UIxContactEditor"; }; save = { - protectedBy = "View"; + protectedBy = "Change Images And Files"; pageName = "UIxContactEditor"; actionName = "save"; }; @@ -148,11 +157,6 @@ pageName = "UIxContactEditor"; actionName = "write"; }; - vcard = { - protectedBy = "View"; - pageName = "UIxContactView"; - actionName = "vcard"; - }; }; }; @@ -181,11 +185,6 @@ pageName = "UIxContactEditor"; actionName = "write"; }; - vcard = { - protectedBy = "View"; - pageName = "UIxContactView"; - actionName = "vcard"; - }; }; }; }; diff --git a/UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox b/UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox new file mode 100644 index 000000000..e14ea785f --- /dev/null +++ b/UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox @@ -0,0 +1,47 @@ + + + +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+
diff --git a/UI/WebServerResources/UIxContactsUserRightsEditor.css b/UI/WebServerResources/UIxContactsUserRightsEditor.css new file mode 100644 index 000000000..783e47a64 --- /dev/null +++ b/UI/WebServerResources/UIxContactsUserRightsEditor.css @@ -0,0 +1,49 @@ +DIV.title +{ color: #000; + vertical-align: bottom; + padding-top: 15px; + padding-left: 1em; + height: 33px; + background-color: #fff; + border-bottom: 1px solid #555; } + +DIV.title SPAN.value +{ margin-left: 1em; + font-size: 18px; + font-weight: bold; } + +DIV.calendarUserRights +{ margin: 1em;} + +DIV.calendarUserRights > TABLE +{ background-color: #fff; + width: 45em; + color: #999; + border-collapse: collapse; + border-bottom: 1px solid #fff; + border-right: 1px solid #fff; + border-top: 2px solid #222; + border-left: 2px solid #222; + -moz-border-top-colors: ThreeDShadow ThreeDDarkShadow transparent; + -moz-border-left-colors: ThreeDShadow ThreeDDarkShadow transparent; } + +DIV.calendarUserRights > TABLE TR.permissions TH +{ color: #00f; +/* background-color: #ddd; + */ border-bottom: 1px solid #999; } + +DIV.calendarUserRights > TABLE TH +{ width: 15em; } + +DIV.calendarUserRights > TABLE TD.eventType +{ width: 5em; + text-align: right; + border-right: 1px solid #999; } + +DIV.calendarUserRights > TABLE TD +{ text-align: center; + border-top: 1px solid #cecbff; } + +DIV.buttons +{ text-align: right; + margin: 1em; } diff --git a/UI/WebServerResources/UIxContactsUserRightsEditor.js b/UI/WebServerResources/UIxContactsUserRightsEditor.js new file mode 100644 index 000000000..71fe311f7 --- /dev/null +++ b/UI/WebServerResources/UIxContactsUserRightsEditor.js @@ -0,0 +1,9 @@ +function onCancelClick(event) { + window.close(); +} + +function initACLButtons() { + $("cancelButton").addEventListener("click", onCancelClick, false); +} + +window.addEventListener("load", initACLButtons, false);