Privileges
Centia.io has a simple privilege system, which enables the super-user to grant sub-users read or write privileges to tables. Sub-users can grant privileges to tables in their own schemas.
Set privileges for a user on a table
Implicit a sub-user has none
privileges to any table, besides tables in own schema. The privilege on any table can explicitly be set to either none
, read
or write
for a sub-user.
none
the sub-user can't run any types of statements on the table.read
the sub-user can runselect
statements on the table.write
the sub-user can runselect
,insert
,update
anddelete
statements on the table.
- HTTP
- CLI
Setting a single privilege
PATCH https://api.centia.io/api/v4/schemas/myschema/mytable/privileges HTTP/1.1
Content-Type: application/json
Authorization: Bearer abc123
{
"subuser": "joe",
"privilege": "write"
}
Setting multiple privileges
PATCH https://api.centia.io/api/v4/schemas/myschema/mytable/privileges HTTP/1.1
Content-Type: application/json
Authorization: Bearer abc123
{
"privileges": [
{
"subuser": "joe",
"privilege": "write"
},
{
"subuser": "peter",
"privilege": "write"
}
]
}
cen privilege set "myschema" "mytable" "joe" "write"
Get privileges
- HTTP
- CLI
Request
GET https://api.centia.io/api/v4/schemas/myschema/mytable/privileges HTTP/1.1
Accept: application/json; charset=utf-8
Authorization: Bearer abc123
Response
{
"privileges": [
{
"subuser": "joe",
"privilege": "write"
},
{
"subuser": "peter",
"privilege": "write"
}
]
}
cen privilege set "myschema" "mytable"