MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / checkFeatureFlag

Function checkFeatureFlag

packages/ui/src/routes/RequireAuth.jsx:15–28  ·  view source on GitHub ↗
(features, display, children)

Source from the content-addressed store, hash-verified

13 * @returns {React.ReactElement} Children or unauthorized redirect
14 */
15const checkFeatureFlag = (features, display, children) => {
16 // Validate features object exists and is properly formatted
17 if (!features || Array.isArray(features) || Object.keys(features).length === 0) {
18 return <Navigate to='/unauthorized' replace />
19 }
20
21 // Check if feature flag exists and is enabled
22 if (Object.hasOwnProperty.call(features, display)) {
23 const isFeatureEnabled = features[display] === 'true' || features[display] === true
24 return isFeatureEnabled ? children : <Navigate to='/unauthorized' replace />
25 }
26
27 return <Navigate to='/unauthorized' replace />
28}
29
30export const RequireAuth = ({ permission, display, children }) => {
31 const location = useLocation()

Callers 1

RequireAuthFunction · 0.85

Calls 1

callMethod · 0.45

Tested by

no test coverage detected