retorquere / zotero-sync

https://retorque.re/zotero-sync/
GNU Affero General Public License v3.0
33 stars 3 forks source link

Invalid group library account access check for 'all' response #16

Closed frthjf closed 8 months ago

frthjf commented 8 months ago

Hi!

Thanks for the great plugin!

I believe there is an issue with the account access check logic here when the API key allows access to all libraries.

image

In that case, the request returns a response like this:

{
    "user": {
        "library": true,
        "files": true,
        "notes": true
    },
    "groups": {
        "all": {
            "library": true,
            "write": false
        }
    }
}

Thus, the condition if (account.access.groups[library.id]) will always be false. A potential fix would be to change the condition to account.access.groups[library.id] || account.access.groups['all']). I'm happy to prepare a PR if useful.

Thanks!

retorquere commented 8 months ago

Yep, a PR would be appreciated!