Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

BEGIN;

DROP SCHEMA collections_public;
DROP SCHEMA collections_public CASCADE;

COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

BEGIN;

DROP ROLE administrator;
DO $revert$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may be one of the things we don't want to revert and make a note of... not sure yet. could conflict w the test framework itself.

BEGIN
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'administrator') THEN
REVOKE anonymous FROM administrator;
REVOKE authenticated FROM administrator;
REASSIGN OWNED BY administrator TO CURRENT_USER;
DROP OWNED BY administrator CASCADE;
BEGIN
DROP ROLE administrator;
EXCEPTION
WHEN dependent_objects_still_exist THEN
RAISE NOTICE 'Skipping drop of administrator role because dependent objects remain elsewhere';
END;
END IF;
END;
$revert$;

COMMIT;
15 changes: 14 additions & 1 deletion packages/security/default-roles/revert/roles/anonymous/role.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

BEGIN;

DROP ROLE anonymous;
DO $revert$
BEGIN
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'anonymous') THEN
REASSIGN OWNED BY anonymous TO CURRENT_USER;
DROP OWNED BY anonymous CASCADE;
BEGIN
DROP ROLE anonymous;
EXCEPTION
WHEN dependent_objects_still_exist THEN
RAISE NOTICE 'Skipping drop of anonymous role because dependent objects remain elsewhere';
END;
END IF;
END;
$revert$;

COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

BEGIN;

DROP ROLE authenticated;
DO $revert$
BEGIN
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'authenticated') THEN
REASSIGN OWNED BY authenticated TO CURRENT_USER;
DROP OWNED BY authenticated CASCADE;
BEGIN
DROP ROLE authenticated;
EXCEPTION
WHEN dependent_objects_still_exist THEN
RAISE NOTICE 'Skipping drop of authenticated role because dependent objects remain elsewhere';
END;
END IF;
END;
$revert$;

COMMIT;
15 changes: 14 additions & 1 deletion packages/utils/verify/deploy/procedures/verify_function.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,26 @@ CREATE FUNCTION verify_function (_name text, _user text DEFAULT NULL)
AS $$
DECLARE
check_user text;
func_oid oid;
BEGIN
IF (_user IS NOT NULL) THEN
check_user = _user;
ELSE
check_user = CURRENT_USER;
END IF;
IF position('(' IN _name) > 0 THEN
func_oid = to_regprocedure(_name);
IF func_oid IS NULL THEN
RAISE EXCEPTION 'Nonexistent function --> %', _name
USING HINT = 'Please check';
END IF;
IF has_function_privilege(check_user, func_oid, 'execute') THEN
RETURN TRUE;
ELSE
RAISE EXCEPTION 'Nonexistent function --> %', _name
USING HINT = 'Please check';
END IF;
END IF;
IF EXISTS (
SELECT
has_function_privilege(check_user, p.oid, 'execute')
Expand All @@ -34,4 +48,3 @@ $$
LANGUAGE 'plpgsql'
IMMUTABLE;
COMMIT;

2 changes: 1 addition & 1 deletion scripts/test-all-packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function runPgpmCommand(command, dbname, packageName, packagePath, projectRoot)
return result.success;
}

async function testPackage(packagePath, projectRoot, useDocker) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only change that represents the title of the PR

function testPackage(packagePath, projectRoot, useDocker) {
const packageName = path.basename(packagePath);
const dbname = dbsafename(packagePath);

Expand Down
Loading