PDA

View Full Version : Sharing read-only data with users



phantomwhale
April 3rd, 2011, 14:12
I'm trying to fix up some bugs with Allies in Savage Worlds. In Savage Worlds, you can have NPCs (personalities, as they are called on the GUI) and these can be shared with the players.

They can also have their shortcuts dragged onto a character sheet list (called Allies), which gives the players a link to open up the NPC sheet, and view the NPC detail.

The bug I am facing is if a non-shared NPC is put on that list; the player will not be a "holder" of the NPC database nodes, and therefore attempts to open the NPC off the Ally list result in console errors. After trying some clever solutions that all don't quite work, my thoughts on a fix here are simply when a user logs in, add him as a holder to the NPC database node, and remove him when he logs out for cleanness.

But my question is really around a side-effect of this bug, which is on attempting to open the NPC via the shortcut link when the user has NO "holder" access to the data, it seems the user still manages to open the sheet, but all the NPC's attributes (dice fields) have been set to d4 (which is default for a blank field). What I am surprised by is that this changes the attributes on the server database as well ?!

I wasn't aware the client application sessions could alter the server database with being an owner (e.g. a holder, with the owner="true" flag), yet here without even being the holder, the player is able to change these attribute dice fields. Even when the NPCs are correctly shared, and open without error, I also note the players cannot modify the text or number fields on the shared sheet... but can still modify the dice fields - these modifications being replicated on the server ?!

Am I misunderstanding how the database update security model works ? Or is this a known "bug" at all ? This, it seems, will cause me problems even if I can manage to ensure all users have holder permissions to their character(s) allies, as I still don't want them able to adjust the allies core attributes !

Thanks,
Ben (-PW-)

Moon Wizard
April 3rd, 2011, 19:02
I'll have to take a look into it.

The assumed model is that the client should not be able to adjust any database fields unless they are the owner. If it is happening, then it's a bug.

Thanks for the heads up,
JPG

Moon Wizard
April 3rd, 2011, 19:58
It looks like there are specific checks in place for strings and numbers, but not for any other controls. I just added a fix it to the top of the to do list for v2.8.

The way it should work is that fields attached to read only database nodes should not be editable on the client, AND any edits that end up being made to fields that are not owned by the user should not affect the host database.

Affected data types: die, token, windowreference, formattedtext

Thanks again,
JPG

phantomwhale
April 4th, 2011, 09:07
Awesome, will keep an eye out for that, and glare crossly (via the internet) at my players meanwhile if they keep bumping up their allies Vigor...

Have fixed the bug I was chasing meanwhile (as described, just giving holder access to the NPC list to all User's who log in).

phantomwhale
April 13th, 2011, 13:03
Quick note on "read only" diefields / diecontrols:

Currently just noticed that diecontrols have a "Clear dice" option as the 4th menu item. This should obviously be removed for read-only diecontrols.

Have produced some patched diefields using templates for now, which override the onWheel, onDrop and reset functions.