WBHarry / pf2e-bestiary-tracking

A Foundry VTT Module to let players keep track monster information and statistics for the PF2E system
MIT License
5 stars 4 forks source link

[Bug] Unable to edit notes due to missing Permission error #152

Open Ribuska opened 4 days ago

Ribuska commented 4 days ago

Players cannot edit some of the notes in the NPC Gallery's Character Sheet due to lack of Permission to edit the Journal entry, but the Permission is there. (Only Characters in NPC Gallery are affected.) Strangely only some of the Characters are affected and even deleting and creating NPC cannot fix the issue. Also, some of the existing Character Sheets can become uneditable, with no sign or tell how.

Here's the only error in the console:

User Fishy lacks permission to update JournalEntryPage [Hdom7aLxCdHbTfor] in parent JournalEntry [OTxHX0jwjvBoTMLS]
Error: User Рыбуська lacks permission to update JournalEntryPage [Hdom7aLxCdHbTfor] in parent JournalEntry [OTxHX0jwjvBoTMLS]
    at /C:/My%20big%20shit/foundryvtt/Foundry%20Virtual%20Tabletop/resources/app/dist/database/backend/server-backend.mjs:1:5101
    at async Promise.all (index 0)
    at async ServerDatabaseBackend._updateDocuments (/C:/My%20big%20shit/foundryvtt/Foundry%20Virtual%20Tabletop/resources/app/dist/database/backend/server-backend.mjs:1:4748)
    at async Semaphore._try (/C:/My%20big%20shit/foundryvtt/Foundry%20Virtual%20Tabletop/resources/app/common/utils/semaphore.mjs:101:17)

Foundry v12.331 PF2E v6.7.0 PF2E BTv1.1.27

WBHarry commented 4 days ago

Hm, interesting. Think you can export and send over the Bestiary that has the permission fails so I can easily find the error? 🤖 image

Ribuska commented 3 days ago

So, our world has two bestiaries. Here's both of them. bestiariy-isekaya.json This is the problematic one. Sorry, the text is in russian, but the code is there. There are some modules, but they shouldn't affect Journals at all.

And here's the second one, just in case. bestiariy-reshal.json

WBHarry commented 17 hours ago

Hm. Well, if you are getting permission issues, then the modules hidden data journal -must- not have permissions set for the players. The module does set this up, so the only thing I could hazard a guess at is that some other module or macro you've been using has sweepingly changed journals.


You can try copying and pasting this little bit of code in the console and see if it fixes it. It will set all players to the needed permissions on all Bestiary data journals. 🤖

game.journal.filter(x => x.pages.some(x => [
    "pf2e-bestiary-tracking.creature",
    "pf2e-bestiary-tracking.npc",
    "pf2e-bestiary-tracking.hazard",
  ].includes(x.type))).forEach(journal => journal.update({ "ownership": { default: 3 } }))