Skip to content

[OGUI-1892] Disable level buttons for shifter users on page load and after#3438

Open
graduta wants to merge 16 commits into
devfrom
feature/ILG/OGUI-1892-disable-level-buttons-for-shifter-users
Open

[OGUI-1892] Disable level buttons for shifter users on page load and after#3438
graduta wants to merge 16 commits into
devfrom
feature/ILG/OGUI-1892-disable-level-buttons-for-shifter-users

Conversation

@graduta
Copy link
Copy Markdown
Member

@graduta graduta commented May 7, 2026

I have JIRA issue created

  • branch and/or PR name(s) includes JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected
  • FLP integration tests were ran successful

PR which:

  • if user authenticated has a role of "shifter" but not "admin":
    • the UI will disable the buttons changing the "level" of messages filtering system
    • even if the URL contains a higher level, this level will be brought back to level 1 (operations)
  • adds tests to validated newly added changes
  • adds const/enums for roles and infologger levels
  • extracts button into a reusable component and defines objects for existing filters

@graduta graduta requested a review from isaachilly May 7, 2026 07:39
@graduta graduta self-assigned this May 7, 2026
label,
{
id: `level-${index}`,
title: available ? `Filter level ≤ ${index}` : `You don't have access to level ${label}`,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tooltip will show Filter level ≤ null for Trace as it doesn't have an index.

className: model.log.filter.criterias.severity.in.includes(value) ? 'active' : '',
onclick: (e) => {
model.log.setCriteria('severity', 'in', value);
e.target.blur(); // remove focus so user can 'enter' without actually toggle again the button
Copy link
Copy Markdown
Collaborator

@isaachilly isaachilly May 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was e.target.blur() intentionally removed?

{
title: 'Reset date, time, matches, excludes, log levels',
isActive: false,
onclick: () => logModel.filter.resetCriteria(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reset filters will allow resetting to a default, more permissive criteria set.

this.parseLocation(params);
}
if (hasShifterButNoAdminRole(this.session.access)) {
this.log.filter.setCriteria('level', 'max', 1);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use infologger-level.const.js?

},
);

it('should disable buttons for level filter if user is shifter but not admin', async () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of edge cases should there be a test for checking what happens if user has both admin and shifter roles?

What should happen if user doesn't have shifter or admin roles?

* @param {string[]} access - array of user roles email groups affiliation
* @returns {{label: string, index:number}[]} - filter levels allowed for filtering
*/
export function getFilterLevelsAllowed(access = []) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I comment here, but the change would be elsewhere The access is not checked server-side? If the user changes it locally they can still query things they aren't allowed to. Are we okay with this level of security?

* Delegates sub-model actions depending new location of the page
* If user is shifter but not admin, set Ops as maximum level for filtering
*/
handleLocationChange() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overwriting on each navigation call could be unnecessary and setCriteria could be a better more central place for it to be checked and set to a default.

Copy link
Copy Markdown
Collaborator

@isaachilly isaachilly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my thoughts and comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants