Skip to content

Commit

Permalink
Merge pull request wso2#5044 from savindi7/hide-enable-rules-option
Browse files Browse the repository at this point in the history
Hide the `Enable rules` option in App outbound provisioning
  • Loading branch information
savindi7 authored Dec 14, 2023
2 parents 00e9ca6 + c6dc46b commit 0b8409b
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 35 deletions.
12 changes: 12 additions & 0 deletions .changeset/odd-rivers-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@wso2is/common": patch
"@wso2is/console": patch
"@wso2is/core": patch
"@wso2is/myaccount": patch
"@wso2is/identity-apps-core": patch
"@wso2is/access-control": patch
"@wso2is/dynamic-forms": patch
"@wso2is/form": patch
---

Hide Xacml feature with config
Original file line number Diff line number Diff line change
Expand Up @@ -1696,14 +1696,16 @@
{% endfor %}
{% endif %}
],
{% if console.ui.isXacmlConnectorEnabled is defined %}
"isXacmlConnectorEnabled": {{ console.ui.isXacmlConnectorEnabled }},
{% endif %}
"legacyMode": {
{% if legacy_mode.enable == true %}
"apiResources": false,
"applicationListSystemApps": true,
"applicationOIDCSubjectIdentifier": true,
"applicationRequestPathAuthentication": true,
"applicationSystemAppsSettings": true,
"applicationXacmlAuthorization": true,
"approvals": true,
"certificates": true,
"loginAndRegistrationEmailDomainDiscovery": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

import Alert from "@oxygen-ui/react/Alert";
import useUIConfig from "@wso2is/common/src/hooks/use-ui-configs";
import { isFeatureEnabled } from "@wso2is/core/helpers";
import {
AlertInterface,
Expand All @@ -26,7 +27,6 @@ import {
import { Field, Form, FormPropsInterface } from "@wso2is/form";
import { GenericIcon, Heading } from "@wso2is/react-components";
import isEmpty from "lodash-es/isEmpty";
import useUIConfig from "modules/common/src/hooks/use-ui-configs";
import React, {
FunctionComponent,
MutableRefObject,
Expand Down Expand Up @@ -95,7 +95,6 @@ export const AdvancedConfigurationsForm: FunctionComponent<AdvancedConfiguration
} = props;

const { t } = useTranslation();

const { UIConfig } = useUIConfig();

const featureConfig: FeatureConfigInterface = useSelector((state: AppState) => state?.config?.ui?.features);
Expand Down Expand Up @@ -306,7 +305,7 @@ export const AdvancedConfigurationsForm: FunctionComponent<AdvancedConfiguration
data-componentid={ `${ testId }-enable-authorization-checkbox` }
hidden={
!applicationConfig.advancedConfigurations.showEnableAuthorization
|| !UIConfig?.legacyMode?.applicationXacmlAuthorization }
|| !UIConfig?.isXacmlConnectorEnabled }
hint={ t("console:develop.features.applications.forms.advancedConfig.fields.enableAuthorization.hint") }
/>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -15,6 +15,8 @@
* specific language governing permissions and limitations
* under the License.
*/

import useUIConfig from "@wso2is/common/src/hooks/use-ui-configs";
import { TestableComponentInterface } from "@wso2is/core/models";
import { Field, FormValue, Forms } from "@wso2is/forms";
import { Hint, PrimaryButton } from "@wso2is/react-components";
Expand Down Expand Up @@ -84,6 +86,7 @@ export const OutboundProvisioningWizardIdpForm: FunctionComponent<OutboundProvis
const [ isRulesChecked, setIsRulesChecked ] = useState<boolean>(initialValues?.rules);
const [ connector, setConnector ] = useState<string>(initialValues?.connector);

const { UIConfig } = useUIConfig();

useEffect(() => {
if (!idpList) {
Expand Down Expand Up @@ -259,34 +262,39 @@ export const OutboundProvisioningWizardIdpForm: FunctionComponent<OutboundProvis
) }
</Grid.Column>
</Grid.Row>
<Grid.Row columns={ 1 }>
<Grid.Column mobile={ 16 } tablet={ 16 } computer={ 10 }>
<Field
name="rules"
required={ false }
requiredErrorMessage=""
type="checkbox"
children={ [
{
label: t("console:develop.features.applications.forms.outboundProvisioning" +
".fields.rules.label"),
value: "rules"
}
] }
value={ initialValues?.rules ? [ "rules" ] : [] }
listen={
(values: Map<string, FormValue>) => {
setIsRulesChecked(values.get("rules").includes("rules"));
}
}
readOnly={ readOnly }
data-testid={ `${ testId }-rules-checkbox` }
/>
<Hint>
{ t("console:develop.features.applications.forms.outboundProvisioning.fields.rules.hint") }
</Hint>
</Grid.Column>
</Grid.Row>
{
UIConfig?.isXacmlConnectorEnabled && (
<Grid.Row columns={ 1 }>
<Grid.Column mobile={ 16 } tablet={ 16 } computer={ 10 }>
<Field
name="rules"
required={ false }
requiredErrorMessage=""
type="checkbox"
children={ [
{
label: t("console:develop.features.applications.forms." +
"outboundProvisioning.fields.rules.label"),
value: "rules"
}
] }
value={ initialValues?.rules ? [ "rules" ] : [] }
listen={
(values: Map<string, FormValue>) => {
setIsRulesChecked(values.get("rules").includes("rules"));
}
}
readOnly={ readOnly }
data-testid={ `${ testId }-rules-checkbox` }
/>
<Hint>
{ t("console:develop.features.applications.forms.outboundProvisioning." +
"fields.rules.hint") }
</Hint>
</Grid.Column>
</Grid.Row>
)
}
<Grid.Row columns={ 1 }>
<Grid.Column mobile={ 16 } tablet={ 16 } computer={ 10 }>
<Field
Expand Down
1 change: 1 addition & 0 deletions apps/console/src/features/core/configs/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export class Config {
isSAASDeployment: window[ "AppUtils" ]?.getConfig()?.ui?.isSAASDeployment,
isSignatureValidationCertificateAliasEnabled:
window[ "AppUtils" ]?.getConfig()?.ui?.isSignatureValidationCertificateAliasEnabled,
isXacmlConnectorEnabled: window[ "AppUtils" ]?.getConfig()?.ui?.isXacmlConnectorEnabled,
legacyMode: window[ "AppUtils" ]?.getConfig()?.ui?.legacyMode,
listAllAttributeDialects: window[ "AppUtils" ]?.getConfig()?.ui?.listAllAttributeDialects,
privacyPolicyConfigs: window[ "AppUtils" ]?.getConfig()?.ui?.privacyPolicyConfigs,
Expand Down
4 changes: 4 additions & 0 deletions apps/console/src/features/core/models/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ export interface UIConfigInterface extends CommonUIConfigInterface<FeatureConfig
defaultLogoUrl: string;
defaultWhiteLogoUrl: string;
};
/**
* is XACML connector enabled.
*/
isXacmlConnectorEnabled?: boolean;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/console/src/public/deployment.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1051,13 +1051,13 @@
"Console",
"My Account"
],
"isXacmlConnectorEnabled": false,
"legacyMode": {
"apiResources": true,
"applicationListSystemApps": false,
"applicationOIDCSubjectIdentifier": false,
"applicationRequestPathAuthentication": false,
"applicationSystemAppsSettings": false,
"applicationXacmlAuthorization": false,
"approvals": false,
"certificates": false,
"loginAndRegistrationEmailDomainDiscovery": true,
Expand Down
4 changes: 4 additions & 0 deletions modules/common/src/models/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ export interface UIConfigInterface extends CommonUIConfigInterface<FeatureConfig
* Hidden userstores
*/
hiddenUserStores: string[];
/**
* is XACML connector enabled.
*/
isXacmlConnectorEnabled?: boolean;
}

/**
Expand Down
1 change: 0 additions & 1 deletion modules/core/src/models/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ export interface LegacyModeInterface {
applicationOIDCSubjectIdentifier: boolean;
applicationRequestPathAuthentication: boolean;
applicationSystemAppsSettings: boolean;
applicationXacmlAuthorization: boolean;
approvals: boolean;
certificates: boolean;
loginAndRegistrationEmailDomainDiscovery: boolean;
Expand Down

0 comments on commit 0b8409b

Please sign in to comment.