Skip to content
v2.7

Permissions

Who can read, create, update and delete.

Every resource has a list of permissions. A permission combines an action (read, create, update, delete) and a role (who). Without a permission, no one can access it from the app; with an API key, the server can access everything the key’s scope allows.

Role Who it is Example
any Anyone, signed in or not Role.any()
users Any signed-in user Role.users()
user A specific user Role.user("6650a1")
team Members of a team (or of a role in the team) Role.team("suporte", "admin")
guests Only people who are not signed in Role.guests()

Table permissions apply to every row. With row-level security turned on, each row can have its own, added to the table’s.

criar-pedido.ts
import { Permission, Role, ID } from "@owbase/web";
await db.createRow({
databaseId: "loja-principal",
tableId: "pedidos",
rowId: ID.unique(),
data: { total: 189.9, status: "aberto" },
permissions: [
Permission.read(Role.user(usuario.$id)),
Permission.update(Role.user(usuario.$id)),
Permission.read(Role.team("suporte"))
]
});
Was this page helpful?