# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:admin'

# events[].sql_query.sql
SELECT * FROM "resources" WHERE "resource_id" = 'cucumber:policy:root'

# events[].sql_query.sql
INSERT INTO "roles" ("role_id") VALUES ('cucumber:policy:root') RETURNING *

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:admin'

# events[].sql_query.sql
SELECT * FROM "resources" WHERE "resource_id" = 'cucumber:policy:root'

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:admin'

# events[].sql_query.sql
INSERT INTO "policy_versions" ("role_id", "resource_id", "policy_text", "policy_sha256") VALUES ('cucumber:user:admin', 'cucumber:policy:root', '- !user alice
- !user bob

- !policy
  id: dev
  body:     
  - !group developers

- !grant
  role: !group dev/developers
  member: !user alice

- !permit
  resource: !policy root
  privileges: [ create, update ]
  roles: !user alice', '794bdcc7d5fa4ca0e44a4b170b2363c39bec892056c16a4b8b899b0a60b136d5') RETURNING *

# events[].sql_query.sql
SELECT CAST(current_schemas(false) AS varchar[]) LIMIT 1

# events[].parameters[].value
Grant group 'dev/developers' to user 'alice'

# events[].sql_query.sql
CREATE TABLE roles AS SELECT * FROM public.roles WHERE 0 = 1

# events[].sql_query.sql
CREATE TABLE role_memberships AS SELECT * FROM public.role_memberships WHERE 0 = 1

# events[].sql_query.sql
CREATE TABLE resources AS SELECT * FROM public.resources WHERE 0 = 1

# events[].sql_query.sql
CREATE TABLE permissions AS SELECT * FROM public.permissions WHERE 0 = 1

# events[].sql_query.sql
CREATE TABLE annotations AS SELECT * FROM public.annotations WHERE 0 = 1

# events[].return_value.value
      -- Deletes the role_memberships record with the indicated role and grantee (owner). The recor

# events[].sql_query.sql
      -- Deletes the role_memberships record with the indicated role and grantee (owner). The record may 
      -- not exist, if the resource with the indicated owner does not have a corresponding role.
      CREATE OR REPLACE FUNCTION delete_role_membership_of_owner(role_id text, owner_id text) RETURNS int
      LANGUAGE plpgsql
      AS $$
      DECLARE
        row_count int;
      BEGIN
        DELETE FROM role_memberships rm
          WHERE rm.role_id = $1 AND
            member_id = $2 AND
            ownership = true;
        GET DIAGNOSTICS row_count = ROW_COUNT;
        RETURN row_count;
      END
      $$;

      -- Inserts a role_memberships record with the indicated role and grantee (owner). If the
      -- role indicated by the role_id does not exist, then no insertion is performed.
      CREATE OR REPLACE FUNCTION grant_role_membership_to_owner(role_id text, owner_id text) RETURNS int
      LANGUAGE plpgsql
      AS $$
      DECLARE
        rolsource_role roles%rowtype;
        existing_grant role_memberships%rowtype;
      BEGIN
        SELECT * INTO rolsource_role FROM roles WHERE roles.role_id = $1;
        IF FOUND THEN
          SELECT * INTO existing_grant FROM role_memberships rm WHERE rm.role_id = $1 AND rm.member_id = $2 AND rm.admin_option = true AND rm.ownership = true;
          IF NOT FOUND THEN
            INSERT INTO role_memberships ( role_id, member_id, admin_option, ownership )
              VALUES ( $1, $2, true, true );
            RETURN 1;
          END IF;
        END IF;
        RETURN 0;
      END
      $$;

      CREATE OR REPLACE FUNCTION grant_role_membership_to_owner_trigger() RETURNS trigger
      LANGUAGE plpgsql
      AS $$
      BEGIN
        PERFORM grant_role_membership_to_owner(NEW.resource_id, NEW.owner_id);
        RETURN NEW;
      END
      $$;

      CREATE OR REPLACE FUNCTION update_role_membership_of_owner_trigger() RETURNS trigger
      LANGUAGE plpgsql
      AS $$
      BEGIN
        IF OLD.owner_id != NEW.owner_id THEN
          PERFORM delete_role_membership_of_owner(OLD.resource_id, OLD.owner_id);
          PERFORM grant_role_membership_to_owner(OLD.resource_id, NEW.owner_id);
        END IF;
        RETURN NEW;
      END
      $$;

      CREATE OR REPLACE FUNCTION delete_role_membership_of_owner_trigger() RETURNS trigger
      LANGUAGE plpgsql
      AS $$
      BEGIN
        PERFORM delete_role_membership_of_owner(OLD.resource_id, OLD.owner_id);

        RETURN OLD;
      END
      $$;

      CREATE TRIGGER grant_role_membership_to_owner
      BEFORE INSERT
      ON resources
      FOR EACH ROW
      EXECUTE PROCEDURE grant_role_membership_to_owner_trigger();

      CREATE TRIGGER update_role_membership_of_owner
      BEFORE UPDATE
      ON resources
      FOR EACH ROW
      EXECUTE PROCEDURE update_role_membership_of_owner_trigger();

      CREATE TRIGGER delete_role_membership_of_owner
      BEFORE DELETE
      ON resources
      FOR EACH ROW
      EXECUTE PROCEDURE delete_role_membership_of_owner_trigger();

# events[].sql_query.sql
      CREATE OR REPLACE FUNCTION account(id text) RETURNS text
      LANGUAGE sql IMMUTABLE
      AS $$
      SELECT CASE 
        WHEN split_part($1, ':', 1) = '' THEN NULL 
        ELSE split_part($1, ':', 1)
      END
      $$;

# events[].sql_query.sql
ALTER TABLE resources ADD PRIMARY KEY ( resource_id )

# events[].sql_query.sql
ALTER TABLE roles ADD PRIMARY KEY ( role_id )

# events[].sql_query.sql
ALTER TABLE role_memberships ALTER COLUMN admin_option SET DEFAULT 'f'

# events[].sql_query.sql
INSERT INTO "roles" ("role_id") VALUES ('cucumber:user:alice') RETURNING *

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:admin'

# events[].sql_query.sql
SELECT * FROM "public"."roles" WHERE "role_id" = 'cucumber:user:admin'

# events[].sql_query.sql
INSERT INTO "roles" ("role_id") VALUES ('cucumber:user:bob') RETURNING *

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:admin'

# events[].sql_query.sql
SELECT * FROM "public"."roles" WHERE "role_id" = 'cucumber:user:admin'

# events[].sql_query.sql
INSERT INTO "roles" ("role_id") VALUES ('cucumber:policy:dev') RETURNING *

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:admin'

# events[].sql_query.sql
SELECT * FROM "public"."roles" WHERE "role_id" = 'cucumber:user:admin'

# events[].sql_query.sql
INSERT INTO "roles" ("role_id") VALUES ('cucumber:group:dev/developers') RETURNING *

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:policy:dev'

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:group:dev/developers'

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:alice'

# events[].sql_query.sql
SELECT * FROM "resources" WHERE "resource_id" = 'cucumber:policy:root'

# events[].sql_query.sql
SELECT * FROM "public"."resources" WHERE "resource_id" = 'cucumber:policy:root'

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:alice'

# events[].sql_query.sql
SELECT * FROM "resources" WHERE "resource_id" = 'cucumber:policy:root'

# events[].sql_query.sql
SELECT * FROM "public"."resources" WHERE "resource_id" = 'cucumber:policy:root'

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:alice'

# events[].sql_query.sql
UPDATE "role_memberships" SET "admin_option" = false WHERE ("admin_option" IS NULL)

# events[].sql_query.sql
UPDATE "role_memberships" SET "ownership" = false WHERE ("ownership" IS NULL)

# events[].sql_query.sql
UPDATE "roles" SET "policy_id" = 'cucumber:policy:root'

# events[].sql_query.sql
UPDATE "resources" SET "policy_id" = 'cucumber:policy:root'

# events[].sql_query.sql
          WITH deleted_records AS (
            SELECT existing_roles.*
            FROM public.roles AS existing_roles
            LEFT OUTER JOIN roles AS new_roles
              ON existing_roles.role_id = new_roles.role_id AND existing_roles.policy_id = new_roles.policy_id
            WHERE existing_roles.policy_id = 'cucumber:policy:root' AND new_roles.role_id IS NULL
          )
          DELETE FROM public.roles
          USING deleted_records AS deleted_from_roles
          WHERE public.roles.role_id = deleted_from_roles.role_id AND public.roles.policy_id = deleted_from_roles.policy_id

# events[].sql_query.sql
          WITH deleted_records AS (
            SELECT existing_role_memberships.*
            FROM public.role_memberships AS existing_role_memberships
            LEFT OUTER JOIN role_memberships AS new_role_memberships
              ON existing_role_memberships.role_id = new_role_memberships.role_id AND existing_role_memberships.member_id = new_role_memberships.member_id AND existing_role_memberships.ownership = new_role_memberships.ownership AND existing_role_memberships.policy_id = new_role_memberships.policy_id
            WHERE existing_role_memberships.policy_id = 'cucumber:policy:root' AND new_role_memberships.role_id IS NULL
          )
          DELETE FROM public.role_memberships
          USING deleted_records AS deleted_from_role_memberships
          WHERE public.role_memberships.role_id = deleted_from_role_memberships.role_id AND public.role_memberships.member_id = deleted_from_role_memberships.member_id AND public.role_memberships.ownership = deleted_from_role_memberships.ownership AND public.role_memberships.policy_id = deleted_from_role_memberships.policy_id

# events[].sql_query.sql
          WITH deleted_records AS (
            SELECT existing_resources.*
            FROM public.resources AS existing_resources
            LEFT OUTER JOIN resources AS new_resources
              ON existing_resources.resource_id = new_resources.resource_id AND existing_resources.policy_id = new_resources.policy_id
            WHERE existing_resources.policy_id = 'cucumber:policy:root' AND new_resources.resource_id IS NULL
          )
          DELETE FROM public.resources
          USING deleted_records AS deleted_from_resources
          WHERE public.resources.resource_id = deleted_from_resources.resource_id AND public.resources.policy_id = deleted_from_resources.policy_id

# events[].sql_query.sql
          WITH deleted_records AS (
            SELECT existing_permissions.*
            FROM public.permissions AS existing_permissions
            LEFT OUTER JOIN permissions AS new_permissions
              ON existing_permissions.privilege = new_permissions.privilege AND existing_permissions.resource_id = new_permissions.resource_id AND existing_permissions.role_id = new_permissions.role_id AND existing_permissions.policy_id = new_permissions.policy_id
            WHERE existing_permissions.policy_id = 'cucumber:policy:root' AND new_permissions.privilege IS NULL
          )
          DELETE FROM public.permissions
          USING deleted_records AS deleted_from_permissions
          WHERE public.permissions.privilege = deleted_from_permissions.privilege AND public.permissions.resource_id = deleted_from_permissions.resource_id AND public.permissions.role_id = deleted_from_permissions.role_id AND public.permissions.policy_id = deleted_from_permissions.policy_id

# events[].sql_query.sql
          WITH deleted_records AS (
            SELECT existing_annotations.*
            FROM public.annotations AS existing_annotations
            LEFT OUTER JOIN annotations AS new_annotations
              ON existing_annotations.resource_id = new_annotations.resource_id AND existing_annotations.name = new_annotations.name AND existing_annotations.policy_id = new_annotations.policy_id
            WHERE existing_annotations.policy_id = 'cucumber:policy:root' AND new_annotations.resource_id IS NULL
          )
          DELETE FROM public.annotations
          USING deleted_records AS deleted_from_annotations
          WHERE public.annotations.resource_id = deleted_from_annotations.resource_id AND public.annotations.name = deleted_from_annotations.name AND public.annotations.policy_id = deleted_from_annotations.policy_id

# events[].sql_query.sql
          DELETE FROM roles new_roles
          USING public.roles old_roles
          WHERE new_roles.role_id = old_roles.role_id AND
            ( old_roles.policy_id IS NULL OR old_roles.policy_id != new_roles.policy_id )

# events[].sql_query.sql
          DELETE FROM role_memberships new_role_memberships
          USING public.role_memberships old_role_memberships
          WHERE new_role_memberships.role_id = old_role_memberships.role_id AND new_role_memberships.member_id = old_role_memberships.member_id AND new_role_memberships.ownership = old_role_memberships.ownership AND
            ( old_role_memberships.policy_id IS NULL OR old_role_memberships.policy_id != new_role_memberships.policy_id )

# events[].sql_query.sql
          DELETE FROM resources new_resources
          USING public.resources old_resources
          WHERE new_resources.resource_id = old_resources.resource_id AND
            ( old_resources.policy_id IS NULL OR old_resources.policy_id != new_resources.policy_id )

# events[].sql_query.sql
          DELETE FROM permissions new_permissions
          USING public.permissions old_permissions
          WHERE new_permissions.privilege = old_permissions.privilege AND new_permissions.resource_id = old_permissions.resource_id AND new_permissions.role_id = old_permissions.role_id AND
            ( old_permissions.policy_id IS NULL OR old_permissions.policy_id != new_permissions.policy_id )

# events[].sql_query.sql
          DELETE FROM annotations new_annotations
          USING public.annotations old_annotations
          WHERE new_annotations.resource_id = old_annotations.resource_id AND new_annotations.name = old_annotations.name AND
            ( old_annotations.policy_id IS NULL OR old_annotations.policy_id != new_annotations.policy_id )

# events[].sql_query.sql
        DELETE FROM roles new_roles
        USING public.roles old_roles
        WHERE new_roles.role_id = old_roles.role_id AND new_roles.policy_id = old_roles.policy_id

# events[].sql_query.sql
        DELETE FROM resources new_resources
        USING public.resources old_resources
        WHERE new_resources.resource_id = old_resources.resource_id AND new_resources.owner_id = old_resources.owner_id AND new_resources.policy_id = old_resources.policy_id

# events[].sql_query.sql
        DELETE FROM role_memberships new_role_memberships
        USING public.role_memberships old_role_memberships
        WHERE new_role_memberships.role_id = old_role_memberships.role_id AND new_role_memberships.member_id = old_role_memberships.member_id AND new_role_memberships.admin_option = old_role_memberships.admin_option AND new_role_memberships.ownership = old_role_memberships.ownership AND new_role_memberships.policy_id = old_role_memberships.policy_id

# events[].sql_query.sql
        DELETE FROM permissions new_permissions
        USING public.permissions old_permissions
        WHERE new_permissions.resource_id = old_permissions.resource_id AND new_permissions.privilege = old_permissions.privilege AND new_permissions.role_id = old_permissions.role_id AND new_permissions.policy_id = old_permissions.policy_id

# events[].sql_query.sql
        DELETE FROM annotations new_annotations
        USING public.annotations old_annotations
        WHERE new_annotations.resource_id = old_annotations.resource_id AND new_annotations.name = old_annotations.name AND new_annotations.value = old_annotations.value AND new_annotations.policy_id = old_annotations.policy_id

# events[].sql_query.sql
            UPDATE role_memberships
            SET admin_option = new_role_memberships.admin_option
            FROM policy_loader_99385d59b10bed24.role_memberships new_role_memberships
            WHERE role_memberships.role_id = new_role_memberships.role_id AND role_memberships.member_id = new_role_memberships.member_id AND role_memberships.ownership = new_role_memberships.ownership AND role_memberships.policy_id = new_role_memberships.policy_id

# events[].sql_query.sql
            UPDATE resources
            SET owner_id = new_resources.owner_id
            FROM policy_loader_99385d59b10bed24.resources new_resources
            WHERE resources.resource_id = new_resources.resource_id AND resources.policy_id = new_resources.policy_id

# events[].sql_query.sql
            UPDATE annotations
            SET value = new_annotations.value
            FROM policy_loader_99385d59b10bed24.annotations new_annotations
            WHERE annotations.resource_id = new_annotations.resource_id AND annotations.name = new_annotations.name AND annotations.policy_id = new_annotations.policy_id

# events[].sql_query.sql
        DELETE FROM roles new_roles
        USING public.roles old_roles
        WHERE new_roles.role_id = old_roles.role_id AND new_roles.policy_id = old_roles.policy_id

# events[].sql_query.sql
        DELETE FROM role_memberships new_role_memberships
        USING public.role_memberships old_role_memberships
        WHERE new_role_memberships.role_id = old_role_memberships.role_id AND new_role_memberships.member_id = old_role_memberships.member_id AND new_role_memberships.ownership = old_role_memberships.ownership AND new_role_memberships.policy_id = old_role_memberships.policy_id

# events[].sql_query.sql
        DELETE FROM resources new_resources
        USING public.resources old_resources
        WHERE new_resources.resource_id = old_resources.resource_id AND new_resources.policy_id = old_resources.policy_id

# events[].sql_query.sql
        DELETE FROM permissions new_permissions
        USING public.permissions old_permissions
        WHERE new_permissions.privilege = old_permissions.privilege AND new_permissions.resource_id = old_permissions.resource_id AND new_permissions.role_id = old_permissions.role_id AND new_permissions.policy_id = old_permissions.policy_id

# events[].sql_query.sql
        DELETE FROM annotations new_annotations
        USING public.annotations old_annotations
        WHERE new_annotations.resource_id = old_annotations.resource_id AND new_annotations.name = old_annotations.name AND new_annotations.policy_id = old_annotations.policy_id

# events[].sql_query.sql
INSERT INTO roles ( role_id, policy_id ) SELECT role_id, policy_id FROM policy_loader_99385d59b10bed24.roles

# events[].sql_query.sql
          INSERT INTO policy_log(
            policy_id, 
            version,
            operation, 
            kind, 
            subject)
          SELECT
          (policy_log_record(
            'roles',
            ARRAY['role_id'],
            hstore(roles),
            'cucumber:policy:root',
            1,
            'INSERT'
            )).*
          FROM
          policy_loader_99385d59b10bed24.roles

# events[].sql_query.sql
INSERT INTO role_memberships ( role_id, member_id, admin_option, ownership, policy_id ) SELECT role_id, member_id, admin_option, ownership, policy_id FROM policy_loader_99385d59b10bed24.role_memberships

# events[].sql_query.sql
          INSERT INTO policy_log(
            policy_id, 
            version,
            operation, 
            kind, 
            subject)
          SELECT
          (policy_log_record(
            'role_memberships',
            ARRAY['role_id','member_id','ownership'],
            hstore(role_memberships),
            'cucumber:policy:root',
            1,
            'INSERT'
            )).*
          FROM
          policy_loader_99385d59b10bed24.role_memberships

# events[].sql_query.sql
INSERT INTO resources ( resource_id, owner_id, policy_id ) SELECT resource_id, owner_id, policy_id FROM policy_loader_99385d59b10bed24.resources

# events[].sql_query.sql
          INSERT INTO policy_log(
            policy_id, 
            version,
            operation, 
            kind, 
            subject)
          SELECT
          (policy_log_record(
            'resources',
            ARRAY['resource_id'],
            hstore(resources),
            'cucumber:policy:root',
            1,
            'INSERT'
            )).*
          FROM
          policy_loader_99385d59b10bed24.resources

# events[].sql_query.sql
INSERT INTO permissions ( resource_id, privilege, role_id, policy_id ) SELECT resource_id, privilege, role_id, policy_id FROM policy_loader_99385d59b10bed24.permissions

# events[].sql_query.sql
          INSERT INTO policy_log(
            policy_id, 
            version,
            operation, 
            kind, 
            subject)
          SELECT
          (policy_log_record(
            'permissions',
            ARRAY['privilege','resource_id','role_id'],
            hstore(permissions),
            'cucumber:policy:root',
            1,
            'INSERT'
            )).*
          FROM
          policy_loader_99385d59b10bed24.permissions

# events[].sql_query.sql
INSERT INTO annotations ( resource_id, name, value, policy_id ) SELECT resource_id, name, value, policy_id FROM policy_loader_99385d59b10bed24.annotations

# events[].sql_query.sql
          INSERT INTO policy_log(
            policy_id, 
            version,
            operation, 
            kind, 
            subject)
          SELECT
          (policy_log_record(
            'annotations',
            ARRAY['resource_id','name'],
            hstore(annotations),
            'cucumber:policy:root',
            1,
            'INSERT'
            )).*
          FROM
          policy_loader_99385d59b10bed24.annotations

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:alice'

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:bob'

# events[].sql_query.sql
SELECT * FROM "policy_log" WHERE (("policy_log"."policy_id" = 'cucumber:policy:root') AND ("policy_log"."version" = 1))

# events[].return_value.value
 added ownership of cucumber:user:admin in cucumber:user:alice

# events[].parameters[].value
 added ownership of cucumber:user:admin in cucumber:user:alice

# events[].receiver.value
 added ownership of cucumber:user:admin in cucumber:user:alice

# events[].receiver.value
 added ownership of cucumber:user:admin in cucumber:user:alice

# events[].receiver.value
 added ownership of cucumber:user:admin in cucumber:user:alice

# events[].return_value.value
 added ownership of cucumber:user:admin in cucumber:user:alice

# events[].return_value.value
 added ownership of cucumber:user:admin in cucumber:user:alice

# events[].return_value.value
 added ownership of cucumber:user:admin in cucumber:user:bob

# events[].parameters[].value
 added ownership of cucumber:user:admin in cucumber:user:bob

# events[].receiver.value
 added ownership of cucumber:user:admin in cucumber:user:bob

# events[].receiver.value
 added ownership of cucumber:user:admin in cucumber:user:bob

# events[].receiver.value
 added ownership of cucumber:user:admin in cucumber:user:bob

# events[].return_value.value
 added ownership of cucumber:user:admin in cucumber:user:bob

# events[].return_value.value
 added ownership of cucumber:user:admin in cucumber:user:bob

# events[].return_value.value
 added ownership of cucumber:user:admin in cucumber:policy:dev

# events[].parameters[].value
 added ownership of cucumber:user:admin in cucumber:policy:dev

# events[].receiver.value
 added ownership of cucumber:user:admin in cucumber:policy:dev

# events[].receiver.value
 added ownership of cucumber:user:admin in cucumber:policy:dev

# events[].receiver.value
 added ownership of cucumber:user:admin in cucumber:policy:dev

# events[].return_value.value
 added ownership of cucumber:user:admin in cucumber:policy:dev

# events[].return_value.value
 added ownership of cucumber:user:admin in cucumber:policy:dev

# events[].return_value.value
 added ownership of cucumber:policy:dev in cucumber:group:dev/developers

# events[].parameters[].value
 added ownership of cucumber:policy:dev in cucumber:group:dev/developers

# events[].receiver.value
 added ownership of cucumber:policy:dev in cucumber:group:dev/developers

# events[].receiver.value
 added ownership of cucumber:policy:dev in cucumber:group:dev/developers

# events[].receiver.value
 added ownership of cucumber:policy:dev in cucumber:group:dev/developers

# events[].return_value.value
 added ownership of cucumber:policy:dev in cucumber:group:dev/developers

# events[].return_value.value
 added ownership of cucumber:policy:dev in cucumber:group:dev/developers

# events[].return_value.value
permission of cucumber:user:alice to create on cucumber:policy:root

# events[].return_value.value
 added permission of cucumber:user:alice to create on cucumber:policy:root

# events[].parameters[].value
 added permission of cucumber:user:alice to create on cucumber:policy:root

# events[].receiver.value
 added permission of cucumber:user:alice to create on cucumber:policy:root

# events[].receiver.value
 added permission of cucumber:user:alice to create on cucumber:policy:root

# events[].receiver.value
 added permission of cucumber:user:alice to create on cucumber:policy:root

# events[].receiver.value
permission of cucumber:user:alice to create on cucumber:policy:root

# events[].return_value.value
permission of cucumber:user:alice to create on cucumber:policy:root

# events[].return_value.value
 added permission of cucumber:user:alice to create on cucumber:policy:root

# events[].return_value.value
 added permission of cucumber:user:alice to create on cucumber:policy:root

# events[].return_value.value
permission of cucumber:user:alice to update on cucumber:policy:root

# events[].return_value.value
 added permission of cucumber:user:alice to update on cucumber:policy:root

# events[].parameters[].value
 added permission of cucumber:user:alice to update on cucumber:policy:root

# events[].receiver.value
 added permission of cucumber:user:alice to update on cucumber:policy:root

# events[].receiver.value
 added permission of cucumber:user:alice to update on cucumber:policy:root

# events[].receiver.value
 added permission of cucumber:user:alice to update on cucumber:policy:root

# events[].receiver.value
permission of cucumber:user:alice to update on cucumber:policy:root

# events[].return_value.value
permission of cucumber:user:alice to update on cucumber:policy:root

# events[].return_value.value
 added permission of cucumber:user:alice to update on cucumber:policy:root

# events[].return_value.value
 added permission of cucumber:user:alice to update on cucumber:policy:root

# events[].sql_query.sql
SELECT * FROM "credentials" WHERE ("credentials"."role_id" = 'cucumber:user:alice') LIMIT 1

# events[].sql_query.sql
SELECT * FROM "credentials" WHERE ("credentials"."role_id" = 'cucumber:user:bob') LIMIT 1

# events[].sql_query.sql
SELECT * FROM "roles" WHERE "role_id" = 'cucumber:user:bob'

# events[].sql_query.sql
SELECT * FROM "resources" WHERE "resource_id" = 'cucumber:group:dev/developers'

# events[].sql_query.sql
SELECT * FROM "resources" WHERE "resource_id" = 'cucumber:policy:root'

# metadata.feature
Manage the role entitlements through the API