-
Notifications
You must be signed in to change notification settings - Fork 0
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.
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.
Users can enable or disable beta features via their Preferences page:
- Navigate to Home > User Account > Preferences.
- Locate the Beta Features Enabled checkbox.
- Check (enable) or uncheck (disable) the box.
- Click Save.
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.
MenuItem myBetaPage = new MenuItem("My Beta Feature")
.withPrimaryUrl("/rhn/beta/feature")
.withBeta(true); // Marks this as a beta feature
.withVisibility(user.getBetaFeaturesEnabled());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.
The User domain object now exposes the beta status of the current user. You can use this to conditionally execute code paths.
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();
}The flag is stored in the rhnUserInfo table:
Table: rhnUserInfo
Column: beta_features_enabled (CHAR(1), 'Y' for true, 'N' for false)
When implementing a new beta feature:
- Gate your logic using the user.getBetaFeaturesEnabled() check.
- Ensure fallback behavior: valid stable behavior must exist for users with the flag disabled.