Eli Mesika has posted comments on this change.
Change subject: gluster: Added app_mode field to roles table
......................................................................
Patch Set 6: Code-Review-1
(6 comments)
....................................................
File packaging/dbscripts/multi_level_administration_sp.sql
Line 250: AS $procedure$
Line 251: BEGIN
Line 252: RETURN QUERY SELECT *
Line 253: FROM roles
Line 254: WHERE roles.app_mode & v_app_mode > 0;
Improper operator
should be
WHERE roles.app_mode AND v_app_mode > 0;
Line 255:
Line 256: END; $procedure$
Line 257: LANGUAGE plpgsql;
Line 258:
Line 293: BEGIN
Line 294: RETURN QUERY SELECT roles.*
Line 295: FROM roles INNER JOIN
Line 296: permissions ON permissions.role_id = roles.id
Line 297: WHERE roles.app_mode & v_app_mode > 0
Improper operator
should be
WHERE roles.app_mode AND v_app_mode > 0;
Line 298: AND (permissions.ad_element_id = v_user_id
Line 299: or permissions.ad_element_id in(select id from
getElementIdsByIdAndGroups(v_user_id, v_group_ids)));
Line 300:
Line 301: END; $procedure$
....................................................
File packaging/dbscripts/upgrade/03_03_0800_add_app_mode_to_roles.sql
Line 1: -- adding app_mode column to roles table to store the application mode
for which the said role is meant for.
comment is not clear ;
...for which the said role is meant for...
Line 2: -- Following is the detail of application modes
Line 3: -- Virt - 1
Line 4: -- Gluster - 2
Line 5: -- All - 255
Line 1: -- adding app_mode column to roles table to store the application mode
for which the said role is meant for.
Line 2: -- Following is the detail of application modes
Application Modes:
Line 3: -- Virt - 1
Line 4: -- Gluster - 2
Line 5: -- All - 255
Line 6: select fn_db_add_column('roles', 'app_mode', 'INTEGER');
Line 6: select fn_db_add_column('roles', 'app_mode', 'INTEGER');
Line 7:
Line 8: UPDATE roles SET app_mode=1 WHERE name in ('UserRole', 'PowerUserRole',
'DataCenterAdmin', 'StorageAdmin', 'UserVmManager', 'VmPoolAdmin',
'TemplateAdmin', 'TemplateUser', 'QuotaConsumer', 'TemplateOwner',
'DiskOperator', 'DiskCreator', 'VmCreator', 'TemplateCreator',
'VnicProfileUser');
Line 9: UPDATE roles SET app_mode=2 WHERE name='GlusterAdmin';
Line 10: UPDATE roles SET app_mode=255 WHERE name in ('ClusterAdmin',
'SuperUser', 'HostAdmin', 'NetworkAdmin', 'ExternalEventsCreator',
'ExternalTasksCreator');
Use one update statement with CASE WHEN
see example in
http://www.postgresql.org/message-id/[email protected]
Line 11:
Line 12: -- Create the constraint
Line 13: ALTER TABLE roles ALTER COLUMN app_mode SET NOT NULL;
Line 14:
Line 12: -- Create the constraint
Line 13: ALTER TABLE roles ALTER COLUMN app_mode SET NOT NULL;
Line 14:
Line 15: -- Create the index
Line 16: DROP INDEX if exists IDX_roles__app_mode;
No need to drop , scripts are not re-entrant
--
To view, visit http://gerrit.ovirt.org/18592
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Id83b7a2c90100744487b276642158e7c3e93de85
Gerrit-PatchSet: 6
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shubhendu Tripathi <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: Kanagaraj M <[email protected]>
Gerrit-Reviewer: Sahina Bose <[email protected]>
Gerrit-Reviewer: Shubhendu Tripathi <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches