mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1) Fixed an issue where Default Privileges and Privileges not working correctly. #8369
2) Fixed <br/> tag visible issue.
This commit is contained in:
@@ -33,6 +33,7 @@ Bug fixes
|
|||||||
*********
|
*********
|
||||||
|
|
||||||
| `Issue #5204 <https://github.com/pgadmin-org/pgadmin4/issues/5204>`_ - Fixed an issue where pgadmin cannot install into path with non ASCII characters.
|
| `Issue #5204 <https://github.com/pgadmin-org/pgadmin4/issues/5204>`_ - Fixed an issue where pgadmin cannot install into path with non ASCII characters.
|
||||||
|
| `Issue #6044 <https://github.com/pgadmin-org/pgadmin4/issues/6044>`_ - Fixed an issue where filter dialog save fails when the PostgreSQL server/database connection is lost.
|
||||||
| `Issue #6968 <https://github.com/pgadmin-org/pgadmin4/issues/6968>`_ - Fixed an issue where option key was not registering in PSQL tool.
|
| `Issue #6968 <https://github.com/pgadmin-org/pgadmin4/issues/6968>`_ - Fixed an issue where option key was not registering in PSQL tool.
|
||||||
| `Issue #8072 <https://github.com/pgadmin-org/pgadmin4/issues/8072>`_ - Fixed an issue where Schema Diff not produce difference script for Index definition with where condition.
|
| `Issue #8072 <https://github.com/pgadmin-org/pgadmin4/issues/8072>`_ - Fixed an issue where Schema Diff not produce difference script for Index definition with where condition.
|
||||||
| `Issue #8142 <https://github.com/pgadmin-org/pgadmin4/issues/8142>`_ - Correct the documentation for the MFA configuration.
|
| `Issue #8142 <https://github.com/pgadmin-org/pgadmin4/issues/8142>`_ - Correct the documentation for the MFA configuration.
|
||||||
@@ -47,4 +48,5 @@ Bug fixes
|
|||||||
| `Issue #8299 <https://github.com/pgadmin-org/pgadmin4/issues/8299>`_ - Ensure master password pop up is not shown on setting MASTER_PASSWORD_REQUIRED to false.
|
| `Issue #8299 <https://github.com/pgadmin-org/pgadmin4/issues/8299>`_ - Ensure master password pop up is not shown on setting MASTER_PASSWORD_REQUIRED to false.
|
||||||
| `Issue #8309 <https://github.com/pgadmin-org/pgadmin4/issues/8309>`_ - Remove the option "With no data (concurrently)" from Refresh MATERIALIZED VIEW context menu.
|
| `Issue #8309 <https://github.com/pgadmin-org/pgadmin4/issues/8309>`_ - Remove the option "With no data (concurrently)" from Refresh MATERIALIZED VIEW context menu.
|
||||||
| `Issue #8320 <https://github.com/pgadmin-org/pgadmin4/issues/8320>`_ - Fix an issue where wrong information is shown after using the filter on the Dashboard> State tab.
|
| `Issue #8320 <https://github.com/pgadmin-org/pgadmin4/issues/8320>`_ - Fix an issue where wrong information is shown after using the filter on the Dashboard> State tab.
|
||||||
| `Issue #8365 <https://github.com/pgadmin-org/pgadmin4/issues/8365>`_ - Fixed an issue where PSQL tool is not opening if database name have HTML characters in the name.
|
| `Issue #8365 <https://github.com/pgadmin-org/pgadmin4/issues/8365>`_ - Fixed an issue where PSQL tool is not opening if database name have HTML characters in the name.
|
||||||
|
| `Issue #8369 <https://github.com/pgadmin-org/pgadmin4/issues/8369>`_ - Fixed an issue where Default Privileges and Privileges not working correctly.
|
@@ -34,6 +34,7 @@ from pgadmin.tools.sqleditor.utils.query_history import QueryHistory
|
|||||||
|
|
||||||
from pgadmin.tools.schema_diff.node_registry import SchemaDiffRegistry
|
from pgadmin.tools.schema_diff.node_registry import SchemaDiffRegistry
|
||||||
from pgadmin.model import db, Server, Database
|
from pgadmin.model import db, Server, Database
|
||||||
|
from pgadmin.browser.utils import underscore_escape
|
||||||
from pgadmin.utils.constants import TWO_PARAM_STRING
|
from pgadmin.utils.constants import TWO_PARAM_STRING
|
||||||
|
|
||||||
|
|
||||||
@@ -1073,7 +1074,7 @@ class DatabaseView(PGChildNodeView):
|
|||||||
status, errmsg = conn.connect()
|
status, errmsg = conn.connect()
|
||||||
|
|
||||||
return internal_server_error(
|
return internal_server_error(
|
||||||
errormsg=msg)
|
errormsg=underscore_escape(msg))
|
||||||
|
|
||||||
return make_json_response(success=1)
|
return make_json_response(success=1)
|
||||||
|
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
{# Fetch privileges for schema #}
|
|
||||||
SELECT
|
|
||||||
'nspacl' as deftype, COALESCE(gt.rolname, 'PUBLIC') AS grantee,
|
|
||||||
g.rolname AS grantor, pg_catalog.array_agg(b.privilege_type) AS privileges,
|
|
||||||
pg_catalog.array_agg(b.is_grantable) AS grantable
|
|
||||||
FROM
|
|
||||||
(SELECT
|
|
||||||
(d).grantee AS grantee, (d).grantor AS grantor,
|
|
||||||
(d).is_grantable AS is_grantable,
|
|
||||||
CASE (d).privilege_type
|
|
||||||
WHEN 'CREATE' THEN 'C'
|
|
||||||
WHEN 'USAGE' THEN 'U'
|
|
||||||
ELSE 'UNKNOWN - ' || (d).privilege_type
|
|
||||||
END AS privilege_type
|
|
||||||
FROM
|
|
||||||
(SELECT pg_catalog.aclexplode(nsp.nspacl) as d
|
|
||||||
FROM pg_catalog.pg_namespace nsp
|
|
||||||
WHERE nsp.oid = {{ scid|qtLiteral(conn) }}::OID
|
|
||||||
) a
|
|
||||||
) b
|
|
||||||
LEFT JOIN pg_catalog.pg_roles g ON (b.grantor = g.oid)
|
|
||||||
LEFT JOIN pg_catalog.pg_roles gt ON (b.grantee = gt.oid)
|
|
||||||
GROUP BY g.rolname, gt.rolname;
|
|
@@ -1,17 +0,0 @@
|
|||||||
{% import 'macros/privilege.macros' as PRIVILEGE %}
|
|
||||||
{% if data %}
|
|
||||||
CREATE SCHEMA {{ conn|qtIdent(data.name) }}
|
|
||||||
{% if data.namespaceowner %}
|
|
||||||
AUTHORIZATION {{ conn|qtIdent(data.namespaceowner) }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.description %}
|
|
||||||
COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|
||||||
IS {{ data.description|qtLiteral(conn) }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.nspacl %}
|
|
||||||
{% for priv in data.nspacl %}
|
|
||||||
{{ PRIVILEGE.APPLY(conn, 'SCHEMA', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -1 +0,0 @@
|
|||||||
SELECT nsp.nspname FROM pg_catalog.pg_namespace nsp WHERE nsp.oid = {{ scid|qtLiteral(conn) }};
|
|
@@ -1,9 +0,0 @@
|
|||||||
{% import 'catalog/pg/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
nsp.nspname as schema_name,
|
|
||||||
{{ CATALOGS.LIST('nsp') }} AS is_catalog,
|
|
||||||
{{ CATALOGS.DB_SUPPORT('nsp') }} AS db_support
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
WHERE
|
|
||||||
nsp.oid = {{ scid|qtLiteral(conn) }}::OID;
|
|
@@ -1,23 +0,0 @@
|
|||||||
{# Fetch privileges for schema #}
|
|
||||||
SELECT
|
|
||||||
'nspacl' as deftype, COALESCE(gt.rolname, 'PUBLIC') AS grantee,
|
|
||||||
g.rolname AS grantor, pg_catalog.array_agg(b.privilege_type) AS privileges,
|
|
||||||
pg_catalog.array_agg(b.is_grantable) AS grantable
|
|
||||||
FROM
|
|
||||||
(SELECT
|
|
||||||
(d).grantee AS grantee, (d).grantor AS grantor,
|
|
||||||
(d).is_grantable AS is_grantable,
|
|
||||||
CASE (d).privilege_type
|
|
||||||
WHEN 'CREATE' THEN 'C'
|
|
||||||
WHEN 'USAGE' THEN 'U'
|
|
||||||
ELSE 'UNKNOWN - ' || (d).privilege_type
|
|
||||||
END AS privilege_type
|
|
||||||
FROM
|
|
||||||
(SELECT pg_catalog.aclexplode(nsp.nspacl) as d
|
|
||||||
FROM pg_catalog.pg_namespace nsp
|
|
||||||
WHERE nsp.oid = {{ scid|qtLiteral(conn) }}::OID
|
|
||||||
) a
|
|
||||||
) b
|
|
||||||
LEFT JOIN pg_catalog.pg_roles g ON (b.grantor = g.oid)
|
|
||||||
LEFT JOIN pg_catalog.pg_roles gt ON (b.grantee = gt.oid)
|
|
||||||
GROUP BY g.rolname, gt.rolname;
|
|
@@ -1 +0,0 @@
|
|||||||
SELECT nsp.nspname FROM pg_catalog.pg_namespace nsp WHERE nsp.oid = {{ scid|qtLiteral(conn) }};
|
|
@@ -1,9 +0,0 @@
|
|||||||
{% import 'catalog/pg/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
nsp.nspname as schema_name,
|
|
||||||
{{ CATALOGS.LIST('nsp') }} AS is_catalog,
|
|
||||||
{{ CATALOGS.DB_SUPPORT('nsp') }} AS db_support
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
WHERE
|
|
||||||
nsp.oid = {{ scid|qtLiteral(conn) }}::OID;
|
|
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"deftblacl": {
|
"deftblacl": {
|
||||||
"type": "TABLE",
|
"type": "TABLE",
|
||||||
"acl": ["r", "a", "w", "d", "D", "x", "t"]
|
"acl": ["a", "r", "w", "d", "D", "x", "t"]
|
||||||
},
|
},
|
||||||
"defseqacl": {
|
"defseqacl": {
|
||||||
"type": "SEQUENCE",
|
"type": "SEQUENCE",
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
{# Fetch privileges for schema #}
|
|
||||||
SELECT
|
|
||||||
'nspacl' as deftype, COALESCE(gt.rolname, 'PUBLIC') AS grantee,
|
|
||||||
g.rolname AS grantor, pg_catalog.array_agg(b.privilege_type) AS privileges,
|
|
||||||
pg_catalog.array_agg(b.is_grantable) AS grantable
|
|
||||||
FROM
|
|
||||||
(SELECT
|
|
||||||
(d).grantee AS grantee, (d).grantor AS grantor,
|
|
||||||
(d).is_grantable AS is_grantable,
|
|
||||||
CASE (d).privilege_type
|
|
||||||
WHEN 'CREATE' THEN 'C'
|
|
||||||
WHEN 'USAGE' THEN 'U'
|
|
||||||
ELSE 'UNKNOWN - ' || (d).privilege_type
|
|
||||||
END AS privilege_type
|
|
||||||
FROM
|
|
||||||
(SELECT pg_catalog.aclexplode(nsp.nspacl) as d
|
|
||||||
FROM pg_catalog.pg_namespace nsp
|
|
||||||
WHERE nsp.oid = {{ scid|qtLiteral(conn) }}::OID
|
|
||||||
) a
|
|
||||||
) b
|
|
||||||
LEFT JOIN pg_catalog.pg_roles g ON (b.grantor = g.oid)
|
|
||||||
LEFT JOIN pg_catalog.pg_roles gt ON (b.grantee = gt.oid)
|
|
||||||
GROUP BY g.rolname, gt.rolname;
|
|
@@ -1 +0,0 @@
|
|||||||
SELECT nsp.nspname FROM pg_catalog.pg_namespace nsp WHERE nsp.oid = {{ scid|qtLiteral(conn) }};
|
|
@@ -1,9 +0,0 @@
|
|||||||
{% import 'catalog/ppas/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
nsp.nspname as schema_name,
|
|
||||||
{{ CATALOGS.LIST('nsp') }} AS is_catalog,
|
|
||||||
{{ CATALOGS.DB_SUPPORT('nsp') }} AS db_support
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
WHERE
|
|
||||||
nsp.oid = {{ scid|qtLiteral(conn) }}::OID;
|
|
@@ -1,30 +0,0 @@
|
|||||||
{% import 'macros/security.macros' as SECLABEL %}
|
|
||||||
{% if data %}
|
|
||||||
{# ==== To update catalog comments ==== #}
|
|
||||||
{% if data.description and data.description != o_data.description %}
|
|
||||||
COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
|
||||||
IS {{ data.description|qtLiteral(conn) }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{# ==== To update catalog securitylabel ==== #}
|
|
||||||
{# The SQL generated below will change Security Label #}
|
|
||||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
|
||||||
{% set seclabels = data.seclabels %}
|
|
||||||
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
|
|
||||||
{% for r in seclabels.deleted %}
|
|
||||||
{{ SECLABEL.DROP(conn, 'SCHEMA', o_data.name, r.provider) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
|
||||||
{% for r in seclabels.added %}
|
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
|
||||||
{% for r in seclabels.changed %}
|
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -1,23 +0,0 @@
|
|||||||
{# Fetch privileges for schema #}
|
|
||||||
SELECT
|
|
||||||
'nspacl' as deftype, COALESCE(gt.rolname, 'PUBLIC') AS grantee,
|
|
||||||
g.rolname AS grantor, pg_catalog.array_agg(b.privilege_type) AS privileges,
|
|
||||||
pg_catalog.array_agg(b.is_grantable) AS grantable
|
|
||||||
FROM
|
|
||||||
(SELECT
|
|
||||||
(d).grantee AS grantee, (d).grantor AS grantor,
|
|
||||||
(d).is_grantable AS is_grantable,
|
|
||||||
CASE (d).privilege_type
|
|
||||||
WHEN 'CREATE' THEN 'C'
|
|
||||||
WHEN 'USAGE' THEN 'U'
|
|
||||||
ELSE 'UNKNOWN - ' || (d).privilege_type
|
|
||||||
END AS privilege_type
|
|
||||||
FROM
|
|
||||||
(SELECT pg_catalog.aclexplode(nsp.nspacl) as d
|
|
||||||
FROM pg_catalog.pg_namespace nsp
|
|
||||||
WHERE nsp.oid = {{ scid|qtLiteral(conn) }}::OID
|
|
||||||
) a
|
|
||||||
) b
|
|
||||||
LEFT JOIN pg_catalog.pg_roles g ON (b.grantor = g.oid)
|
|
||||||
LEFT JOIN pg_catalog.pg_roles gt ON (b.grantee = gt.oid)
|
|
||||||
GROUP BY g.rolname, gt.rolname;
|
|
@@ -1,17 +0,0 @@
|
|||||||
{% import 'macros/privilege.macros' as PRIVILEGE %}
|
|
||||||
{% if data %}
|
|
||||||
CREATE SCHEMA {{ conn|qtIdent(data.name) }}
|
|
||||||
{% if data.namespaceowner %}
|
|
||||||
AUTHORIZATION {{ conn|qtIdent(data.namespaceowner) }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.description %}
|
|
||||||
COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|
||||||
IS {{ data.description|qtLiteral(conn) }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.nspacl %}
|
|
||||||
{% for priv in data.nspacl %}
|
|
||||||
{{ PRIVILEGE.APPLY(conn, 'SCHEMA', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -1 +0,0 @@
|
|||||||
SELECT nsp.nspname FROM pg_catalog.pg_namespace nsp WHERE nsp.oid = {{ scid|qtLiteral(conn) }};
|
|
@@ -1,9 +0,0 @@
|
|||||||
{% import 'catalog/ppas/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
nsp.nspname as schema_name,
|
|
||||||
{{ CATALOGS.LIST('nsp') }} AS is_catalog,
|
|
||||||
{{ CATALOGS.DB_SUPPORT('nsp') }} AS db_support
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
WHERE
|
|
||||||
nsp.oid = {{ scid|qtLiteral(conn) }}::OID;
|
|
@@ -1,30 +0,0 @@
|
|||||||
{% import 'macros/security.macros' as SECLABEL %}
|
|
||||||
{% if data %}
|
|
||||||
{# ==== To update catalog comments ==== #}
|
|
||||||
{% if data.description and data.description != o_data.description %}
|
|
||||||
COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
|
||||||
IS {{ data.description|qtLiteral(conn) }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{# ==== To update catalog securitylabel ==== #}
|
|
||||||
{# The SQL generated below will change Security Label #}
|
|
||||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
|
||||||
{% set seclabels = data.seclabels %}
|
|
||||||
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
|
|
||||||
{% for r in seclabels.deleted %}
|
|
||||||
{{ SECLABEL.DROP(conn, 'SCHEMA', o_data.name, r.provider) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
|
||||||
{% for r in seclabels.added %}
|
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
|
||||||
{% for r in seclabels.changed %}
|
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"deftblacl": {
|
"deftblacl": {
|
||||||
"type": "TABLE",
|
"type": "TABLE",
|
||||||
"acl": ["r", "a", "w", "d", "D", "x", "t"]
|
"acl": ["a", "r", "w", "d", "D", "x", "t"]
|
||||||
},
|
},
|
||||||
"defseqacl": {
|
"defseqacl": {
|
||||||
"type": "SEQUENCE",
|
"type": "SEQUENCE",
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"deftblacl": {
|
"deftblacl": {
|
||||||
"type": "TABLE",
|
"type": "TABLE",
|
||||||
"acl": ["r", "a", "w", "d", "D", "x", "t"]
|
"acl": ["a", "r", "w", "d", "D", "x", "t"]
|
||||||
},
|
},
|
||||||
"defseqacl": {
|
"defseqacl": {
|
||||||
"type": "SEQUENCE",
|
"type": "SEQUENCE",
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"deftblacl": {
|
"deftblacl": {
|
||||||
"type": "TABLE",
|
"type": "TABLE",
|
||||||
"acl": ["r", "a", "w", "d", "D", "x", "t"]
|
"acl": ["a", "r", "w", "d", "D", "x", "t"]
|
||||||
},
|
},
|
||||||
"defseqacl": {
|
"defseqacl": {
|
||||||
"type": "SEQUENCE",
|
"type": "SEQUENCE",
|
||||||
|
@@ -22,5 +22,9 @@
|
|||||||
"deffuncacl": {
|
"deffuncacl": {
|
||||||
"type": "FUNCTION",
|
"type": "FUNCTION",
|
||||||
"acl": ["X"]
|
"acl": ["X"]
|
||||||
|
},
|
||||||
|
"deftypeacl": {
|
||||||
|
"type": "TYPE",
|
||||||
|
"acl": ["U"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"deftblacl": {
|
"deftblacl": {
|
||||||
"type": "TABLE",
|
"type": "TABLE",
|
||||||
"acl": ["r", "a", "w", "d", "D", "x", "t"]
|
"acl": ["a", "r", "w", "d", "D", "x", "t"]
|
||||||
},
|
},
|
||||||
"defseqacl": {
|
"defseqacl": {
|
||||||
"type": "SEQUENCE",
|
"type": "SEQUENCE",
|
||||||
@@ -22,5 +22,9 @@
|
|||||||
"deffuncacl": {
|
"deffuncacl": {
|
||||||
"type": "FUNCTION",
|
"type": "FUNCTION",
|
||||||
"acl": ["X"]
|
"acl": ["X"]
|
||||||
|
},
|
||||||
|
"deftypeacl": {
|
||||||
|
"type": "TYPE",
|
||||||
|
"acl": ["U"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in data.deffuncacl %}
|
{% if 'changed' in data.deffuncacl %}
|
||||||
{% for priv in data.deffuncacl.changed %}
|
{% for priv in data.deffuncacl.changed %}
|
||||||
{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'FUNCTIONS', priv.grantee) }}
|
{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'FUNCTIONS', priv.grantee, priv.grantor) }}
|
||||||
{{ DEFAULT_PRIVILEGE.APPLY(conn, 'FUNCTIONS', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
|
{{ DEFAULT_PRIVILEGE.APPLY(conn, 'FUNCTIONS', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -24,7 +24,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{# Change the variables/options #}
|
{# Change the variables/options #}
|
||||||
{% if data.variables and data.variables|length > 0 %}
|
{% if data.variables and data.variables|length > 0 %}
|
||||||
{% set variables = data.variables %}
|
{% set variables = data.variables %}
|
||||||
@@ -86,7 +85,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in data.deftblacl %}
|
{% if 'changed' in data.deftblacl %}
|
||||||
{% for priv in data.deftblacl.changed %}
|
{% for priv in data.deftblacl.changed %}
|
||||||
{{ DEFAULT_PRIVILEGE.APPLY(conn, 'TABLES', priv.grantee, priv.without_grant, priv.with_grant) }}
|
{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'TABLES', priv.grantee, priv.grantor) }}
|
||||||
|
{{ DEFAULT_PRIVILEGE.APPLY(conn, 'TABLES', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'added' in data.deftblacl %}
|
{% if 'added' in data.deftblacl %}
|
||||||
@@ -97,7 +97,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# Change the default priviledges for the sequences #}
|
{# Change the default priviledges for the sequences #}
|
||||||
{% if data.deftblacl %}
|
|
||||||
{% if data.defseqacl %}
|
{% if data.defseqacl %}
|
||||||
{% if 'deleted' in data.defseqacl %}
|
{% if 'deleted' in data.defseqacl %}
|
||||||
{% for priv in data.defseqacl.deleted %}
|
{% for priv in data.defseqacl.deleted %}
|
||||||
@@ -106,7 +105,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'changed' in data.defseqacl %}
|
{% if 'changed' in data.defseqacl %}
|
||||||
{% for priv in data.defseqacl.changed %}
|
{% for priv in data.defseqacl.changed %}
|
||||||
{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'SEQUENCES', priv.grantee) }}
|
{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'SEQUENCES', priv.grantee, priv.grantor) }}
|
||||||
{{ DEFAULT_PRIVILEGE.APPLY(conn, 'SEQUENCES', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
|
{{ DEFAULT_PRIVILEGE.APPLY(conn, 'SEQUENCES', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -117,9 +116,26 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{# Change the default priviledges/ACLs for types #}
|
||||||
|
{% if data.deftypeacl %}
|
||||||
|
{% if 'deleted' in data.deftypeacl %}
|
||||||
|
{% for priv in data.deftypeacl.deleted %}
|
||||||
|
{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'TYPES', priv.grantee, priv.grantor) }}
|
||||||
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if 'changed' in data.deftypeacl %}
|
||||||
|
{% for priv in data.deftypeacl.changed %}
|
||||||
|
{{ DEFAULT_PRIVILEGE.RESETALL(conn, 'TYPES', priv.grantee, priv.grantor) }}
|
||||||
|
{{ DEFAULT_PRIVILEGE.APPLY(conn, 'TYPES', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'added' in data.deftypeacl %}
|
||||||
|
{% for priv in data.deftypeacl.added %}
|
||||||
|
{{ DEFAULT_PRIVILEGE.APPLY(conn, 'TYPES', priv.grantee, priv.without_grant, priv.with_grant, priv.grantor) }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{# Change the security labels #}
|
{# Change the security labels #}
|
||||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
{% if data.seclabels and data.seclabels|length > 0 %}
|
||||||
{% set seclabels = data.seclabels %}
|
{% set seclabels = data.seclabels %}
|
||||||
|
@@ -0,0 +1,26 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = postgres
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE, INSERT, UPDATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user;
|
@@ -0,0 +1,28 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = postgres
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = 'C'
|
||||||
|
LC_CTYPE = 'C'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT TRUNCATE ON TABLES TO test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE ON TABLES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT UPDATE ON SEQUENCES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user WITH GRANT OPTION;
|
@@ -0,0 +1,14 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = postgres
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
@@ -22,3 +22,4 @@ GRANT SELECT, USAGE ON SEQUENCES TO PUBLIC;
|
|||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
@@ -11,3 +11,5 @@ ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON TABLES FROM PUBLIC;
|
|||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
@@ -8,3 +8,5 @@ ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON TABLES FROM PUBLIC;
|
|||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"scenarios": [
|
"scenarios": [
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default priviliges for functions",
|
"name": "Alert default privileges for functions",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
"msql_endpoint": "NODE-database.msql_id",
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
"name": "Alert default privileges for tables",
|
"name": "Alert default privileges for tables",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_tables_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -96,14 +98,15 @@
|
|||||||
},
|
},
|
||||||
"deftblacl": {"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"deftblacl": {"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_sequences.sql",
|
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql",
|
||||||
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql"
|
"expected_sql_file": "alter_default_db_privileges_sequences.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default privileges for types",
|
"name": "Alert default privileges for types",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -125,6 +128,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_types_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -137,11 +141,70 @@
|
|||||||
"data": {
|
"data": {
|
||||||
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
"deftblacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false,"cid":"nn626"},{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn627"},{"privilege_type":"w","privilege":true,"with_grant":false,"cid":"nn628"},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
"deftblacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
||||||
"defseqacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn673"},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"defseqacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user add for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
|
"deftypeacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
|
"deftblacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
|
"defseqacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"postgres"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_add_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_add_all.sql",
|
||||||
|
"pre_scenario_sql": "CREATE ROLE test_default_priv_user WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION NOBYPASSRLS;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftypeacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}],"grantor":"postgres"}],
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"postgres"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}], "grantor":"postgres"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"postgres"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_all_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_all.sql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user reset all",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftypeacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}, {"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"postgres"}]}
|
||||||
|
},
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_newuser_reset_all.sql",
|
||||||
|
"post_scenario_sql": "DROP ROLE IF EXISTS test_default_priv_user;"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "create",
|
"type": "create",
|
||||||
"name": "Create Database with new options and libc",
|
"name": "Create Database with new options and libc",
|
||||||
|
@@ -12,3 +12,5 @@ ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON TABLES FROM PUBLIC;
|
|||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"scenarios": [
|
"scenarios": [
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default priviliges for functions",
|
"name": "Alert default privileges for functions",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
"msql_endpoint": "NODE-database.msql_id",
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
"name": "Alert default privileges for tables",
|
"name": "Alert default privileges for tables",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_tables_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -96,14 +98,15 @@
|
|||||||
},
|
},
|
||||||
"deftblacl": {"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"deftblacl": {"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_sequences.sql",
|
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql",
|
||||||
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql"
|
"expected_sql_file": "alter_default_db_privileges_sequences.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default privileges for types",
|
"name": "Alert default privileges for types",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -125,6 +128,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_types_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -137,11 +141,70 @@
|
|||||||
"data": {
|
"data": {
|
||||||
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
"deftblacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false,"cid":"nn626"},{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn627"},{"privilege_type":"w","privilege":true,"with_grant":false,"cid":"nn628"},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
"deftblacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
||||||
"defseqacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn673"},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"defseqacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user add for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
|
"deftypeacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
|
"deftblacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
|
"defseqacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"postgres"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_add_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_add_all.sql",
|
||||||
|
"pre_scenario_sql": "CREATE ROLE test_default_priv_user WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION NOBYPASSRLS;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftypeacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}],"grantor":"postgres"}],
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"postgres"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}], "grantor":"postgres"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"postgres"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_all_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_all.sql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user reset all",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftypeacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}, {"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"postgres"}]}
|
||||||
|
},
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_newuser_reset_all.sql",
|
||||||
|
"post_scenario_sql": "DROP ROLE IF EXISTS test_default_priv_user;"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "create",
|
"type": "create",
|
||||||
"name": "Create Database with new options and libc",
|
"name": "Create Database with new options and libc",
|
||||||
|
@@ -0,0 +1,31 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = postgres
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON TABLES FROM postgres;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLES TO postgres;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE, MAINTAIN, UPDATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user;
|
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE, MAINTAIN, UPDATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user;
|
@@ -0,0 +1,33 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = postgres
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = 'C'
|
||||||
|
LC_CTYPE = 'C'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON TABLES FROM postgres;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLES TO postgres;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT TRUNCATE ON TABLES TO test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT MAINTAIN ON TABLES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT UPDATE ON SEQUENCES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user WITH GRANT OPTION;
|
@@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON FUNCTIONS FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON TABLES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON TABLES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT MAINTAIN ON TABLES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT TRUNCATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON SEQUENCES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON SEQUENCES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT UPDATE ON SEQUENCES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON TYPES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user WITH GRANT OPTION;
|
@@ -0,0 +1,19 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = postgres
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON TABLES FROM postgres;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLES TO postgres;
|
@@ -0,0 +1,19 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = postgres
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON TABLES FROM postgres;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLES TO postgres;
|
@@ -11,3 +11,5 @@ ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON TABLES FROM PUBLIC;
|
|||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = postgres
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE, INSERT, UPDATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user;
|
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE, INSERT, UPDATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user;
|
@@ -0,0 +1,27 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = postgres
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = 'C'
|
||||||
|
LC_CTYPE = 'C'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT TRUNCATE ON TABLES TO test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE ON TABLES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT UPDATE ON SEQUENCES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user WITH GRANT OPTION;
|
@@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON FUNCTIONS FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON TABLES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON TABLES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT DELETE ON TABLES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT TRUNCATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON SEQUENCES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON SEQUENCES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT UPDATE ON SEQUENCES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON TYPES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user WITH GRANT OPTION;
|
@@ -0,0 +1,13 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = postgres
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
@@ -6,4 +6,4 @@ ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
|||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
REVOKE ALL ON SEQUENCES FROM postgres;
|
REVOKE ALL ON SEQUENCES FROM postgres;
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
GRANT USAGE, SELECT ON SEQUENCES TO PUBLIC;
|
GRANT SELECT, USAGE ON SEQUENCES TO PUBLIC;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
REVOKE ALL ON TABLES FROM PUBLIC;
|
REVOKE ALL ON TABLES FROM postgres;
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
GRANT SELECT ON TABLES TO PUBLIC;
|
GRANT SELECT ON TABLES TO PUBLIC;
|
||||||
|
@@ -21,3 +21,4 @@ GRANT SELECT, USAGE ON SEQUENCES TO PUBLIC;
|
|||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE postgres
|
||||||
|
REVOKE ALL ON TYPES FROM PUBLIC;
|
@@ -2,7 +2,7 @@
|
|||||||
"scenarios": [
|
"scenarios": [
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default priviliges for functions",
|
"name": "Alert default privileges for functions",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
"msql_endpoint": "NODE-database.msql_id",
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
"name": "Alert default privileges for tables",
|
"name": "Alert default privileges for tables",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_tables_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -96,14 +98,15 @@
|
|||||||
},
|
},
|
||||||
"deftblacl": {"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"deftblacl": {"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_sequences.sql",
|
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql",
|
||||||
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql"
|
"expected_sql_file": "alter_default_db_privileges_sequences.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default privileges for types",
|
"name": "Alert default privileges for types",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -125,6 +128,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_types_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -137,10 +141,69 @@
|
|||||||
"data": {
|
"data": {
|
||||||
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
"deftblacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false,"cid":"nn626"},{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn627"},{"privilege_type":"w","privilege":true,"with_grant":false,"cid":"nn628"},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
"deftblacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
||||||
"defseqacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn673"},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"defseqacl":{"added":[{"grantee":"postgres","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}],"deleted":[{"grantor":"postgres","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user add for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
|
"deftypeacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
|
"deftblacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false}],"grantor":"postgres"}]},
|
||||||
|
"defseqacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"postgres"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_add_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_add_all.sql",
|
||||||
|
"pre_scenario_sql": "CREATE ROLE test_default_priv_user WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION NOBYPASSRLS;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftypeacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}],"grantor":"postgres"}],
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"postgres"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}], "grantor":"postgres"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"postgres"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_all_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_all.sql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user reset all",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftypeacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}, {"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"postgres"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"postgres"}]}
|
||||||
|
},
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_newuser_reset_all.sql",
|
||||||
|
"post_scenario_sql": "DROP ROLE IF EXISTS test_default_priv_user;"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,26 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = enterprisedb
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE, INSERT, UPDATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user;
|
@@ -0,0 +1,28 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = enterprisedb
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = 'C'
|
||||||
|
LC_CTYPE = 'C'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT TRUNCATE ON TABLES TO test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE ON TABLES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT UPDATE ON SEQUENCES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user WITH GRANT OPTION;
|
@@ -0,0 +1,14 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = enterprisedb
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
@@ -21,3 +21,5 @@ ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
|||||||
GRANT SELECT, USAGE ON SEQUENCES TO PUBLIC;
|
GRANT SELECT, USAGE ON SEQUENCES TO PUBLIC;
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
@@ -11,3 +11,5 @@ ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM PUBLIC;
|
|||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
@@ -8,3 +8,5 @@ ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM PUBLIC;
|
|||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"scenarios": [
|
"scenarios": [
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default priviliges for functions",
|
"name": "Alert default privileges for functions",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
"msql_endpoint": "NODE-database.msql_id",
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
"name": "Alert default privileges for tables",
|
"name": "Alert default privileges for tables",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_tables_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -90,20 +92,21 @@
|
|||||||
"acltype": "defaultacls"
|
"acltype": "defaultacls"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false},
|
"added":[
|
||||||
|
{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false},
|
||||||
{"privilege_type":"r","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]
|
{"privilege_type":"r","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]
|
||||||
},
|
},
|
||||||
"deftblacl": {"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"deftblacl": {"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
|
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_sequences.sql",
|
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql",
|
||||||
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql"
|
"expected_sql_file": "alter_default_db_privileges_sequences.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default privileges for types",
|
"name": "Alert default privileges for types",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -125,6 +128,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_types_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -137,11 +141,70 @@
|
|||||||
"data": {
|
"data": {
|
||||||
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
"deftblacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false,"cid":"nn626"},{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn627"},{"privilege_type":"w","privilege":true,"with_grant":false,"cid":"nn628"},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
"deftblacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
||||||
"defseqacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn673"},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"defseqacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user add for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftypeacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftblacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
|
"defseqacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_add_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_add_all.sql",
|
||||||
|
"pre_scenario_sql": "CREATE ROLE test_default_priv_user WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION NOBYPASSRLS;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftypeacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}], "grantor":"enterprisedb"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_all_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_all.sql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user reset all",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftypeacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}, {"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]}
|
||||||
|
},
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_newuser_reset_all.sql",
|
||||||
|
"post_scenario_sql": "DROP ROLE IF EXISTS test_default_priv_user;"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "create",
|
"type": "create",
|
||||||
"name": "Create Database with new options and libc",
|
"name": "Create Database with new options and libc",
|
||||||
|
@@ -12,3 +12,5 @@ ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM PUBLIC;
|
|||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"scenarios": [
|
"scenarios": [
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default priviliges for functions",
|
"name": "Alert default privileges for functions",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
"msql_endpoint": "NODE-database.msql_id",
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
"name": "Alert default privileges for tables",
|
"name": "Alert default privileges for tables",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_tables_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -90,20 +92,21 @@
|
|||||||
"acltype": "defaultacls"
|
"acltype": "defaultacls"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false},
|
"added":[
|
||||||
|
{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false},
|
||||||
{"privilege_type":"r","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]
|
{"privilege_type":"r","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]
|
||||||
},
|
},
|
||||||
"deftblacl": {"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"deftblacl": {"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
|
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_sequences.sql",
|
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql",
|
||||||
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql"
|
"expected_sql_file": "alter_default_db_privileges_sequences.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default privileges for types",
|
"name": "Alert default privileges for types",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -125,6 +128,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_types_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -137,11 +141,70 @@
|
|||||||
"data": {
|
"data": {
|
||||||
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
"deftblacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false,"cid":"nn626"},{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn627"},{"privilege_type":"w","privilege":true,"with_grant":false,"cid":"nn628"},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
"deftblacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
||||||
"defseqacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn673"},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"defseqacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user add for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftypeacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftblacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
|
"defseqacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_add_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_add_all.sql",
|
||||||
|
"pre_scenario_sql": "CREATE ROLE test_default_priv_user WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION NOBYPASSRLS;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftypeacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}], "grantor":"enterprisedb"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_all_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_all.sql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user reset all",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftypeacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}, {"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]}
|
||||||
|
},
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_newuser_reset_all.sql",
|
||||||
|
"post_scenario_sql": "DROP ROLE IF EXISTS test_default_priv_user;"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "create",
|
"type": "create",
|
||||||
"name": "Create Database with new options and libc",
|
"name": "Create Database with new options and libc",
|
||||||
|
@@ -0,0 +1,31 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = enterprisedb
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM enterprisedb;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLES TO enterprisedb;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE, MAINTAIN, UPDATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user;
|
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE, MAINTAIN, UPDATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user;
|
@@ -0,0 +1,33 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = enterprisedb
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = 'C'
|
||||||
|
LC_CTYPE = 'C'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM enterprisedb;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLES TO enterprisedb;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT TRUNCATE ON TABLES TO test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT MAINTAIN ON TABLES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT UPDATE ON SEQUENCES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user WITH GRANT OPTION;
|
@@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON FUNCTIONS FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON TABLES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON TABLES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT MAINTAIN ON TABLES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT TRUNCATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON SEQUENCES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON SEQUENCES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT UPDATE ON SEQUENCES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON TYPES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user WITH GRANT OPTION;
|
@@ -0,0 +1,19 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = enterprisedb
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM enterprisedb;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLES TO enterprisedb;
|
@@ -0,0 +1,19 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = enterprisedb
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
LOCALE_PROVIDER = 'libc'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM enterprisedb;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON TABLES TO enterprisedb;
|
@@ -11,3 +11,5 @@ ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON TABLES FROM PUBLIC;
|
|||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE ALL ON SEQUENCES FROM PUBLIC;
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = enterprisedb
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE, INSERT, UPDATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user;
|
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE, INSERT, UPDATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT SELECT, UPDATE ON SEQUENCES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user;
|
@@ -0,0 +1,27 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = enterprisedb
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = 'C'
|
||||||
|
LC_CTYPE = 'C'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT TRUNCATE ON TABLES TO test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE ON TABLES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT UPDATE ON SEQUENCES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user WITH GRANT OPTION;
|
@@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON FUNCTIONS FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT EXECUTE ON FUNCTIONS TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON TABLES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON TABLES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT DELETE ON TABLES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT TRUNCATE ON TABLES TO test_default_priv_user;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON SEQUENCES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON SEQUENCES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT UPDATE ON SEQUENCES TO test_default_priv_user WITH GRANT OPTION;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON TYPES FROM test_default_priv_user;
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
GRANT USAGE ON TYPES TO test_default_priv_user WITH GRANT OPTION;
|
@@ -0,0 +1,13 @@
|
|||||||
|
-- Database: <TEST_DB_NAME>
|
||||||
|
|
||||||
|
-- DROP DATABASE IF EXISTS <TEST_DB_NAME>;
|
||||||
|
|
||||||
|
CREATE DATABASE <TEST_DB_NAME>
|
||||||
|
WITH
|
||||||
|
OWNER = enterprisedb
|
||||||
|
ENCODING = 'UTF8'
|
||||||
|
LC_COLLATE = '<LC_COLLATE>'
|
||||||
|
LC_CTYPE = '<LC_CTYPE>'
|
||||||
|
TABLESPACE = pg_default
|
||||||
|
CONNECTION LIMIT = -1
|
||||||
|
IS_TEMPLATE = False;
|
@@ -6,4 +6,4 @@ ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
|||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
REVOKE ALL ON SEQUENCES FROM enterprisedb;
|
REVOKE ALL ON SEQUENCES FROM enterprisedb;
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
GRANT USAGE, SELECT ON SEQUENCES TO PUBLIC;
|
GRANT SELECT, USAGE ON SEQUENCES TO PUBLIC;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
REVOKE ALL ON TABLES FROM PUBLIC;
|
REVOKE ALL ON TABLES FROM enterprisedb;
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
GRANT SELECT ON TABLES TO PUBLIC;
|
GRANT SELECT ON TABLES TO PUBLIC;
|
||||||
|
@@ -20,3 +20,5 @@ ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
|||||||
GRANT SELECT, USAGE ON SEQUENCES TO PUBLIC;
|
GRANT SELECT, USAGE ON SEQUENCES TO PUBLIC;
|
||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb REVOKE USAGE ON TYPES FROM PUBLIC;
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES FOR ROLE enterprisedb
|
||||||
|
REVOKE ALL ON TYPES FROM PUBLIC;
|
@@ -2,7 +2,7 @@
|
|||||||
"scenarios": [
|
"scenarios": [
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default priviliges for functions",
|
"name": "Alert default privileges for functions",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
"msql_endpoint": "NODE-database.msql_id",
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
"name": "Alert default privileges for tables",
|
"name": "Alert default privileges for tables",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_tables_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
"expected_sql_file": "alter_default_db_privileges_tables.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -90,20 +92,21 @@
|
|||||||
"acltype": "defaultacls"
|
"acltype": "defaultacls"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false},
|
"added":[
|
||||||
|
{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false},
|
||||||
{"privilege_type":"r","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]
|
{"privilege_type":"r","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]
|
||||||
},
|
},
|
||||||
"deftblacl": {"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"deftblacl": {"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
|
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_sequences.sql",
|
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql",
|
||||||
"expected_msql_file": "alter_default_db_privileges_sequences_msql.sql"
|
"expected_sql_file": "alter_default_db_privileges_sequences.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "alter",
|
"type": "alter",
|
||||||
"name": "Alert default privileges for types",
|
"name": "Alert default privileges for types",
|
||||||
"endpoint": "NODE-database.obj_id",
|
"endpoint": "NODE-database.obj_id",
|
||||||
"sql_endpoint": "NODE-database.sql_id",
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
"REPLACE_LOCALE": true,
|
"REPLACE_LOCALE": true,
|
||||||
"data": {
|
"data": {
|
||||||
@@ -125,6 +128,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_types_msql.sql",
|
||||||
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
"expected_sql_file": "alter_default_db_privileges_types.sql"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -137,10 +141,69 @@
|
|||||||
"data": {
|
"data": {
|
||||||
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
"deffuncacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
"deftypeacl": {"added":[{"grantee":"PUBLIC","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
"deftblacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false,"cid":"nn626"},{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn627"},{"privilege_type":"w","privilege":true,"with_grant":false,"cid":"nn628"},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
"deftblacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false},{"privilege_type":"D","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false},{"privilege_type":"t","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]},
|
||||||
"defseqacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false,"cid":"nn673"},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
"defseqacl":{"added":[{"grantee":"enterprisedb","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],"deleted":[{"grantor":"enterprisedb","grantee":"PUBLIC","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"U","privilege":true,"with_grant":false}],"acltype":"defaultacls"}]}
|
||||||
},
|
},
|
||||||
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
"expected_sql_file": "alter_default_db_privileges_reset_all.sql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user add for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftypeacl": {"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftblacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"d","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]},
|
||||||
|
"defseqacl":{"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_add_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_add_all.sql",
|
||||||
|
"pre_scenario_sql": "CREATE ROLE test_default_priv_user WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION NOBYPASSRLS;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user for function, table, sequence and type",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftypeacl": {"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"added":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":false}],"grantor":"enterprisedb"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"r","privilege":true,"with_grant":false}], "grantor":"enterprisedb"}],
|
||||||
|
"changed":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]}
|
||||||
|
},
|
||||||
|
"expected_msql_file": "alter_default_db_privileges_all_msql.sql",
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_all.sql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "alter",
|
||||||
|
"name": "Alert default privileges with new user reset all",
|
||||||
|
"endpoint": "NODE-database.obj_id",
|
||||||
|
"sql_endpoint": "NODE-database.sql_id",
|
||||||
|
"msql_endpoint": "NODE-database.msql_id",
|
||||||
|
"TEST_DB_NAME": "<TEST_DB_NAME>",
|
||||||
|
"REPLACE_LOCALE": true,
|
||||||
|
"data": {
|
||||||
|
"deffuncacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"X","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftypeacl": {"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"U","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"deftblacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"D","privilege":true,"with_grant":false}, {"privilege_type":"d","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]},
|
||||||
|
"defseqacl":{
|
||||||
|
"deleted":[{"grantee":"test_default_priv_user","privileges":[{"privilege_type":"w","privilege":true,"with_grant":true}],"grantor":"enterprisedb"}]}
|
||||||
|
},
|
||||||
|
"expected_sql_file": "alter_default_db_privileges_newuser_reset_all.sql",
|
||||||
|
"post_scenario_sql": "DROP ROLE IF EXISTS test_default_priv_user;"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
{% macro APPLY(conn, type, role, privs, with_grant_privs, grantor) -%}
|
{% macro APPLY(conn, type, role, privs, with_grant_privs, grantor) -%}
|
||||||
{% if privs %}
|
{% if privs %}
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}}
|
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}}
|
||||||
GRANT {{ privs|join(', ') }} ON {{ type }} TO {{ role }};
|
GRANT {{ privs|sort|join(', ') }} ON {{ type }} TO {{ role }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if with_grant_privs %}
|
{% if with_grant_privs %}
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}}
|
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}}
|
||||||
GRANT {{ with_grant_privs|join(', ') }} ON {{ type }} TO {{ role }} WITH GRANT OPTION;
|
GRANT {{ with_grant_privs|sort|join(', ') }} ON {{ type }} TO {{ role }} WITH GRANT OPTION;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
{% macro RESETALL(conn, type, role, grantor) -%}
|
{% macro RESETALL(conn, type, role, grantor) -%}
|
||||||
@@ -16,11 +16,11 @@ ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}}
|
|||||||
{% macro SET(conn, db_object_type, db_object_name, type, role, privs, with_grant_privs, grantor) -%}
|
{% macro SET(conn, db_object_type, db_object_name, type, role, privs, with_grant_privs, grantor) -%}
|
||||||
{% if privs %}
|
{% if privs %}
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}} IN {{ db_object_type }} {{ conn|qtIdent(db_object_name) }}
|
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}} IN {{ db_object_type }} {{ conn|qtIdent(db_object_name) }}
|
||||||
GRANT {{ privs|join(', ') }} ON {{ type }} TO {{ role }};
|
GRANT {{ privs|sort|join(', ') }} ON {{ type }} TO {{ role }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if with_grant_privs %}
|
{% if with_grant_privs %}
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}} IN {{ db_object_type }} {{ conn|qtIdent(db_object_name) }}
|
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}} IN {{ db_object_type }} {{ conn|qtIdent(db_object_name) }}
|
||||||
GRANT {{ with_grant_privs|join(', ') }} ON {{ type }} TO {{ role }} WITH GRANT OPTION;
|
GRANT {{ with_grant_privs|sort|join(', ') }} ON {{ type }} TO {{ role }} WITH GRANT OPTION;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
{% macro UNSET(conn, db_object_type, db_object_name, type, role, grantor) -%}
|
{% macro UNSET(conn, db_object_type, db_object_name, type, role, grantor) -%}
|
||||||
@@ -30,9 +30,9 @@ ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}} IN {{ db_object_type }} {{ conn|qt
|
|||||||
|
|
||||||
{% macro REMOVE(conn, type, role, privs, with_grant_privs, grantor) -%}
|
{% macro REMOVE(conn, type, role, privs, with_grant_privs, grantor) -%}
|
||||||
{% if privs %}
|
{% if privs %}
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}} REVOKE {{ privs|join(', ') }} ON {{ type }} FROM {{ role }};
|
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}} REVOKE {{ privs|sort|join(', ') }} ON {{ type }} FROM {{ role }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if with_grant_privs %}
|
{% if with_grant_privs %}
|
||||||
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}} REVOKE {{ with_grant_privs|join(', ') }} ON {{ type }} FROM {{ role }} WITH GRANT OPTION;
|
ALTER DEFAULT PRIVILEGES FOR ROLE {{grantor}} REVOKE {{ with_grant_privs|sort|join(', ') }} ON {{ type }} FROM {{ role }} WITH GRANT OPTION;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
@@ -1280,6 +1280,7 @@ const StyledNotifierMessageBox = styled(Box)(({theme}) => ({
|
|||||||
'& .FormFooter-message': {
|
'& .FormFooter-message': {
|
||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
marginLeft: theme.spacing(0.5),
|
marginLeft: theme.spacing(0.5),
|
||||||
|
whiteSpace: 'pre-line'
|
||||||
},
|
},
|
||||||
'& .FormFooter-messageCenter': {
|
'& .FormFooter-messageCenter': {
|
||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
|
@@ -50,7 +50,7 @@ export function useModal() {
|
|||||||
function AlertContent({ text, confirm, okLabel = gettext('OK'), cancelLabel = gettext('Cancel'), onOkClick, onCancelClick, okIcon = 'default'}) {
|
function AlertContent({ text, confirm, okLabel = gettext('OK'), cancelLabel = gettext('Cancel'), onOkClick, onCancelClick, okIcon = 'default'}) {
|
||||||
return (
|
return (
|
||||||
<StyledBox display="flex" flexDirection="column" height="100%">
|
<StyledBox display="flex" flexDirection="column" height="100%">
|
||||||
<Box flexGrow="1" p={2}>{typeof (text) == 'string' ? HTMLReactParser(text) : text}</Box>
|
<Box flexGrow="1" p={2} whiteSpace='pre-line'>{typeof (text) == 'string' ? HTMLReactParser(text) : text}</Box>
|
||||||
<Box className='Alert-footer'>
|
<Box className='Alert-footer'>
|
||||||
{confirm &&
|
{confirm &&
|
||||||
<DefaultButton startIcon={<CloseIcon />} onClick={onCancelClick}>{cancelLabel}</DefaultButton>
|
<DefaultButton startIcon={<CloseIcon />} onClick={onCancelClick}>{cancelLabel}</DefaultButton>
|
||||||
|
@@ -40,7 +40,6 @@ from pgadmin.utils.master_password import get_crypt_key
|
|||||||
from io import StringIO
|
from io import StringIO
|
||||||
from pgadmin.utils.locker import ConnectionLocker
|
from pgadmin.utils.locker import ConnectionLocker
|
||||||
from pgadmin.utils.driver import get_driver
|
from pgadmin.utils.driver import get_driver
|
||||||
from pgadmin.browser.utils import underscore_escape
|
|
||||||
|
|
||||||
|
|
||||||
# On Windows, Psycopg is not compatible with the default ProactorEventLoop.
|
# On Windows, Psycopg is not compatible with the default ProactorEventLoop.
|
||||||
@@ -1689,7 +1688,6 @@ Failed to reset the connection to the server due to following error:
|
|||||||
# if formatted_msg is false then return from the function
|
# if formatted_msg is false then return from the function
|
||||||
if not formatted_msg:
|
if not formatted_msg:
|
||||||
notices = self.get_notices()
|
notices = self.get_notices()
|
||||||
errmsg = underscore_escape(errmsg).replace('\n', '<br/>')
|
|
||||||
return errmsg if notices == '' else notices + '\n' + errmsg
|
return errmsg if notices == '' else notices + '\n' + errmsg
|
||||||
|
|
||||||
# Do not append if error starts with `ERROR:` as most pg related
|
# Do not append if error starts with `ERROR:` as most pg related
|
||||||
|
@@ -21,6 +21,7 @@ from pgadmin.browser.server_groups.servers.databases.tests import \
|
|||||||
from pgadmin.utils.versioned_template_loader import \
|
from pgadmin.utils.versioned_template_loader import \
|
||||||
get_version_mapping_directories
|
get_version_mapping_directories
|
||||||
from pgadmin.utils.constants import DBMS_JOB_SCHEDULER_ID
|
from pgadmin.utils.constants import DBMS_JOB_SCHEDULER_ID
|
||||||
|
from regression.python_test_utils.test_utils import set_isolation_level
|
||||||
|
|
||||||
|
|
||||||
def create_resql_module_list(all_modules, exclude_pkgs, for_modules):
|
def create_resql_module_list(all_modules, exclude_pkgs, for_modules):
|
||||||
@@ -255,6 +256,10 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator):
|
|||||||
# Check precondition for schema
|
# Check precondition for schema
|
||||||
self.check_schema_precondition(scenario)
|
self.check_schema_precondition(scenario)
|
||||||
|
|
||||||
|
if 'pre_scenario_sql' in scenario:
|
||||||
|
self.execute_prepost_sql(
|
||||||
|
scenario['pre_scenario_sql'], False)
|
||||||
|
|
||||||
# Preprocessed data to replace any place holder if available
|
# Preprocessed data to replace any place holder if available
|
||||||
if 'preprocess_data' in scenario and \
|
if 'preprocess_data' in scenario and \
|
||||||
scenario['preprocess_data'] and 'data' in scenario:
|
scenario['preprocess_data'] and 'data' in scenario:
|
||||||
@@ -363,6 +368,10 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator):
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if 'post_scenario_sql' in scenario:
|
||||||
|
self.execute_prepost_sql(
|
||||||
|
scenario['post_scenario_sql'], False)
|
||||||
|
|
||||||
print(scenario['name'] + "... ok")
|
print(scenario['name'] + "... ok")
|
||||||
except Exception as _:
|
except Exception as _:
|
||||||
print(scenario['name'] + "... FAIL")
|
print(scenario['name'] + "... FAIL")
|
||||||
@@ -599,6 +608,30 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator):
|
|||||||
pg_cursor.close()
|
pg_cursor.close()
|
||||||
return precondition_flag
|
return precondition_flag
|
||||||
|
|
||||||
|
def execute_prepost_sql(self, sql, use_test_config_db_conn):
|
||||||
|
"""
|
||||||
|
This method executes post_condition_sql
|
||||||
|
:param post_condition_sql: SQL query
|
||||||
|
:param use_test_config_db_conn
|
||||||
|
"""
|
||||||
|
if use_test_config_db_conn:
|
||||||
|
conn = self.test_config_db_conn
|
||||||
|
pg_cursor = self.test_config_db_conn.cursor()
|
||||||
|
else:
|
||||||
|
self.get_db_connection()
|
||||||
|
conn = self.connection
|
||||||
|
pg_cursor = self.connection.cursor()
|
||||||
|
|
||||||
|
try:
|
||||||
|
old_isolation_level = conn.isolation_level
|
||||||
|
set_isolation_level(conn, 0)
|
||||||
|
pg_cursor.execute(sql)
|
||||||
|
set_isolation_level(conn, old_isolation_level)
|
||||||
|
conn.commit()
|
||||||
|
except Exception as e:
|
||||||
|
traceback.print_exc()
|
||||||
|
pg_cursor.close()
|
||||||
|
|
||||||
def check_schema_precondition(self, scenario):
|
def check_schema_precondition(self, scenario):
|
||||||
"""
|
"""
|
||||||
This function will check the given schema is exist or not. If exist
|
This function will check the given schema is exist or not. If exist
|
||||||
|
Reference in New Issue
Block a user