Repository navigation
Fix undefined kaui_admin_screens_allowed? on the Plugins page (KPM) - #687
Open
tungleduyxyz wants to merge 3 commits into
Open
tungleduyxyz wants to merge 3 commits into
tungleduyxyz wants to merge 3 commits into
Conversation
…rollers The Kaui layout (navbar, settings sidebar) calls kaui_admin_screens_allowed?, which was exposed with helper_method in Kaui::EngineController. The controllers of the other engines (Kanaui, Kenui, Avatax, ...) render the same layout but do not inherit from it, so their pages failed with "undefined method 'kaui_admin_screens_allowed?'". Move the view helper to Kaui::PermissionsHelper, which Kaui::Engine makes available to every controller. Kaui::EngineController keeps its own method for require_kaui_admin_screens!. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… page renders the Kaui sidebar Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ntroller Covers the Plugins page failure (undefined method 'kaui_admin_screens_allowed?'): a controller that does not inherit from Kaui::EngineController renders the kaui_setting_sidebar template, for a regular user, a Cognito bearer user without the *:* role and one holding it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #688
Problem
Since the Cognito token exchange (#683), the Kaui navbar and the settings sidebar call
kaui_admin_screens_allowed?. It was exposed to views withhelper_methodinKaui::EngineController.The Plugins page is served by killbill-kpm-ui:
KPM::PluginsController < KPM::EngineController < ApplicationController, which does not inherit fromKaui::EngineController. Itsplugins/index.html.erb(andnodes_info/index.html.erb) render thekaui/layouts/kaui_setting_sidebartemplate, which calls the helper at line 4. Opening Plugins therefore fails with:Seen on dev (WAR built from Kaui 35a7eb8, with killbill-kpm-ui 4.0.7). Any other non-Kaui engine controller rendering the Kaui layout would hit the same error.
Fix
Kaui::PermissionsHelper, whichKaui::Engineloads into every controller. For non-Kaui controllers it builds aKaui::Abilityitself, because theircurrent_abilityis not a Kaui one.helper_methodfromKaui::EngineController. It keeps its own method forrequire_kaui_admin_screens!.Testing
Added
test/integration/kaui/other_engine_settings_sidebar_test.rb: a controller that does not inherit fromKaui::EngineControllerrenders thekaui/layouts/kaui_setting_sidebartemplate, for a regular user, a Cognito bearer user without the*:*role (admin links hidden) and one holding it (admin links shown).cognito_admin_screens_test.rbstill passes.master'sengine_controller.rbandpermissions_helper.rb: the 3 tests fail withundefined method 'kaui_admin_screens_allowed?'(HTTP 500).Not checked on a deployed instance: open Settings > Plugins after rebuilding the WAR.
🤖 Generated with Claude Code