Skip to content

Commit d88f1fd

Browse files
caseysoftwareclaude
andcommitted
Remove duplicate gacl_axo rows so User and Calendar permissions can be granted
Migrations 048 (admin to users) and 049 (calendar to events) renamed gacl_axo rows onto values that already existed, and 012 had dropped the unique index that would have blocked it. A fresh install ends up with two app/users rows and two app/events rows. phpGACL treats a section/value pair that matches more than one row as missing, so adding "User Administration", "User Table", "Calendar" or "Events" to a role fails with: add_acl(): AXO Object Section Value: app Value: users DOES NOT exist in the database. Skipping... Migration 064 keeps the lowest id of each duplicate (User Administration, Calendar), removes the other from gacl_groups_axo_map and gacl_axo, and restores the unique (section_value, value) index. Fixes #385 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016CP89WVmGZ1VVCCZMS6ntN
1 parent 5ff78db commit d88f1fd

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- Migrations 048 (admin to users) and 049 (calendar to events) renamed gacl_axo
2+
-- rows onto values that already existed, and 012 had dropped the unique index
3+
-- that would have stopped it. Every install therefore has two app/users rows
4+
-- (User Administration and User Table) and two app/events rows (Calendar and
5+
-- Events). phpGACL treats a section/value pair that matches more than one row
6+
-- as missing, so permissions for those modules cannot be granted to a role.
7+
-- Keep the lowest id of each duplicate and restore the uniqueness.
8+
-- https://github.com/web2project/web2project/issues/385
9+
10+
DELETE m FROM `gacl_groups_axo_map` m
11+
JOIN `gacl_axo` dup ON dup.`id` = m.`axo_id`
12+
JOIN `gacl_axo` keep ON keep.`section_value` = dup.`section_value`
13+
AND keep.`value` = dup.`value`
14+
AND keep.`id` < dup.`id`;
15+
16+
DELETE dup FROM `gacl_axo` dup
17+
JOIN `gacl_axo` keep ON keep.`section_value` = dup.`section_value`
18+
AND keep.`value` = dup.`value`
19+
AND keep.`id` < dup.`id`;
20+
21+
ALTER TABLE `gacl_axo` ADD UNIQUE KEY `gacl_section_value_value_axo` (`section_value`, `value`);

0 commit comments

Comments
 (0)