Moralis User CLP

Hi there,

I wanted to be able to only allow the authenticated user to write/read/addfield on his own row within the database and not everyone. Could you show me how to achieve this? Read the docs but didn’t find much help on that there.

1 Like

Hi,

An example of how you can do it from code, I had a table named “Coin”:

coin = Moralis.Object.extend("Coin");
bxb_coin = new coin({name: 'BXB'})
user = Moralis.User.current()
bxb_coin.setACL(new Moralis.ACL(user))
x = await bxb_coin.save()

You will need to set ACL.

You can also learn more from this tutorial: https://www.youtube.com/watch?v=Yd4gFQ5ppmQ&ab_channel=MoralisWeb3

1 Like