Skip to content
13 changes: 12 additions & 1 deletion apps/dashboard/app/(app)/authorization/roles/[roleId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,19 @@ export default async function RolesPage(props: Props) {
return notFound();
}

const sortedPermissions = workspace.permissions.sort((a, b) => {
const aParts = a.name.split(".");
const bParts = b.name.split(".");

if (aParts.length !== bParts.length) {
return aParts.length - bParts.length;
}

return a.name.localeCompare(b.name);
});

const nested: NestedPermissions = {};
for (const permission of workspace.permissions) {
for (const permission of sortedPermissions) {
Comment thread
chronark marked this conversation as resolved.
let n = nested;
const parts = permission.name.split(".");
for (let i = 0; i < parts.length; i++) {
Expand Down