Moti Asayag has uploaded a new change for review. Change subject: core: Add function for adding action group to a role ......................................................................
core: Add function for adding action group to a role A function for adding an action group to a role is added to the commons functions so it could be reused within upgrade scripts extending existing roles. Change-Id: I1640da5f7e79f1f038c330b605489ad41145f36e Signed-off-by: Moti Asayag <[email protected]> --- M backend/manager/dbscripts/common_sp.sql 1 file changed, 17 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/32/9832/1 diff --git a/backend/manager/dbscripts/common_sp.sql b/backend/manager/dbscripts/common_sp.sql index 5104838..c90c782 100644 --- a/backend/manager/dbscripts/common_sp.sql +++ b/backend/manager/dbscripts/common_sp.sql @@ -288,6 +288,23 @@ LANGUAGE plpgsql; + +-- a method for adding an action group to a role if doesn't exist +CREATE OR REPLACE FUNCTION add_action_group_to_role(v_role_id UUID, v_action_group_id INTEGER) +RETURNS VOID +AS $procedure$ +BEGIN + INSERT INTO roles_groups(role_id,action_group_id) + SELECT v_role_id, v_action_group_id + WHERE NOT EXISTS (SELECT 1 + FROM roles_groups + WHERE role_id = v_role_id + AND action_group_id = v_action_group_id); +RETURN; +END; $procedure$ +LANGUAGE plpgsql; + + -- This function splits a config value: given a config value with one row for 'general', it creates new options -- with the old value, for each version, except the v_update_from_version version and beyond, which gets the input value CREATE OR REPLACE FUNCTION fn_db_split_config_value(v_option_name character varying, v_old_option_value character varying, v_new_option_value character varying, v_update_from_version character varying) -- To view, visit http://gerrit.ovirt.org/9832 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1640da5f7e79f1f038c330b605489ad41145f36e Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
