Page MenuHomeIn-Portal Phabricator

INP-1821 - Don't check event-based permissions from template for "root" user
ClosedPublic

Authored by alex on Aug 10 2022, 4:13 AM.

Details

Test Plan

Preparations

  • in IDE:
    • open core/units/users/users_event_handler.php file for editing
    • in the \UsersEventHandler::CheckPermission method declaration add this code fragment:
if ( $event->Name === 'OnEdit' ) {
    /** @var kPermissionsHelper $perm_helper */
    $perm_helper = $this->Application->recallObject('PermissionsHelper');

    return $perm_helper->finalizePermissionCheck($event, false);
}
  • save changes
  • open core/admin_templates/users/users_list.tpl file for editing
  • wrap the a_toolbar.AddButton( new ToolBarButton('edit' ... line with these tags <inp2:m_if check="m_CheckPermission" perm_event="u:OnEdit"> ... </inp2:m_if>
  • save changes

Test

  1. login to the Admin Console as a root user
  2. go to Users ManagementUsers section
  3. confirm, that the Edit toolbar button is visible and opens the current user for editing
  4. logout
  5. login to the Admin Console as a non-root user
  6. go to Users ManagementUsers section
  7. confirm, that the Edit toolbar button is NOT visible
  8. logout

Diff Detail

Repository
rINP In-Portal
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

alex created this revision.Aug 10 2022, 4:13 AM
alex requested review of this revision.Aug 10 2022, 4:13 AM
alex edited the test plan for this revision. (Show Details)Aug 10 2022, 4:17 AM
erik accepted this revision.Aug 10 2022, 5:21 AM
This revision is now accepted and ready to land.Aug 10 2022, 5:21 AM
This revision was landed with ongoing or failed builds.Nov 13 2023, 3:01 AM
This revision was automatically updated to reflect the committed changes.