]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1026 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 16 Feb 2007 23:24:16 +0000 (23:24 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 16 Feb 2007 23:24:16 +0000 (23:24 +0000)
21 files changed:
ChangeLog
OGoContentStore/sql/generate-folderinfo-sql-for-users.sh
SoObjects/Appointments/SOGoAppointmentFolder.m
SoObjects/Appointments/SOGoAppointmentObject.m
SoObjects/Appointments/SOGoCalendarComponent.m
SoObjects/Appointments/product.plist
SoObjects/Contacts/product.plist
SoObjects/Mailer/SOGoMailObject.m
SoObjects/SOGo/SOGoContentObject.m
SoObjects/SOGo/SOGoFolder.h
SoObjects/SOGo/SOGoFolder.m
SoObjects/SOGo/SOGoObject.m
SoObjects/SOGo/SOGoUser.m
UI/Contacts/product.plist
UI/MailerUI/UIxMailReplyAction.m
UI/MainUI/product.plist
UI/Scheduler/English.lproj/Localizable.strings
UI/Scheduler/French.lproj/Localizable.strings
UI/Scheduler/UIxAppointmentEditor.m
UI/Scheduler/UIxComponentEditor.m
UI/WebServerResources/SchedulerUI.js

index 832b7b0601bd51ed4f9159705659c59c5af99b38..5f811c70f91b83fbf384c2e7690e591cf8ca2df1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-02-16  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * SoObjects/SOGo/SOGoUser.m ([SOGoUser
+       -rolesForObject:objectinContext:context]): test for
+       "rolesOfUser:inContext:" in addition to "roleOfUser:...".
+
+       * SoObjects/Appointments/SOGoCalendarComponent.m
+       ([SOGoCalendarComponent -rolesOfUser:logininContext:context]):
+       returns the roles of the user on the container object if the event
+       is uncreated.
+
 2007-02-15  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
        * UI/MailPartViewers/UIxMailRenderingContext.m: returns the
index 2cff4355bd919e91fa5859a99ae78d0ea9f438fe..ed2e01833ec83a786c0d903e918e61d5185d1274 100755 (executable)
@@ -5,7 +5,7 @@
 
 DB_USER="sogo"
 DB_PASS="sogo"
-DB_HOST="127.0.0.1"
+DB_HOST="192.168.0.4"
 DB_PORT="5432"
 DB_NAME="sogo"
 TIMEZONE="Canada/Eastern"
index 9d4ceb742e5cbd9a5d27dec15e6a7b5be7f2331c..6772e5e940d9b9cee3e7430a3ee2a4f9af086c42 100644 (file)
@@ -834,11 +834,8 @@ static NSNumber   *sharedYes = nil;
         = [self objectClassForResourceNamed: currentId];
       deleteObject = [objectClass objectWithName: currentId
                                   inContainer: self];
-      if ([currentUser isEqualToString: [deleteObject ownerInContext: nil]])
-        {
-          [deleteObject delete];
-          [deleteObject primaryDelete];
-        }
+      [deleteObject delete];
+      [deleteObject primaryDelete];
     }
 }
 
index b2b8e1f97adf2f5f33ac97e96dd0535b04d929e5..e2ce7232c4956e9d588adec83afd0471d9049b23 100644 (file)
 }
 
 @end /* SOGoAppointmentObject */
-
-
-
index 6ebce383b029d9f9c2a8b8c6ccd1a870a898757b..c5e6e31118720e64334ab9ec35790098673a16ca 100644 (file)
@@ -31,6 +31,7 @@
 
 #import <SOGo/AgenorUserManager.h>
 #import <SOGo/SOGoPermissions.h>
+#import <SOGo/SOGoUser.h>
 
 #import "common.h"
 
@@ -294,27 +295,40 @@ static BOOL sendEMailNotifications = NO;
     }
 }
 
