Skip to content

[3.0] Loads the permission profiles in the order they were made again - #9715

Merged
jdarwood007 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/permission-profile-order
Oct 4, 2026
Merged

jdarwood007 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/permission-profile-order

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

On PostgreSQL the permission profiles come out in no particular order: in the list under Permissions → Profiles, and in the profile and "copy from" selects on the board and profile pages.

2.1 loaded them ORDER BY id_profile. In 3.0, PermissionProfile::loadAll() joins the boards so each profile knows which boards use it, and the ORDER BY did not survive the change. MySQL happens to return InnoDB rows in primary key order, so it still looked right there. PostgreSQL returns rows in the order they sit in the table, and an UPDATE writes a row's new version at the end, so renaming a profile moves it to the bottom of every list.

The query now orders by profile, and by board within a profile, so each profile's list of boards is in a stable order too.

Test

PermissionProfileTest rewrites the default profile's row, inside the transaction the integration suite rolls back, and checks loadAll() returns the profiles in id order. The rewrite is what makes PostgreSQL misorder them; on MySQL the test passes either way. loadAll() caches in a private static, which the test empties by reflection before and after. Without the change, on PostgreSQL:

the permission profiles are not in the order they were made
     0 => 1,
     1 => 2,
-    2 => 3,
-    3 => 4,
+    2 => 4,
+    3 => 3,

With it, it passes on both MySQL and PostgreSQL, and the rest of the integration suite is unaffected.

Found while building the template snapshot tests in #9712, where the profile lists came out in a different order on the two engines.

Issues References (Fixes|Related|Closes)

Related: #9712

🤖 Generated with Claude Code

2.1 read them ORDER BY id_profile. PermissionProfile::loadAll() joins the
boards as well, and lost the ORDER BY on the way, which left the order
to the database. MySQL happens to return InnoDB rows in primary key
order; PostgreSQL does not, so renaming a profile moved it to the bottom
of every list and select of profiles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 5 milestone Oct 4, 2026
@jdarwood007
jdarwood007 merged commit 15abae4 into SimpleMachines:release-3.0 Oct 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants