Revision 8f44fd3a trunk/Pithos.Interfaces/ObjectInfo.cs

b/trunk/Pithos.Interfaces/ObjectInfo.cs
328 328
                   && (this.Name == null || other.Name.StartsWith(this.Name));
329 329
        }
330 330

  
331
        public bool IsWritable(string account)
332
        {
333
            //If the Allowed To header has no value, try to determine the Share permissions
334
            if (AllowedTo == null)
335
            {
336
                //If this file has no permissions defined, we can probably write it
337
                //This case should occur only when the info comes from a listing of the user's own files
338
                if (Permissions == null || Permissions.Count == 0)
339
                    return true;
340
                string perms;
341

  
342
                //Do we have an explicit write share to this account?
343
                return Permissions.TryGetValue(account, out perms) 
344
                    && perms.Equals("write",StringComparison.InvariantCultureIgnoreCase);
345
                
346
            }
347
            //Otherwise return the permissions specified by AllowedTo
348
            return AllowedTo.Equals("write",StringComparison.InvariantCultureIgnoreCase) ;
349
        }
331 350

  
332 351
        public ObjectInfo Previous { get; private set; }
333 352

  
......
335 354
        {
336 355
            get
337 356
            {
357
                if (Content_Type == null)
358
                    return false;
338 359
                if (Content_Type.StartsWith(@"application/directory",StringComparison.InvariantCultureIgnoreCase))
339 360
                    return true;
340 361
                if (Content_Type.StartsWith(@"application/folder",StringComparison.InvariantCultureIgnoreCase))

Also available in: Unified diff