-- (NSString *) roleOfUser: (NSString *) login
+- (NSArray *) rolesOfUser: (NSString *) login
                 inContext: (WOContext *) context
 {
   AgenorUserManager *um;
   iCalRepeatableEntityObject *component;
-  NSString *role, *email;
+  NSMutableArray *sogoRoles;
+  NSString *email;
+  SOGoUser *user;
+
+  sogoRoles = [NSMutableArray new];
+  [sogoRoles autorelease];
 
   um = [AgenorUserManager sharedUserManager];
   email = [um getEmailForUID: login];
 
   component = [self component];
-  if ([component isOrganizer: email])
-    role = SOGoRole_Organizer;
-  else if ([component isParticipant: email])
-    role = SOGoRole_Participant;
-  else if ([[[self container] ownerInContext: nil] isEqualToString: login])
-    role = SoRole_Owner;
+  if (component)
+    {
+      if ([component isOrganizer: email])
+        [sogoRoles addObject: SOGoRole_Organizer];
+      else if ([component isParticipant: email])
+        [sogoRoles addObject: SOGoRole_Participant];
+      else if ([[container ownerInContext: nil] isEqualToString: login])
+        [sogoRoles addObject: SoRole_Owner];
+    }
   else
-    role = nil;
+    {
+      user = [[SOGoUser alloc] initWithLogin: login roles: nil];
+      [sogoRoles addObjectsFromArray: [user rolesForObject: container
+                                            inContext: context]];
+      [user release];
+    }
 
-  return role;
+  return sogoRoles;
 }
 
 @end
index a648d70a41c0827824777ba55f452bd5321f4a1b..3213aac518dbfddca0dcc600b8e734dacffa78cc 100644 (file)
@@ -14,6 +14,7 @@
         "View" = ( "Owner", "Delegate", "Assistant" );
         "FreeBusyLookup" = ( "Owner", "Delegate", "Assistant", "FreeBusy" );
         "Add Documents, Images, and Files" = ( "Owner", "Delegate" );
+        "Access Contents Information" = ( "Owner", "Delegate", "Assistant" );
       };
     };
 
@@ -26,6 +27,7 @@
       defaultRoles = {
         "View" = ( "Owner", "Delegate", "Organizer", "Authenticated" );
         "Change Images and Files" = ( "Owner", "Delegate", "Organizer" );
+        "Access Contents Information" = ( "Owner", "Delegate", "Assistant" );
       };
     };
     SOGoTaskObject = {
@@ -33,6 +35,7 @@
       defaultRoles = {
         "View" = ( "Owner", "Delegate", "Organizer", "Authenticated" );
         "Change Images and Files" = ( "Owner", "Delegate", "Organizer" );
+        "Access Contents Information" = ( "Owner", "Delegate", "Assistant" );
       };
     };
     SOGoFreeBusyObject = {
index 4ff7a9372c19c616c83c11037768d77ed28c7cb0..9c7b5f82b75e7152d8750ace750c349a1d78cc3e 100644 (file)
 
     SOGoContactGCSFolder = {
       superclass    = "SOGoFolder";
+      defaultRoles = {
+        "PUT" = ( "Owner", "Delegate" );
+        "Add Documents, Images, and Files" = ( "Owner", "Delegate" );
+      };
     };
 
     SOGoContactGCSEntry = {
       superclass    = "SOGoContentObject";
       defaultRoles = {
         "View" = ( "Owner", "Delegate", "Organizer", "Authenticated" );
+        "PUT" = ( "Owner", "Delegate" );
+        "Add Documents, Images, and Files" = ( "Owner", "Delegate" );
       };
     };
 
index 10d848cf1067079d3c7f75ba487a6bc32c532969..749882e168842f4b78d0bd0d4f840d95e9e075e9 100644 (file)
@@ -417,23 +417,13 @@ static BOOL debugSoParts       = NO;
   _type    = [_type    lowercaseString];
   _subtype = [_subtype lowercaseString];
   
-  if ([_type isEqualToString:@"text"]) {
-    if ([_subtype isEqualToString:@"plain"]
-        || [_subtype isEqualToString:@"html"])
-      return YES;
-
-    if ([_subtype isEqualToString:@"calendar"]) /* we also fetch calendars */
-      return YES;
-  }
-
-  if ([_type isEqualToString:@"application"]) {
-    if ([_subtype isEqualToString:@"pgp-signature"])
-      return YES;
-    if ([_subtype hasPrefix:@"x-vnd.kolab."])
-      return YES;
-  }
-  
-  return NO;
+  return (([_type isEqualToString:@"text"]
+           && ([_subtype isEqualToString:@"plain"]
+               || [_subtype isEqualToString:@"html"]
+               || [_subtype isEqualToString:@"calendar"]))
+          || ([_type isEqualToString:@"application"]
+              && ([_subtype isEqualToString:@"pgp-signature"]
+                  || [_subtype hasPrefix:@"x-vnd.kolab."])));
 }
 
 - (void)addRequiredKeysOfStructure:(id)_info path:(NSString *)_p
