Skip to content

Commit 495b8a8

Browse files
committed
Extend the cookbook example
1 parent b3a2a01 commit 495b8a8

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@ Let's assume we have a schema `appschema`, and `appuser` should have
1717
`SELECT`, `UPDATE`, `DELETE` and `INSERT` permissions on all tables and
1818
views in that schema:
1919

20-
INSERT INTO public.permission_target VALUES
20+
INSERT INTO public.permission_target
21+
(id, role_name, permissions,
22+
object_type, schema_name)
23+
VALUES
2124
(1, 'appuser', '{SELECT,INSERT,UPDATE,DELETE}',
22-
'TABLE', 'appschema', NULL, NULL);
23-
INSERT INTO public.permission_target VALUES
25+
'TABLE', 'appschema');
26+
INSERT INTO public.permission_target
27+
(id, role_name, permissions,
28+
object_type, schema_name)
29+
VALUES
2430
(2, 'appuser', '{SELECT,INSERT,UPDATE,DELETE}',
25-
'VIEW', 'appschema', NULL, NULL);
31+
'VIEW', 'appschema');
2632

2733
The user also needs `USAGE` privileges on the `appseq` sequence in
2834
that schema:
@@ -36,6 +42,17 @@ permissions are granted:
3642

3743
SELECT * FROM public.permission_diffs();
3844

45+
missing | role_name | object_type | schema_name | object_name | column_name | permission
46+
---------+-----------+-------------+-------------+-------------+-------------+------------
47+
f | laurenz | VIEW | appschema | appview | | SELECT
48+
t | appuser | TABLE | appschema | apptable | | DELETE
49+
(2 rows)
50+
51+
That means that `appuser` is missing the `DELETE` privilege on
52+
`appschema.apptable` which should be granted, while user `laurenz`
53+
has the additional `SELECT` privilege on `appschema.appview` (`missing`
54+
is `FALSE`).
55+
3956
Usage
4057
-----
4158

0 commit comments

Comments
 (0)