earlSt1 / vtt-compendium-folders

Collapsable folders in the compendium directory and folder structures inside compendiums for FoundryVTT
21 stars 18 forks source link

Permission error for player if GM drops actor on Scene from a compendium with Compendium Folders #85

Closed KayelGee closed 2 years ago

KayelGee commented 3 years ago

I'm using baileywikis "Baileywiki Maps Town Prefabs" as an example: Inside the compendium there is a folder structure like this "Baileywiki Maps Town Prefabs/Class 2 Buildings TOWN/Town C2 Fletcher". "Town C2 Fletcher" being the name of the actor here. When I drop this "Town C2 Fletcher" onto a scene the actor will be created in the actor directory in the same folder structure.

When a player(read non GM) is connected at the same time there will be an exception thrown in the players console:

 Uncaught (in promise) Error: User Player 2 lacks permission to update Actor [rrihMVEk89JJex7q]
 Uncaught (in promise) Error: User Player 2 lacks permission to create a new Folder
 Uncaught (in promise) Error: User Player 2 lacks permission to update Actor [iPlGxKqjqHGcnHnW]

This probably happens because you are not checking in your hook if the user is the same user that dropped the actor on the canvas. Multiple GMs might also cause problems, but I have not tested that.

earlSt1 commented 3 years ago

Ahh ok i see, it's strange that the createActor hook is called for a user that didn't create the actor. I'll need to do some testing on my local machine. Thanks for raising this :)

KayelGee commented 3 years ago

I think most hooks are called on every client except pre hooks

earlSt1 commented 3 years ago

This probably happens because you are not checking in your hook if the user is the same user that dropped the actor on the canvas.

Yep, you're exactly right, can you try again using this test version? I'm not getting errors any more: https://raw.githubusercontent.com/earlSt1/vtt-compendium-folders/082-update/test/module.json

KayelGee commented 3 years ago

This probably happens because you are not checking in your hook if the user is the same user that dropped the actor on the canvas.

Yep, you're exactly right, can you try again using this test version? I'm not getting errors any more: https://raw.githubusercontent.com/earlSt1/vtt-compendium-folders/082-update/test/module.json

Error is gone with the test version

earlSt1 commented 2 years ago

Fixed in v2.3.3