Skip to content

feat(platform): hide subscription banners for non-admin users#3148

Open
ffirg wants to merge 2 commits intodevelfrom
rfe-2823-upstream
Open

feat(platform): hide subscription banners for non-admin users#3148
ffirg wants to merge 2 commits intodevelfrom
rfe-2823-upstream

Conversation

@ffirg
Copy link
Copy Markdown

@ffirg ffirg commented Apr 30, 2026

Summary

Hide the "out of compliance" banner for non-admin users.

Non-admin users cannot act on subscription compliance issues, so displaying the banner to them:

  • Causes confusion ("should I stop using the platform?")
  • Creates unnecessary support burden

This change hides all subscription-related banners (compliance, grace period, expiry warnings) for non-superuser accounts.

Note: This replaces PR #3145 (from fork) to enable SonarQube checks which require repository secrets.

Risk Analysis - REQUIRED

  • High
  • Medium
  • Low

Justification:

  • Change is isolated to banner visibility logic only
  • No API changes, no backend changes
  • Uses existing usePlatformActiveUser hook (already in use elsewhere)
  • All existing tests pass; 3 new tests added
  • Easy to revert if needed

Changes Made

  • platform/main/PlatformApp.tsx: Add is_superuser check to subscriptionBanner useMemo
  • platform/main/PlatformApp.test.tsx: Add 3 new test cases covering admin/non-admin scenarios

Implementation Details

Uses existing pattern from SubscriptionDetails.tsx:

const { activePlatformUser } = usePlatformActiveUser();
// ...
if (!activePlatformUser?.is_superuser) return null;

Test Plan

  • All 14 existing tests pass
  • New tests verify:
    • Non-admin users do NOT see compliance banners
    • Admin users DO see compliance banners
    • Non-admin users do NOT see subscription expiry banners
  • TypeScript compilation passes
  • ESLint passes

Manual Testing Steps

  1. Log in as a non-superuser account
  2. Ensure subscription is out of compliance (or will expire soon)
  3. Verify: No red/yellow subscription banner appears
  4. Log in as superuser account
  5. Verify: Subscription banner appears as expected

🤖 Generated with Claude Code

ffirg and others added 2 commits April 28, 2026 14:48
JIRA: AAPRFE-2823
https://issues.redhat.com/browse/AAPRFE-2823

Non-admin users cannot act on subscription compliance issues, so
displaying the banner to them causes confusion and unnecessary
support burden. This change hides all subscription-related banners
(compliance, grace period, expiry warnings) for non-superuser accounts.

- Add is_superuser check to subscriptionBanner useMemo
- Add 3 new test cases covering admin/non-admin scenarios
- All existing tests continue to pass (default mock is superuser)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove AAPRFE-2823 references from comments and test names per
reviewer feedback - upstream repo should not contain internal tracker links.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@marshmalien
Copy link
Copy Markdown
Member

/run-playwright

@aap-pde-ci-bot
Copy link
Copy Markdown
Collaborator

Currents dashboard

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants