Task Issue 946 Assign Plan Roles Global Role Colouring - sebiboga/testlink-upgraded GitHub Wiki
Task 946 — usersAssignGlobalRoleColoring row colour coding in Assign Test Plan Roles (gap vs legacy)
Issue: #946
Status: IMPLEMENTED & VERIFIED, issue CLOSED (2026-09-21) — branch task/issue-946
Legacy paints each user's cell with the background colour configured for that user's GLOBAL role when the config flag is on:
-
lib/usermanagement/usersAssign.php:593-598initializeGui()— whenconfig_get('gui')->usersAssignGlobalRoleColoring == ENABLEDsets$gui->role_colour = tlRole::getRoleColourCfg($dbHandler). -
lib/functions/tlRole.class.php:539-552getRoleColourCfg()— returnsconfig_get('role_colour')(=$GLOBALS['g_role_colour'],cfg/const.inc.php:536: 'admin'=>'white','tester'=>'wheat','leader'=>'acqua', 'senior tester'=>'#FFA','guest'=>'pink','test designer'=>'cyan', ''=>'grey',''=>'seashell) merged with everyroles.description` row found in DB (missing → ''). -
gui/templates/dashio/usermanagement/usersAssign.tpl:239-241— the first<td>of each user row ($user->login (first last)) getsstyle="background-color: {$gui->role_colour[$globalRoleName]};"when that colour is non-empty;$globalRoleName = $user->globalRole->namewhich is the role description.
What modern did instead: gui/templates/usermanagement/usersAssignPlan.html
rendered plain monochrome rows; api/roles/index.php GET /roles/meta/tplan-roles
returned no global-role/colour data at all.
BFF (api/roles/index.php):
-
globalRoleColourContext(&$db)— legacy parity ofusersAssign.php:593-598: whenconfig_get('gui')->usersAssignGlobalRoleColoring == ENABLEDbuilds the colour map viatlRole::getRoleColourCfg(); otherwise returns['enabled'=>false,'map'=>[]]. -
userGlobalRoleColour(&$db,&$u,$colourCtx)— resolves the user's GLOBAL role RAW description ($u->globalRole->name==roles.description, the key legacy looks up) and its configured colour ('' when off / not configured). IMPORTANT: the lookup uses the raw->name, NOTgetDisplayName()— the latter rewrites<no rights>into<no_rights>and would miss thegreymap entry (parity bug caught in code review). - Both
GET /roles/meta/tplan-rolesandGET /roles/meta/tproject-rolesnow emit per-itemglobalRoleName+roleColourand a top-levelroleColouringbool (computed once viaglobalRoleColourContext($db)per route). The tproject route is covered too because legacyusersAssign.tplis the SHARED template for project and plan contexts.
Front-end (gui/templates/usermanagement/usersAssignPlan.html +
usersAssignProject.html):
- Plan screen:
loadUsers()model entries carryglobalRoleName/roleColour;renderUsersTable()paints Login (col 1) AND Name (col 2) cells withbackground-colorwhenroleColouris non-empty (legacy fused login+name in one cell; the modern grid splits them, so both share the tint);createdRowre-applies the background so DataTables paging/search/sort re-draws keep the colour — same mechanism as the existing changed-badge. - Project screen:
buildBodyHtml()applies the same inline tint from the BFF items (data flows straight fromcurrentItems). - No i18n keys added — no new user-facing strings.
- Plan grid computed backgrounds match
$g_role_colour: adminwhite, u946designercyan, u946guestpink, u946senior#FFA, u946testerwheat, u946norightsgrey(RAW description key — proves->namenotgetDisplayName()); u946leader stays plain — itsacquavalue is invalid CSS injected verbatim (legacy-identical). - Colours persist through DataTables search + sort re-draws (createdRow).
- Changed row keeps its tint + gains
.changedclass/badge. - Config gating: flag DISABLED → all plain,
roleColouring:false; flag ENABLED → tints. Repo default staysDISABLED. - Event Viewer: no new Error/Warning; console clean.
Screenshots: docs/screenshots/issue-946-assignplan-role-colors.png,
issue-946-assignproject-role-colors.png, issue-946-assignplan-role-colors-modified.png.
Fixture: tmp/fixtures_946.php.
Task suite: tmp/TLU_Test_Cases.md — Suite 946, 7/7 PASS.
Refs #946.