This repository explores how to build a access control system on top of SurrealDB using TypeScript. We will build a nodejs backend command line application that uses the SurrealDB Javascript/Typescript SDK to connect to a local SurrealDB instance. We will authenticate with various users and display a list of 'product' entries from a test database.
We will use DEFINE ACCESS
statements to define roles based authentication. One of our test users should be able to fully access (create, read, update, delete) the 'product' entries the other one should not have access to the table and thus should not be able to retrieve a list of products.
First we add the SDK to our project npm install --save surrealdb
.