@@ -825,7 +815,7 @@ static BOOL debugSoParts       = NO;
     In case b) or c) fails, we can't do anything because IMAP4 doesn't tell us
     the ID used in the trash folder.
   */
-  SOGoMailFolder *destFolder;
+  SOGoMailAccounts *destFolder;
   NSEnumerator *folders;
   NSString *currentFolderName, *reason;
   NSException    *error;
index 724f191404f20baa7dca79fbb779d10dccefbe8e..3c7cc1a16b0442a29c495c3b11dedd8ae8a3dbb1 100644 (file)
   02111-1307, USA.
 */
 
-#include "SOGoContentObject.h"
-#include "SOGoFolder.h"
-#include "common.h"
-#include <GDLContentStore/GCSFolder.h>
+#import <GDLContentStore/GCSFolder.h>
+
+#import <SOGo/SOGoUser.h>
+
+#import "common.h"
+#import "SOGoFolder.h"
+#import "SOGoContentObject.h"
 
 @interface SOGoContentObject(ETag)
 - (NSArray *)parseETagList:(NSString *)_c;
   return [_ctx response];
 }
 
+/* security */
+- (NSArray *) rolesOfUser: (NSString *) login
+                inContext: (WOContext *) context
+{
+  NSMutableArray *sogoRoles;
+  SOGoUser *user;
+
+  sogoRoles = [NSMutableArray new];
+  [sogoRoles autorelease];
+
+  if (![container nameExistsInFolder: nameInContainer])
+    {
+      user = [[SOGoUser alloc] initWithLogin: login roles: nil];
+      [sogoRoles addObjectsFromArray: [user rolesForObject: container
+                                            inContext: context]];
+      [user release];
+    }
+
+  return sogoRoles;
+}
+
 /* E-Tags */
 
 - (id)davEntityTag {
index 50c9f8e42352911907edbd477fbf0e36b83b26b9..e768cd22d39702f751028112a8a92b728e394d70 100644 (file)
@@ -55,6 +55,8 @@
 - (GCSFolder *)ocsFolder;
 
 /* lower level fetches */
+- (BOOL) nameExistsInFolder: (NSString *) objectName;
+
 - (NSArray *)fetchContentObjectNames;
 - (NSDictionary *)fetchContentStringsAndNamesOfAllObjects;
 
index 27eabccae0e6cd5ee5f731e1522cc2ff8d4b9a9c..d7fe67b6ff3d024f80abf843aedce229b735b302 100644 (file)
   return [records valueForKey:@"c_name"];
 }
 
