IHP Api Reference
Safe HaskellNone

IHP.DataSync.RowLevelSecurity

Synopsis

Documentation

withRLS :: forall userId result. (ToField userId, userId ~ Id CurrentUserRecord, Show (PrimaryKey (GetTableName CurrentUserRecord)), HasNewSessionUrl CurrentUserRecord, Typeable CurrentUserRecord, ?context :: ControllerContext, HasField "id" CurrentUserRecord (Id' (GetTableName CurrentUserRecord)), ?modelContext :: ModelContext) => ((?modelContext :: ModelContext) => IO result) -> IO result Source #

ensureRLSEnabled :: (?modelContext :: ModelContext) => Text -> IO TableWithRLS Source #

Returns a proof that RLS is enabled for a table

hasRLSEnabled :: (?modelContext :: ModelContext) => Text -> IO Bool Source #

Returns True if row level security has been enabled on a table

RLS can be enabled with this SQL statement:

ALTER TABLE my_table ENABLE ROW LEVEL SECURITY;

After this hasRLSEnabled will return true:

>>> hasRLSEnabled "my_table"
True

data TableWithRLS Source #

Can be constructed using ensureRLSEnabled

tableWithRLS <- ensureRLSEnabled "my_table"

Useful to carry a proof that the RLS is actually enabled