Skip to content

Commit 3acd257

Browse files
committed
RHINENG-21214: hotfix manager privileges
1 parent 2d2e059 commit 3acd257

4 files changed

Lines changed: 22 additions & 1 deletion

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
REVOKE UPDATE ON system_inventory FROM manager;
2+
GRANT UPDATE ON system_inventory (stale) TO manager;
3+
4+
REVOKE UPDATE ON system_patch FROM manager;
5+
GRANT UPDATE ON system_patch (
6+
installable_advisory_count_cache,
7+
installable_advisory_enh_count_cache,
8+
installable_advisory_bug_count_cache,
9+
installable_advisory_sec_count_cache,
10+
applicable_advisory_count_cache,
11+
applicable_advisory_enh_count_cache,
12+
applicable_advisory_bug_count_cache,
13+
applicable_advisory_sec_count_cache,
14+
template_id) TO manager;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GRANT UPDATE ON system_inventory TO manager;
2+
GRANT UPDATE ON system_patch TO manager;

database_admin/schema/create_schema.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS schema_migrations
77

88

99
INSERT INTO schema_migrations
10-
VALUES (144, false);
10+
VALUES (145, false);
1111

1212
-- ---------------------------------------------------------------------------
1313
-- Functions
@@ -698,6 +698,7 @@ SELECT create_table_partitions('system_inventory', 16,
698698
GRANT SELECT, INSERT, UPDATE ON system_inventory TO listener;
699699
GRANT SELECT, UPDATE, DELETE ON system_inventory TO vmaas_sync; -- vmaas_sync performs system culling
700700
GRANT SELECT, UPDATE (stale) ON system_inventory TO manager; -- manager needs to be able to update opt_out column
701+
GRANT SELECT, UPDATE ON system_inventory TO manager; -- manager needs to be able to update opt_out column
701702
GRANT SELECT, UPDATE ON system_inventory TO evaluator;
702703

703704
SELECT create_table_partition_triggers('system_inventory_set_last_updated',
@@ -1063,6 +1064,7 @@ GRANT SELECT, UPDATE (installable_advisory_count_cache,
10631064
applicable_advisory_bug_count_cache,
10641065
applicable_advisory_sec_count_cache,
10651066
template_id) ON system_patch TO manager;
1067+
GRANT SELECT, UPDATE ON system_patch TO manager;
10661068
GRANT SELECT, UPDATE, DELETE ON system_patch to vmaas_sync; -- vmaas_sync performs system culling
10671069

10681070
-- system_platform

manager/controllers/template_systems_update.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ func assignTemplateSystems(c *gin.Context, db *gorm.DB, accountID int, template
139139
templateID = &template.ID
140140
}
141141

142+
// TODO: once SystemPlatform model is removed, revoke unnecessary manager privileges to system_inventory and
143+
// system_patch tables. They were granted in migration 145 as a temporary fix to solve system_platform view instead
144+
// of update trigger issues. Hint: have a look at 145_update_manager_privileges.down.sql
142145
tx = tx.Model(models.SystemPlatform{}).
143146
Where("rh_account_id = ? AND inventory_id IN (?::uuid)",
144147
accountID, inventoryIDs).

0 commit comments

Comments
 (0)