+- (BOOL) nameExistsInFolder: (NSString *) objectName
+{
+  NSArray *fields, *records;
+  EOQualifier *qualifier;
+
+  qualifier
+    = [EOQualifier qualifierWithQualifierFormat:
+                     [NSString stringWithFormat: @"c_name='%@'", objectName]];
+
+  fields = [NSArray arrayWithObject: @"c_name"];
+  records = [[self ocsFolder] fetchFields: fields
+                              matchingQualifier: qualifier];
+  return (records
+          && ![records isKindOfClass:[NSException class]]
+          && [records count] > 0);
+}
+
 - (NSDictionary *)fetchContentStringsAndNamesOfAllObjects {
   NSDictionary *files;
   
index cf8f8843a75d02bad312b7673ab577a43f6c7774..a548e523f360bcf33bf590d6acebc45c3d22795a 100644 (file)
@@ -24,6 +24,7 @@
 #import <NGObjWeb/WOResponse.h>
 #import <NGObjWeb/WOApplication.h>
 #import <NGCards/NSDictionary+NGCards.h>
+
 #import "common.h"
 
 #import "NSArray+Utilities.h"
index 4292e7b91317490cebcec16976fd758ea1fdb5ef..0c7a3947fbb9d55551cde1be46b7829454e5e88b 100644 (file)
@@ -30,6 +30,8 @@
 
 - (NSString *) roleOfUser: (NSString *) uid
                 inContext: (WOContext *) context;
+- (NSArray *) rolesOfUser: (NSString *) uid
+                inContext: (WOContext *) context;
 
 @end
 
       aclsFolder = [SOGoAclsFolder aclsFolder];
       sogoRoles = [aclsFolder aclsForObject: (SOGoObject *) object
                               forUser: login];
-      [rolesForObject addObjectsFromArray: sogoRoles];
+      if (sogoRoles)
+        [rolesForObject addObjectsFromArray: sogoRoles];
+    }
+  if ([object respondsToSelector: @selector (rolesOfUser:inContext:)])
+    {
+      sogoRoles = [object rolesOfUser: login inContext: context];
+      if (sogoRoles)
+        [rolesForObject addObjectsFromArray: sogoRoles];
     }
   if ([object respondsToSelector: @selector (roleOfUser:inContext:)])
     {
index a3424d7ba40b810bbf37c30f68bc9c576a0236ff..ce080e9e9dde4be83d6c68e211c620565be5e172 100644 (file)
               pageName    = "UIxContactsListView";
               actionName = "addressBooksContacts";
            };
+           PUT = {
+              protectedBy = "PUT";
+              actionName = "PUT";
+           };
         };
      };
 
               pageName    = "UIxContactView";
               actionName  = "vcard";
            };
+           PUT = {
+              protectedBy = "PUT";
+           };
         };
      };
 
index cb00981f3ef3220fc2dddf8ff7f4e5d609e5c947..40f0abf0fc7d5f7562a6d14e7dad5e8e86c969bf 100644 (file)
   02111-1307, USA.
 */
 
-#include "UIxMailEditorAction.h"
+#import "UIxMailEditorAction.h"
 
 @interface UIxMailReplyAction : UIxMailEditorAction
 @end
 
-#include <SoObjects/Mailer/SOGoMailObject.h>
-#include <SoObjects/Mailer/SOGoDraftObject.h>
-#include <NGImap4/NGImap4EnvelopeAddress.h>
-#include <NGImap4/NGImap4Envelope.h>
-#include "common.h"
+#import <SoObjects/Mailer/SOGoMailObject.h>
+#import <SoObjects/Mailer/SOGoDraftObject.h>
+#import <NGImap4/NGImap4EnvelopeAddress.h>
+#import <NGImap4/NGImap4Envelope.h>
+#import "common.h"
 
 @implementation UIxMailReplyAction
 
   }
 }
 
-- (NSString *)contentForReplyOnParts:(NSDictionary *)_prts keys:(NSArray *)_k {
+- (NSString *) contentForReplyOnParts: (NSDictionary *) _prts
+                                 keys: (NSArray *) _k
+{
   static NSString *textPartSeparator = @"\n---\n";
   NSMutableString *ms;
   unsigned i, count;
   
   ms = [NSMutableString stringWithCapacity:16000];
-  
   for (i = 0, count = [_k count]; i < count; i++) {
     NSString *k, *v;
     
     k = [_k objectAtIndex:i];
-    
+   
     // TODO: this is DUP code to SOGoMailObject
     if ([k isEqualToString:@"body[text]"])
       k = @"";
 }
 
 - (NSString *)contentForReply {
-  NSArray      *keys;
-  NSDictionary *parts;
-  
-  keys = [[self clientObject] plainTextContentFetchKeys];
+  NSArray      *keys, *partInfos;
+  NSDictionary *parts, *infos;
+  SOGoMailObject *co;
+
+  co = [self clientObject];
+  keys = [co plainTextContentFetchKeys];
+  infos = [co fetchCoreInfos];
+  partInfos = [infos objectForKey: keys];
+  NSLog (@"infos: '%@'", infos);
+
   if ([keys count] == 0)
     return nil;
   
index ec730eb813bb607d9cd3da56127db3a2b3c96252..1a32d592b7a0965e2cd74a791a4a992c49ac255d 100644 (file)
@@ -33,8 +33,9 @@
         "View"          = ( "Owner", "Delegate", "Assistant" );
         "WebDAV Access" = ( "Owner", "Delegate", "Assistant" );
         "Access Contents Information" = ( "Owner", "Assistant", "Delegate" );
-        "ReadAcls" = ( "Owner", "Delegate", "Assistant" );
+        "ReadAcls" = ( "Owner", "Assistant", "Delegate" );
         "SaveAcls" = ( "Owner" );
+        "Delete Objects" = ( "Owner", "Delegate" );
       };
     };
     SOGoGroupsFolder = {
     };
     SOGoRootPage = {
     };
+    SOGoFolder = {
+      methods = {
+        PUT = {
+          protectedBy = "Add Documents, Images, and Files";
+        };
+      };
+    };
     SOGoUserFolder = {
       methods = {
         view = { 
index d9170d8abb1d5db67054d12a8093ba70023005a7..b0c3c256d8d5ebe545d20671e93946d5e73eb9b7 100644 (file)
@@ -303,3 +303,4 @@ validate_endbeforestart    = "Enddate is before startdate!";
 "Next hour" = "Next hour";
 
 "closeThisWindowMessage" = "Thank you! You may now close this window.";
+"Multicolumn Day View" = "Multicolumn Day View";
index 348dcb48995ff75b55a8c334c9067cde49fa27e0..43aef1b27b7e0e99d8b0052633f97db01e3c90dc 100644 (file)
@@ -319,3 +319,4 @@ validate_endbeforestart    = "La date de fin est avant la date de dĂ©but !";
 "Next hour" = "Heure suivante";
 
 "closeThisWindowMessage" = "Merci! Vous pouvez maintenant fermer cette fenĂȘtre.";
+"Multicolumn Day View" = "Multicolonne";
index 5c2d39c72de757a49824a40209b891d3aac3197e..da2fda63830d28eaf67220c5356d32251da67204 100644 (file)
   [stamp setTimeZone: utc];
 
   s          = [self iCalParticipantsAndResourcesStringFromQueryParameters];
-  template   = [NSString stringWithFormat:iCalStringTemplate,
+  template   = [NSString stringWithFormat: iCalStringTemplate,
                          [[self clientObject] nameInContainer],
                          [stamp iCalFormattedDateTimeString],
                          [lStartDate iCalFormattedDateTimeString],
index e23e664a819b78383ae0a8aa5ee4c49e22f7e234..41eb62bc2e13941a2323dce57ff68db3ecf96460 100644 (file)
   return iCalString;
 }
 
-
 - (NSArray *) availableCalendars
 {
   NSEnumerator *rawContacts;
index 6aa1bfb3f8209199933ec90ebbae651ec246109b..d0f858b230d76dd99dae83f2c1e6e5922c846a2b 100644 (file)
@@ -23,7 +23,8 @@ function newEvent(sender, type) {
     day = currentDay;
 
   var user = UserLogin;
-  if (currentView == "multicolumndayview" && type == "event")
+  if (sender.parentNode.getAttribute("id") != "toolbar"
+      && currentView == "multicolumndayview" && type == "event")
      user = sender.parentNode.parentNode.getAttribute("user");
 
   var hour = sender.getAttribute("hour");
@@ -1072,10 +1073,12 @@ function addContact(tag, fullContactName, contactId, contactName, contactEmail)
 
 function onChangeCalendar(list) {
    var form = document.forms.editform;
+   log ("before: " + form.getAttribute("action"));
    var urlElems = form.getAttribute("action").split("/");
    urlElems[urlElems.length-4]
       = list.childNodesWithTag("option")[list.value].innerHTML;
    form.setAttribute("action", urlElems.join("/"));
+   log ("after: " + form.getAttribute("action"));
 }
 
 function validateBrowseURL(input) {