Revision 11655
Added by Aaron Marcuse-Kubitza about 11 years ago
schemas/util.sql | ||
---|---|---|
1145 | 1145 |
|
1146 | 1146 |
|
1147 | 1147 |
-- |
1148 |
-- Name: grants_users(); Type: FUNCTION; Schema: util; Owner: - |
|
1149 |
-- |
|
1150 |
|
|
1151 |
CREATE FUNCTION grants_users() RETURNS SETOF text |
|
1152 |
LANGUAGE sql IMMUTABLE |
|
1153 |
AS $$ |
|
1154 |
VALUES ('bien_read'), ('public_') |
|
1155 |
$$; |
|
1156 |
|
|
1157 |
|
|
1158 |
-- |
|
1148 | 1159 |
-- Name: has_prefix(text, text); Type: FUNCTION; Schema: util; Owner: - |
1149 | 1160 |
-- |
1150 | 1161 |
|
... | ... | |
1827 | 1838 |
|
1828 | 1839 |
|
1829 | 1840 |
-- |
1841 |
-- Name: show_grants_for(regclass); Type: FUNCTION; Schema: util; Owner: - |
|
1842 |
-- |
|
1843 |
|
|
1844 |
CREATE FUNCTION show_grants_for(table_ regclass) RETURNS text |
|
1845 |
LANGUAGE sql STABLE |
|
1846 |
AS $_$ |
|
1847 |
SELECT concat(cmd) |
|
1848 |
FROM |
|
1849 |
( |
|
1850 |
SELECT (CASE WHEN has_table_privilege(user_, $1, 'SELECT') THEN |
|
1851 |
$$GRANT SELECT ON TABLE $$||$1||$$ TO $$||quote_ident(user_)||$$; |
|
1852 |
$$ ELSE '' END) AS cmd |
|
1853 |
FROM util.grants_users() f (user_) |
|
1854 |
) s |
|
1855 |
$_$; |
|
1856 |
|
|
1857 |
|
|
1858 |
-- |
|
1830 | 1859 |
-- Name: table2hstore(regclass); Type: FUNCTION; Schema: util; Owner: - |
1831 | 1860 |
-- |
1832 | 1861 |
|
Also available in: Unified diff
schemas/util.sql: added show_grants_for(table_ regclass), for use by show_create_view()