Forum BigDB Database Access from Client Side.

Discussion and help relating to the PlayerIO database solution, BigDB.

Database Access from Client Side.

Postby aseemgarg321 » May 15th, 2017, 9:37 am

Hi,

Currently if we want to access Database from Client Side, We have following "Access Rights" Options to be set for a particular connection.

1) CanLoadByKeys
2) CanLoadByIndexes
3) CanCreate
4) CanSave
5) CanDelete
6) Full Creator Rights


Also, I can see for PlayerObject, documentation talks about the fact that particular player can read/write only his/her data..

PlayerObjects
The absolutely most common use-case for BigDB is to store data on a per-player basis, and making sure that one player cannot read or modify the data of another player.



Now i have two Questions..

1) In PlayerObject database, I tried from Server side code and I can read or modify the data of another player. So, now If we assume the above statement is made for client side code then I don't see any Settings in Connections page where I can set PlayerObject to "Read/Write only its own data"..

2) Is it possible to introduce a new "Access Rights" Options (client side) called as "Read Only Own Data" and "Write Only Own Data".. Which can be used with PlayerObjects as well as other tables...

I understand, this might be too much of work at your end, but the reason I am asking for this is that this can give increased security at client side, and can avoid connecting to SERVICEROOM at all (or reduce dependency in many cases), which I am currently planning to use only for data fetching/Writing..

Thanks,
Aseem
aseemgarg321
 
Posts: 104
Joined: March 28th, 2015, 9:54 am

Re: Database Access from Client Side.

Postby Henrik » May 16th, 2017, 5:05 am

Hey Aseem,

1) Serverside code has full access to everything, it runs in a privileged connection, which is why client access rights don't apply.

2) I am pretty sure that "Full Creator Rights" is what you want, that should allow each user to load objects by key only if they created that object in the first place, and the same goes for saving that object back. And I'm pretty sure that this is the default access right for the PlayerObjects table for that reason.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Database Access from Client Side.

Postby aseemgarg321 » May 16th, 2017, 5:35 am

Oh ok..

I never realised "Full Creator Rights", could mean that.. Thanks for the info..

But what I was trying to implement is -

Server has "Access Right" of Create/save/update entries in table.
And Client can have just load "Access rights"..

Can this be worked out with the combination of "Full Creator Rights" and other options.

Its must be like - Row created/updated at Server by same person, should be read by Same person ONLY at client side.

I will also try this combination from my end, But if you can confirm how it works, will save quite a testing time for me.

Thanks,
Aseem
aseemgarg321
 
Posts: 104
Joined: March 28th, 2015, 9:54 am

Re: Database Access from Client Side.

Postby Henrik » May 16th, 2017, 6:28 am

Objects created serverside won't have a creator since your code is running in the context of a room, not a single user. I think the PlayerObjects table has an exception to this so that each user gets set as a creator of their own PlayerObject if it's created serverside, but that's it.

For any other tables, make sure to create the objects client-side first. Since you probably need the object client-side, do a LoadOrCreate as soon as you can, before connecting to the multiplayer room.

https://playerio.com/documentation/refe ... adOrCreate
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Database Access from Client Side.

Postby aseemgarg321 » May 16th, 2017, 6:55 am

Hi,

So what I understand is If I have a setting like this -

Image

http://imgur.com/a/Chraq

This should allow me to -

1) Create a row Client side in table as soon as my app starts..
2) Load this row anytime from same user at client side.
3) Client WONT BE able to update or delete this row ever..
4) Server can Update or delete this row anytime..

Does this make sense? or I am misunderstanding it.

Thanks,
Aseem
aseemgarg321
 
Posts: 104
Joined: March 28th, 2015, 9:54 am

Re: Database Access from Client Side.

Postby Henrik » May 16th, 2017, 7:54 am

"Full Creator Rights" means that any user can create new objects in the table, and then load, save, and delete those objects client-side, since that user is now the creator of those objects and has full rights. Adding "Create" is redundant in this case, because it's implied by "Full Creator Rights".
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Database Access from Client Side.

Postby aseemgarg321 » May 16th, 2017, 8:04 am

Oh k..

Got it..


In that case, if we can have an option to create tables, where server can Create/Update/Delete player level Data and Client can have JUST read Access for that player level Data.. It will be great..

This can be good to have feature. For now, I will stick to data Creation/Updation/Deletion/Read from SERVICE-ROOM..

Thanks,
Aseem
aseemgarg321
 
Posts: 104
Joined: March 28th, 2015, 9:54 am


Return to BigDB