Skip to content

Beta Features Toggle Implementation

Abid Mehmood edited this page Feb 9, 2026 · 3 revisions

Beta Features Toggle Implementation

This document outlines the implementation of the "Beta Features" toggle, allowing developers to gate experimental functionality behind a per-user flag.

Overview

A new boolean flag beta_features_enabled has been added to the user profile (rhnUserInfo). This allows individual users to opt-in to experimental features without affecting the stability of the system for others.

User Interface (Preferences)

Users can enable or disable beta features via their Preferences page:

  1. Navigate to Home > User Account > Preferences.
  2. Locate the Beta Features Enabled checkbox.
  3. Check (enable) or uncheck (disable) the box.
  4. Click Save.

Developer Guide

1. User Interface - Menu Items

To mark a menu item as "beta" (likely visible only when the flag is enabled or with a beta badge), use the withBeta(true) method when building the menu tree.

Example: MenuTree.java

MenuItem myBetaPage = new MenuItem("My Beta Feature")
    .withPrimaryUrl("/rhn/beta/feature")
    .withBeta(true); // Marks this as a beta feature
    .withVisibility(user.getBetaFeaturesEnabled());

2. Navigation and Sitemesh (ACLs)

For features defined in XML (Struts navigation or Sitemesh), you can use the aclUserHasBetaFeaturesEnabled ACL to conditionally show or hide elements.

<rhn-tab name="Beta Feature" url="/rhn/systems/details/Beta.do"
         acl="user_has_beta_features_enabled()">
</rhn-tab>

This ensures the tab only appears for users who have opted in.

Note: When the user_has_beta_features_enabled ACL is present, the BETA badge is automatically added to the tab's label. You do not need to add any special CSS classes manually.

3. Backend Implementation (Java)

The User domain object now exposes the beta status of the current user. You can use this to conditionally execute code paths.

Checking the Flag

To check if the current user has beta features enabled:

User currentUser = ...; // Get the relevant user (e.g., scheduler user, logged-in user)

if (currentUser.getBetaFeaturesEnabled()) {
    // Execute beta/experimental logic
    runBetaLogic();
} else {
    // Execute standard/stable logic
    runStandardLogic();
}

4. Database Schema

The flag is stored in the rhnUserInfo table:

Table: rhnUserInfo Column: beta_features_enabled (CHAR(1), 'Y' for true, 'N' for false)

Adding New Beta Features

When implementing a new beta feature:

  1. Gate your logic using the user.getBetaFeaturesEnabled() check.
  2. Ensure fallback behavior: valid stable behavior must exist for users with the flag disabled.