diff --git a/chrome/content/zotero/xpcom/data/libraries.js b/chrome/content/zotero/xpcom/data/libraries.js index e631f85bd..9150ddaf7 100644 --- a/chrome/content/zotero/xpcom/data/libraries.js +++ b/chrome/content/zotero/xpcom/data/libraries.js @@ -78,6 +78,9 @@ Zotero.Libraries = new function () { this.isEditable = function (libraryID) { var type = this.getType(libraryID); switch (type) { + case 'user': + return true; + case 'group': var groupID = Zotero.Groups.getGroupIDFromLibraryID(libraryID); var group = Zotero.Groups.get(groupID); @@ -87,4 +90,25 @@ Zotero.Libraries = new function () { throw ("Unsupported library type '" + type + "' in Zotero.Libraries.getName()"); } } + + + this.isFilesEditable = function (libraryID) { + if (!this.isEditable(libraryID)) { + return false; + } + + var type = this.getType(libraryID); + switch (type) { + case 'user': + return true; + + case 'group': + var groupID = Zotero.Groups.getGroupIDFromLibraryID(libraryID); + var group = Zotero.Groups.get(groupID); + return group.filesEditable; + + default: + throw ("Unsupported library type '" + type + "' in Zotero.Libraries.getName()"); + } + } } diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js index aff118801..a1771b6c1 100644 --- a/chrome/content/zotero/xpcom/storage.js +++ b/chrome/content/zotero/xpcom/storage.js @@ -263,9 +263,14 @@ Zotero.Sync.Storage = new function () { } // Get files to upload - for each(var itemID in _getFilesToUpload(libraryID)) { - var item = Zotero.Items.get(itemID); - self.queueItem(item); + if (Zotero.Libraries.isFilesEditable(libraryID)) { + for each(var itemID in _getFilesToUpload(libraryID)) { + var item = Zotero.Items.get(itemID); + self.queueItem(item); + } + } + else { + Zotero.debug("No file editing access -- skipping file uploads for library " + libraryID); } }