Skip to content

Commit

Permalink
Merge pull request #3023 from sumedhe/readonly-enterprise-login-app
Browse files Browse the repository at this point in the history
Add configurations to restrict modifying app configs
  • Loading branch information
sumedhe authored May 11, 2022
2 parents 4d977ee + c826a8d commit 163b8d2
Showing 5 changed files with 25 additions and 4 deletions.
11 changes: 10 additions & 1 deletion apps/console/src/extensions/configs/application.tsx
Original file line number Diff line number Diff line change
@@ -64,7 +64,16 @@ export const applicationConfig: ApplicationConfig = {
renderHelpPanelItems: (): ReactNode => {
return null;
},
showProvisioningSettings: true
showProvisioningSettings: true,
showDangerZone: (applicationName: string): boolean => {
return true;
},
showDeleteButton: (applicationName: string): boolean => {
return true;
},
getTabPanelReadOnlyStatus: (tabPanelName: string, applicationName: string): boolean => {
return false;
}
},
excludeIdentityClaims: false,
excludeSubjectClaim: false,
3 changes: 3 additions & 0 deletions apps/console/src/extensions/configs/models/application.ts
Original file line number Diff line number Diff line change
@@ -53,6 +53,9 @@ export interface ApplicationConfig {
extendTabs: boolean; //should be true for cloud
showProvisioningSettings: boolean;
renderHelpPanelItems: () => ReactNode;
showDangerZone: (applicationName: string) => boolean;
showDeleteButton: (applicationName: string) => boolean;
getTabPanelReadOnlyStatus: (tabPanelName: string, applicationName: string) => boolean;
};
inboundOIDCForm: {
shouldValidateCertificate: boolean;
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@ import {
ApplicationTemplateListItemInterface
} from "../models";
import { ApplicationTemplateManagementUtils } from "../utils";
import { applicationConfig } from "../../../extensions";

/**
*
@@ -380,7 +381,8 @@ export const ApplicationList: FunctionComponent<ApplicationListPropsInterface> =

return hasScopes ||
isSystemApp ||
(app?.access === ApplicationAccessTypes.READ);
(app?.access === ApplicationAccessTypes.READ) ||
!applicationConfig.editApplication.showDeleteButton(app.name);
},
icon: (): SemanticICONS => "trash alternate",
onClick: (e: SyntheticEvent, app: ApplicationListItemInterface): void => {
Original file line number Diff line number Diff line change
@@ -591,7 +591,8 @@ export const EditApplication: FunctionComponent<EditApplicationPropsInterface> =
onUpdate={ handleApplicationUpdate }
featureConfig={ featureConfig }
template={ template }
readOnly={ readOnly }
readOnly={ readOnly || applicationConfig.editApplication.getTabPanelReadOnlyStatus(
"APPLICATION_EDIT_GENERAL_SETTINGS", application.name) }
data-testid={ `${ testId }-general-settings` }
isManagementApp={ application.isManagementApp }
/>
@@ -620,7 +621,8 @@ export const EditApplication: FunctionComponent<EditApplicationPropsInterface> =
inboundProtocols={ inboundProtocolList }
featureConfig={ featureConfig }
template={ template }
readOnly={ readOnly }
readOnly={ readOnly || applicationConfig.editApplication.getTabPanelReadOnlyStatus(
"APPLICATION_EDIT_ACCESS_CONFIG", application.name) }
data-testid={ `${ testId }-access-settings` }
/>
</ResourceTab.Pane>
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ import {
ApplicationTemplateListItemInterface
} from "../../models";
import { GeneralDetailsForm } from "../forms";
import { applicationConfig } from "../../../../extensions";

/**
* Proptypes for the applications general details component.
@@ -237,6 +238,10 @@ export const GeneralApplicationSettings: FunctionComponent<GeneralApplicationSet
return null;
}

if (!applicationConfig.editApplication.showDangerZone(name)) {
return null;
}

if (hasRequiredScopes(
featureConfig?.applications, featureConfig?.applications?.scopes?.delete, allowedScopes)) {
return (

0 comments on commit 163b8d2

Please sign in to comment.