diff --git a/admin/src/main/scala/com/neu/api/group/GroupApi.scala b/admin/src/main/scala/com/neu/api/group/GroupApi.scala index 79ecc9a4d..a5ee6c47a 100644 --- a/admin/src/main/scala/com/neu/api/group/GroupApi.scala +++ b/admin/src/main/scala/com/neu/api/group/GroupApi.scala @@ -212,9 +212,9 @@ class GroupApi(resourceService: GroupService) extends BaseApi { } } ~ get { - parameter(Symbol("name").?) { name => + parameter(Symbol("name").?, Symbol("scope").?) { (name, scope) => Utils.respondWithWebServerHeaders() { - resourceService.getDlpSensor(tokenId, name) + resourceService.getDlpSensor(tokenId, name, scope) } } } ~ @@ -285,9 +285,9 @@ class GroupApi(resourceService: GroupService) extends BaseApi { } } ~ get { - parameter(Symbol("name").?) { name => + parameter(Symbol("name").?, Symbol("scope").?) { (name, scope) => Utils.respondWithWebServerHeaders() { - resourceService.getWafSensor(tokenId, name) + resourceService.getWafSensor(tokenId, name, scope) } } } ~ diff --git a/admin/src/main/scala/com/neu/model/DlpJsonProtocol.scala b/admin/src/main/scala/com/neu/model/DlpJsonProtocol.scala index b1eb9ba3e..d4df70cb6 100644 --- a/admin/src/main/scala/com/neu/model/DlpJsonProtocol.scala +++ b/admin/src/main/scala/com/neu/model/DlpJsonProtocol.scala @@ -21,7 +21,7 @@ object DlpJsonProtocol extends DefaultJsonProtocol { given dlpSensorFmt: RootJsonFormat[DlpSensor] = jsonFormat4(DlpSensor.apply) given dlpSensorDataFmt: RootJsonFormat[DlpSensorData] = jsonFormat1(DlpSensorData.apply) given dlpSensorsDataFmt: RootJsonFormat[DlpSensorsData] = jsonFormat1(DlpSensorsData.apply) - given dlpSensorConfigFmt: RootJsonFormat[DlpSensorConfig] = jsonFormat7(DlpSensorConfig.apply) + given dlpSensorConfigFmt: RootJsonFormat[DlpSensorConfig] = jsonFormat8(DlpSensorConfig.apply) given dlpSensorConfigDataFmt: RootJsonFormat[DlpSensorConfigData] = jsonFormat1( DlpSensorConfigData.apply ) diff --git a/admin/src/main/scala/com/neu/model/DlpRule.scala b/admin/src/main/scala/com/neu/model/DlpRule.scala index 3d60c4f59..fb3c6482a 100644 --- a/admin/src/main/scala/com/neu/model/DlpRule.scala +++ b/admin/src/main/scala/com/neu/model/DlpRule.scala @@ -47,6 +47,7 @@ case class DlpSensorsData(sensors: Seq[DlpSensor]) case class DlpSensorConfig( name: String, comment: Option[String], + cfg_type: Option[String], change: Option[Seq[DlpRule]], delete: Option[Seq[DlpRule]], rules: Option[Seq[DlpRule]], diff --git a/admin/src/main/scala/com/neu/model/Group.scala b/admin/src/main/scala/com/neu/model/Group.scala index eeed260c0..4f9a5f195 100644 --- a/admin/src/main/scala/com/neu/model/Group.scala +++ b/admin/src/main/scala/com/neu/model/Group.scala @@ -142,6 +142,7 @@ case class Groups4Export( groups: Array[String], policy_mode: Option[String], profile_mode: Option[String], + use_name_referral: Boolean, remote_export_options: Option[RemoteExportOptions] = None ) diff --git a/admin/src/main/scala/com/neu/model/GroupJsonProtocol.scala b/admin/src/main/scala/com/neu/model/GroupJsonProtocol.scala index c56935231..76fb61e56 100644 --- a/admin/src/main/scala/com/neu/model/GroupJsonProtocol.scala +++ b/admin/src/main/scala/com/neu/model/GroupJsonProtocol.scala @@ -45,7 +45,7 @@ object GroupJsonProtocol extends DefaultJsonProtocol { given remoteExportOptionsFormat: RootJsonFormat[RemoteExportOptions] = jsonFormat3( RemoteExportOptions.apply ) - given groups4ExportFormat: RootJsonFormat[Groups4Export] = jsonFormat4(Groups4Export.apply) + given groups4ExportFormat: RootJsonFormat[Groups4Export] = jsonFormat5(Groups4Export.apply) given criteriaItemFormat: RootJsonFormat[CriteriaItem] = jsonFormat1(CriteriaItem.apply) given groupConfigDTOFormat: RootJsonFormat[GroupConfigDTO] = jsonFormat8(GroupConfigDTO.apply) diff --git a/admin/src/main/scala/com/neu/model/WafJsonProtocol.scala b/admin/src/main/scala/com/neu/model/WafJsonProtocol.scala index a161d05cd..892d30c6f 100644 --- a/admin/src/main/scala/com/neu/model/WafJsonProtocol.scala +++ b/admin/src/main/scala/com/neu/model/WafJsonProtocol.scala @@ -20,7 +20,7 @@ object WafJsonProtocol extends DefaultJsonProtocol { given wafSensorFmt: RootJsonFormat[WafSensor] = jsonFormat4(WafSensor.apply) given wafSensorDataFmt: RootJsonFormat[WafSensorData] = jsonFormat1(WafSensorData.apply) given wafSensorsDataFmt: RootJsonFormat[WafSensorsData] = jsonFormat1(WafSensorsData.apply) - given wafSensorConfigFmt: RootJsonFormat[WafSensorConfig] = jsonFormat5(WafSensorConfig.apply) + given wafSensorConfigFmt: RootJsonFormat[WafSensorConfig] = jsonFormat6(WafSensorConfig.apply) given wafSensorConfigDataFmt: RootJsonFormat[WafSensorConfigData] = jsonFormat1( WafSensorConfigData.apply ) diff --git a/admin/src/main/scala/com/neu/model/WafRule.scala b/admin/src/main/scala/com/neu/model/WafRule.scala index b795b2e7a..9d64bdfd8 100644 --- a/admin/src/main/scala/com/neu/model/WafRule.scala +++ b/admin/src/main/scala/com/neu/model/WafRule.scala @@ -35,6 +35,7 @@ case class WafSensorsData(sensors: Seq[WafSensor]) case class WafSensorConfig( name: String, comment: Option[String], + cfg_type: Option[String], change: Option[Seq[WafRule]], delete: Option[Seq[WafRule]], rules: Option[Seq[WafRule]] diff --git a/admin/src/main/scala/com/neu/service/group/GroupService.scala b/admin/src/main/scala/com/neu/service/group/GroupService.scala index 3a6cb3881..5cb083dfa 100644 --- a/admin/src/main/scala/com/neu/service/group/GroupService.scala +++ b/admin/src/main/scala/com/neu/service/group/GroupService.scala @@ -73,7 +73,7 @@ class GroupService extends BaseService with DefaultJsonFormats with LazyLogging logger.info("Exporting groups: {}", payload) RestClient.httpRequestWithHeaderDecode( s"${baseClusterUri(tokenId)}/file/group", - GET, + POST, payload, tokenId ) @@ -551,11 +551,11 @@ class GroupService extends BaseService with DefaultJsonFormats with LazyLogging } } - def getDlpSensor(tokenId: String, name: Option[String]): Route = complete { + def getDlpSensor(tokenId: String, name: Option[String], scope: Option[String]): Route = complete { if (name.isEmpty) { logger.info("Getting sensors") RestClient.httpRequestWithHeader( - s"${baseClusterUri(tokenId)}/dlp/sensor", + s"${baseClusterUri(tokenId)}/dlp/sensor${if (scope.nonEmpty) s"?scope=${scope.get}" else ""}", GET, "", tokenId @@ -691,11 +691,11 @@ class GroupService extends BaseService with DefaultJsonFormats with LazyLogging ) } - def getWafSensor(tokenId: String, name: Option[String]): Route = complete { + def getWafSensor(tokenId: String, name: Option[String], scope: Option[String]): Route = complete { if (name.isEmpty) { logger.info("Getting sensors") RestClient.httpRequestWithHeader( - s"${baseClusterUri(tokenId)}/waf/sensor", + s"${baseClusterUri(tokenId)}/waf/sensor${if (scope.nonEmpty) s"?scope=${scope.get}" else ""}", GET, "", tokenId diff --git a/admin/webapp/websrc/app/common/api/policy-http.service.ts b/admin/webapp/websrc/app/common/api/policy-http.service.ts index 993b5fd20..de0eb95e3 100644 --- a/admin/webapp/websrc/app/common/api/policy-http.service.ts +++ b/admin/webapp/websrc/app/common/api/policy-http.service.ts @@ -3,6 +3,7 @@ import { PathConstant } from '@common/constants/path.constant'; import { Group, NetworkRule, ResponseRule, Service } from '@common/types'; import { GlobalVariable } from '@common/variables/global.variable'; import { Observable } from 'rxjs'; +import { GlobalConstant } from '@common/constants/global.constant'; import { pluck } from 'rxjs/operators'; @Injectable() @@ -124,9 +125,23 @@ export class PolicyHttpService { return GlobalVariable.http.patch(PathConstant.DLP_GROUPS_URL, payload); } - getDLPSensors() { + getDLPSensors(source) { + const options: any = []; + if (source === GlobalConstant.NAV_SOURCE.FED_POLICY) { + options.push({ + params: { + scope: 'fed', + }, + }); + } else { + options.push({ + params: { + scope: 'local', + }, + }); + } return GlobalVariable.http - .get(PathConstant.DLP_SENSORS_URL) + .get(PathConstant.DLP_SENSORS_URL, ...options) .pipe(pluck('sensors')); } @@ -140,9 +155,23 @@ export class PolicyHttpService { return GlobalVariable.http.patch(PathConstant.WAF_GROUPS_URL, payload); } - getWAFSensors() { + getWAFSensors(source) { + const options: any = []; + if (source === GlobalConstant.NAV_SOURCE.FED_POLICY) { + options.push({ + params: { + scope: 'fed', + }, + }); + } else { + options.push({ + params: { + scope: 'local', + }, + }); + } return GlobalVariable.http - .get(PathConstant.WAF_SENSORS_URL) + .get(PathConstant.WAF_SENSORS_URL, ...options) .pipe(pluck('sensors')); } } diff --git a/admin/webapp/websrc/app/common/services/dlp-sensors.service.ts b/admin/webapp/websrc/app/common/services/dlp-sensors.service.ts index 80ef9893f..211088dd0 100644 --- a/admin/webapp/websrc/app/common/services/dlp-sensors.service.ts +++ b/admin/webapp/websrc/app/common/services/dlp-sensors.service.ts @@ -8,9 +8,9 @@ import { TranslateService } from '@ngx-translate/core'; import { DomSanitizer } from '@angular/platform-browser'; import { UtilsService } from '@common/utils/app.utils'; import { pluck } from 'rxjs/operators'; -import { SensorActionButtonsComponent } from '@routes/dlp-sensors/partial/sensor-action-buttons/sensor-action-buttons.component'; -import { RuleActionButtonsComponent } from '@routes/dlp-sensors/partial/rule-action-buttons/rule-action-buttons.component'; -import { PatternActionButtonsComponent } from '@routes/dlp-sensors/partial/pattern-action-buttons/pattern-action-buttons.component'; +import { SensorActionButtonsComponent } from '@components/dlp-sensors/partial/sensor-action-buttons/sensor-action-buttons.component'; +import { RuleActionButtonsComponent } from '@components/dlp-sensors/partial/rule-action-buttons/rule-action-buttons.component'; +import { PatternActionButtonsComponent } from '@components/dlp-sensors/partial/pattern-action-buttons/pattern-action-buttons.component'; @Injectable({ providedIn: 'root', @@ -26,21 +26,25 @@ export class DlpSensorsService { this.$win = $(GlobalVariable.window); } - configGrids = (isWriteDLPSensorAuthorized: boolean) => { + configGrids = (isWriteDLPSensorAuthorized: boolean, source: string = '') => { const columnDefs4Sensor = [ { headerName: this.translate.instant('dlp.gridHeader.SENSOR_NAME'), field: 'name', - headerCheckboxSelection: true, - headerCheckboxSelectionFilteredOnly: true, - checkboxSelection: params => { - if (params.data) return !params.data.predefine; - return false; - }, + headerCheckboxSelection: params => + params.context.componentParent.source !== + GlobalConstant.NAV_SOURCE.FED_POLICY, + headerCheckboxSelectionFilteredOnly: params => + params.context.componentParent.source !== + GlobalConstant.NAV_SOURCE.FED_POLICY, cellRenderer: params => { if (params.value) return ` ${params.value} `; @@ -100,6 +104,19 @@ export class DlpSensorsService { }, ]; + if (source !== GlobalConstant.NAV_SOURCE.FED_POLICY) { + columnDefs4Sensor[0]['checkboxSelection'] = params => { + if (params.data) + return ( + !params.data.predefine && + params.context.componentParent.source !== + GlobalConstant.NAV_SOURCE.FED_POLICY && + params.data.cfg_type !== GlobalConstant.CFG_TYPE.FED + ); + return false; + }; + } + const columnDefs4Rules = [ { headerName: this.translate.instant('dlp.gridHeader.PATTERN_NAME'), @@ -186,7 +203,8 @@ export class DlpSensorsService { ), }; - grids.gridOptions.rowSelection = 'multiple'; + grids.gridOptions.rowSelection = + source !== GlobalConstant.NAV_SOURCE.FED_POLICY ? 'multiple' : 'single'; grids.gridOptions.rowClassRules = { 'disabled-row': params => { @@ -204,9 +222,17 @@ export class DlpSensorsService { return grids; }; - getDlpSensorsData = () => { + getDlpSensorsData = source => { + const options: any = []; + if (source === GlobalConstant.NAV_SOURCE.FED_POLICY) { + options.push({ + params: { + scope: 'fed', + }, + }); + } return GlobalVariable.http - .get(PathConstant.DLP_SENSORS_URL) + .get(PathConstant.DLP_SENSORS_URL, ...options) .pipe(pluck('sensors')); }; diff --git a/admin/webapp/websrc/app/common/services/federated-configuration.service.ts b/admin/webapp/websrc/app/common/services/federated-configuration.service.ts index 8badf58b9..cdb564b5f 100644 --- a/admin/webapp/websrc/app/common/services/federated-configuration.service.ts +++ b/admin/webapp/websrc/app/common/services/federated-configuration.service.ts @@ -6,6 +6,7 @@ import { Webhook } from '@common/types'; @Injectable() export class FederatedConfigurationService { + public activeTabIndex4Group: number = 0; constructor(private configHttpService: ConfigHttpService) {} getFederatedConfig() { diff --git a/admin/webapp/websrc/app/common/services/groups.service.ts b/admin/webapp/websrc/app/common/services/groups.service.ts index 78f0d2acc..902d919b9 100644 --- a/admin/webapp/websrc/app/common/services/groups.service.ts +++ b/admin/webapp/websrc/app/common/services/groups.service.ts @@ -843,8 +843,8 @@ export class GroupsService { return this.policyHttpService.getDLPGroups(groupName); }; - getDlpSensorData = () => { - return this.policyHttpService.getDLPSensors(); + getDlpSensorData = source => { + return this.policyHttpService.getDLPSensors(source); }; updateGroupDlpSensorData = payload => { @@ -855,8 +855,8 @@ export class GroupsService { return this.policyHttpService.getWAFGroups(groupName); }; - getWafSensorData = () => { - return this.policyHttpService.getWAFSensors(); + getWafSensorData = getWAFSensors => { + return this.policyHttpService.getWAFSensors(getWAFSensors); }; updateGroupWafSensorData = payload => { diff --git a/admin/webapp/websrc/app/common/services/waf-sensors.service.ts b/admin/webapp/websrc/app/common/services/waf-sensors.service.ts index d7c6b5461..67eda9573 100644 --- a/admin/webapp/websrc/app/common/services/waf-sensors.service.ts +++ b/admin/webapp/websrc/app/common/services/waf-sensors.service.ts @@ -8,9 +8,9 @@ import { TranslateService } from '@ngx-translate/core'; import { DomSanitizer } from '@angular/platform-browser'; import { UtilsService } from '@common/utils/app.utils'; import { pluck } from 'rxjs/operators'; -import { SensorActionButtonsComponent } from '@routes/waf-sensors/partial/sensor-action-buttons/sensor-action-buttons.component'; -import { RuleActionButtonsComponent } from '@routes/waf-sensors/partial/rule-action-buttons/rule-action-buttons.component'; -import { PatternActionButtonsComponent } from '@routes/waf-sensors/partial/pattern-action-buttons/pattern-action-buttons.component'; +import { SensorActionButtonsComponent } from '@components/waf-sensors/partial/sensor-action-buttons/sensor-action-buttons.component'; +import { RuleActionButtonsComponent } from '@components/waf-sensors/partial/rule-action-buttons/rule-action-buttons.component'; +import { PatternActionButtonsComponent } from '@components/waf-sensors/partial/pattern-action-buttons/pattern-action-buttons.component'; @Injectable({ providedIn: 'root', @@ -26,21 +26,25 @@ export class WafSensorsService { this.$win = $(GlobalVariable.window); } - configGrids = (isWriteWAFSensorAuthorized: boolean) => { + configGrids = (isWriteWAFSensorAuthorized: boolean, source: string = '') => { const columnDefs4Sensor = [ { headerName: this.translate.instant('waf.gridHeader.SENSOR_NAME'), field: 'name', - headerCheckboxSelection: true, - headerCheckboxSelectionFilteredOnly: true, - checkboxSelection: params => { - if (params.data) return !params.data.predefine; - return false; - }, + headerCheckboxSelection: params => + params.context.componentParent.source !== + GlobalConstant.NAV_SOURCE.FED_POLICY, + headerCheckboxSelectionFilteredOnly: params => + params.context.componentParent.source !== + GlobalConstant.NAV_SOURCE.FED_POLICY, cellRenderer: params => { if (params.value) return ` ${params.value} `; @@ -100,6 +104,19 @@ export class WafSensorsService { }, ]; + if (source !== GlobalConstant.NAV_SOURCE.FED_POLICY) { + columnDefs4Sensor[0]['checkboxSelection'] = params => { + if (params.data) + return ( + !params.data.predefine && + params.context.componentParent.source !== + GlobalConstant.NAV_SOURCE.FED_POLICY && + params.data.cfg_type !== GlobalConstant.CFG_TYPE.FED + ); + return false; + }; + } + const columnDefs4Rules = [ { headerName: this.translate.instant('waf.gridHeader.PATTERN_NAME'), @@ -186,7 +203,8 @@ export class WafSensorsService { ), }; - grids.gridOptions.rowSelection = 'multiple'; + grids.gridOptions.rowSelection = + source !== GlobalConstant.NAV_SOURCE.FED_POLICY ? 'multiple' : 'single'; grids.gridOptions.rowClassRules = { 'disabled-row': params => { @@ -204,9 +222,17 @@ export class WafSensorsService { return grids; }; - getWafSensorsData = () => { + getWafSensorsData = source => { + const options: any = []; + if (source === GlobalConstant.NAV_SOURCE.FED_POLICY) { + options.push({ + params: { + scope: 'fed', + }, + }); + } return GlobalVariable.http - .get(PathConstant.WAF_SENSORS_URL) + .get(PathConstant.WAF_SENSORS_URL, ...options) .pipe(pluck('sensors')); }; diff --git a/admin/webapp/websrc/app/common/types/settings/remote-repository.ts b/admin/webapp/websrc/app/common/types/settings/remote-repository.ts index 30bfb0353..9a05461d7 100644 --- a/admin/webapp/websrc/app/common/types/settings/remote-repository.ts +++ b/admin/webapp/websrc/app/common/types/settings/remote-repository.ts @@ -32,6 +32,7 @@ export interface RemoteExportOptionsWrapper { export interface RemoteExportOptionsConfig { policy_mode: string; profile_mode: string; + use_name_referral: boolean; remote_repository_nickname: string; export_mode: string; file_path?: string; diff --git a/admin/webapp/websrc/app/routes/dlp-sensors/dlp-sensors.component.html b/admin/webapp/websrc/app/routes/components/dlp-sensors/dlp-sensors.component.html similarity index 89% rename from admin/webapp/websrc/app/routes/dlp-sensors/dlp-sensors.component.html rename to admin/webapp/websrc/app/routes/components/dlp-sensors/dlp-sensors.component.html index f8fe02d81..d5aafd3a9 100644 --- a/admin/webapp/websrc/app/routes/dlp-sensors/dlp-sensors.component.html +++ b/admin/webapp/websrc/app/routes/components/dlp-sensors/dlp-sensors.component.html @@ -1,5 +1,7 @@
-
+

{{ 'sidebar.nav.DLP_SENSORS' | translate }}

@@ -35,7 +37,10 @@

- +
@@ -95,7 +100,14 @@

+ +
+ +
+
+ +
+
+ +
+
+
+ + {{ 'enum.FILTER' | translate }} + + +
+
+ + +
+ + +
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + {{ 'enum.FILTER' | translate }} + + +
+
+
+ +
+ + {{ 'enum.FILTER' | translate }} + + +
+
+ +
+ + {{ 'enum.FILTER' | translate }} + + +
+
+ +
+ + + + +
+ + {{ 'enum.FILTER' | translate }} + + +
+
+
+ +
+ + + + +
+ + {{ 'enum.FILTER' | translate }} + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/admin/webapp/websrc/app/routes/federated-policy/fed-group-details/fed-group-details.component.scss b/admin/webapp/websrc/app/routes/federated-policy/fed-group-details/fed-group-details.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/admin/webapp/websrc/app/routes/federated-policy/fed-group-details/fed-group-details.component.spec.ts b/admin/webapp/websrc/app/routes/federated-policy/fed-group-details/fed-group-details.component.spec.ts new file mode 100644 index 000000000..48b95f405 --- /dev/null +++ b/admin/webapp/websrc/app/routes/federated-policy/fed-group-details/fed-group-details.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FedGroupDetailsComponent } from './fed-group-details.component'; + +describe('FedGroupDetailsComponent', () => { + let component: FedGroupDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [FedGroupDetailsComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(FedGroupDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/admin/webapp/websrc/app/routes/federated-policy/fed-group-details/fed-group-details.component.ts b/admin/webapp/websrc/app/routes/federated-policy/fed-group-details/fed-group-details.component.ts new file mode 100644 index 000000000..7ba1c336c --- /dev/null +++ b/admin/webapp/websrc/app/routes/federated-policy/fed-group-details/fed-group-details.component.ts @@ -0,0 +1,152 @@ +import { + Component, + OnInit, + HostListener, + ViewChild, + AfterViewInit, + SimpleChanges, + OnChanges, + Input, +} from '@angular/core'; +import { GlobalConstant } from '@common/constants/global.constant'; +import { GlobalVariable } from '@common/variables/global.variable'; +import { GroupsComponent } from '@components/groups/groups.component'; +import { FederatedConfigurationService } from '@services/federated-configuration.service'; +import { FormControl } from '@angular/forms'; +import { AuthUtilsService } from '@common/utils/auth.utils'; + +export const fedGroupDetailsTabs = [ + 'member', + 'process profile rules', + 'file access rules', + 'network rules', + 'response rules', + 'DLP', + 'WAF', +]; + +@Component({ + selector: 'app-fed-group-details', + templateUrl: './fed-group-details.component.html', + styleUrls: ['./fed-group-details.component.scss'], +}) +export class FedGroupDetailsComponent implements OnInit { + @Input() kind: string; + @Input() groupName: string; + @Input() members: any; + @Input() height: number; + public CFG_TYPE: any = GlobalConstant.CFG_TYPE; + public navSource4Group: string = ''; + public showPredefinedRules: any; + public enabled: boolean; + public editGroupSensorModal: any; + public toggleWAFConfigEnablement: any; + public toggleDLPConfigEnablement: any; + public removeProfile: any; + public editProfile: any; + public addProfile: any; + public selectedFileAccessRules: any; + public selectedProcessProfileRules: any; + public isWriteWafAuthorized: boolean; + public isWriteDlpAuthorized: boolean; + public isWriteGroupAuthorized: boolean; + public isWriteFileAccessRuleAuthorized: boolean; + public isWriteProcessProfileRuleAuthorized: boolean; + public filter = new FormControl(''); + get activeTab(): string { + return fedGroupDetailsTabs[ + this.federatedConfigurationService.activeTabIndex4Group + ]; + } + + constructor( + public federatedConfigurationService: FederatedConfigurationService, + private authUtilsService: AuthUtilsService + ) {} + + ngOnInit(): void { + this.isWriteGroupAuthorized = + this.authUtilsService.getDisplayFlag('write_group') && + this.authUtilsService.getDisplayFlag('multi_cluster_w'); + this.isWriteWafAuthorized = + this.authUtilsService.getDisplayFlag('write_waf_rule') && + this.authUtilsService.getDisplayFlag('multi_cluster_w'); + this.isWriteDlpAuthorized = + this.authUtilsService.getDisplayFlag('write_dlp_rule') && + this.authUtilsService.getDisplayFlag('multi_cluster_w'); + this.navSource4Group = GlobalConstant.NAV_SOURCE.GROUP; + } + + ngAfterViewInit() { + const TAB_VISIBLE_MATRIX = [ + true, + this.kind === 'container' || this.kind === 'node', + this.kind === 'container', + true, + true, + this.kind === 'container', + this.kind === 'container', + ]; + if ( + !TAB_VISIBLE_MATRIX[ + this.federatedConfigurationService.activeTabIndex4Group + ] + ) + this.federatedConfigurationService.activeTabIndex4Group = 0; + } + + private setHeight = (innerHeight: number) => { + return (innerHeight - 210) / 2; + }; + + getStatus = enabled => { + this.enabled = enabled; + }; + + activateTab4Group = event => { + this.federatedConfigurationService.activeTabIndex4Group = event.index; + }; + + getEditGroupSensorModal = editGroupSensorModal => { + this.editGroupSensorModal = editGroupSensorModal; + }; + + getToggleWAFConfigEnablement = toggleWAFConfigEnablement => { + this.toggleWAFConfigEnablement = toggleWAFConfigEnablement; + }; + + getToggleDLPConfigEnablement = toggleDLPConfigEnablement => { + this.toggleDLPConfigEnablement = toggleDLPConfigEnablement; + }; + + getSelectedFileAccessRules = selectedFileAccessRules => { + this.selectedFileAccessRules = selectedFileAccessRules; + }; + + getSelectedProcessProfileRules = selectedProcessProfileRules => { + this.selectedProcessProfileRules = selectedProcessProfileRules; + }; + + getRemoveProfile = removeProfile => { + this.removeProfile = removeProfile; + }; + + getEditProfile = editProfile => { + this.editProfile = editProfile; + }; + + getAddProfile = addProfile => { + this.addProfile = addProfile; + }; + + getShowPredefinedRules = showPredefinedRules => { + this.showPredefinedRules = showPredefinedRules; + }; + + isIncludingGroundRule = () => { + let index = this.selectedProcessProfileRules.findIndex( + rule => rule.cfg_type === GlobalConstant.CFG_TYPE.GROUND + ); + return index > -1; + }; +} diff --git a/admin/webapp/websrc/app/routes/federated-policy/federated-policy.component.html b/admin/webapp/websrc/app/routes/federated-policy/federated-policy.component.html index cb20f6165..c06c83624 100644 --- a/admin/webapp/websrc/app/routes/federated-policy/federated-policy.component.html +++ b/admin/webapp/websrc/app/routes/federated-policy/federated-policy.component.html @@ -10,12 +10,45 @@

animationDuration="0ms" (selectedTabChange)="activateTab($event)"> - - + [minHeightOne]="163" + [minHeightTwo]="140"> + + + + + +
+ + +
+
+ +
+ +
+ {{ 'group.SELECT_GROUP_HINT' | translate }} +
+
+
+
+
+
- - + + [source]="navSource"> - - + + [source]="navSource"> { this.activeTabIndex = event.index; - } + }; private setHeight = (innerHeight: number) => { - return innerHeight - 210; + return (innerHeight - 210) / 2; }; } diff --git a/admin/webapp/websrc/app/routes/federated-policy/federated-policy.module.ts b/admin/webapp/websrc/app/routes/federated-policy/federated-policy.module.ts index 148d1546c..b023ed805 100644 --- a/admin/webapp/websrc/app/routes/federated-policy/federated-policy.module.ts +++ b/admin/webapp/websrc/app/routes/federated-policy/federated-policy.module.ts @@ -5,11 +5,16 @@ import { FederatedPolicyComponent } from './federated-policy.component'; import { NvCommonModule } from '@common/nvCommon.module'; import { ProcessProfileRulesModule } from '@components/process-profile-rules/process-profile-rules.module'; import { FileAccessRulesModule } from '@components/file-access-rules/file-access-rules.module'; +import { GroupDetailsModule } from '@components/group-details/group-details.module'; import { FederatedPolicyConfigurationModule } from '@components/federated-policy-configuration/federated-policy-configuration.module'; import { ResponseRulesModule } from '@components/response-rules/response-rules.module'; import { AdmissionRulesModule } from '@components/admission-rules/admission-rules.module'; import { NetworkRulesModule } from '@components/network-rules/network-rules.module'; import { GroupsModule } from '@components/groups/groups.module'; +import { AdjustableDivModule } from '@components/ui/adjustable-div/adjustable-div.module'; +import { DlpSensorsModule } from '@components/dlp-sensors/dlp-sensors.module'; +import { WafSensorsModule } from '@components/waf-sensors/waf-sensors.module'; +import { FedGroupDetailsComponent } from './fed-group-details/fed-group-details.component'; const routes: Routes = [ { path: '', component: FederatedPolicyComponent }, @@ -17,17 +22,21 @@ const routes: Routes = [ ]; @NgModule({ - declarations: [FederatedPolicyComponent], + declarations: [FederatedPolicyComponent, FedGroupDetailsComponent], imports: [ CommonModule, NvCommonModule, ProcessProfileRulesModule, FileAccessRulesModule, + GroupDetailsModule, FederatedPolicyConfigurationModule, ResponseRulesModule, AdmissionRulesModule, NetworkRulesModule, GroupsModule, + AdjustableDivModule, + DlpSensorsModule, + WafSensorsModule, RouterModule.forChild(routes), ], }) diff --git a/admin/webapp/websrc/app/routes/routes.ts b/admin/webapp/websrc/app/routes/routes.ts index c05917e4a..60b091380 100644 --- a/admin/webapp/websrc/app/routes/routes.ts +++ b/admin/webapp/websrc/app/routes/routes.ts @@ -113,15 +113,15 @@ export const routes: Routes = [ { path: 'dlp-sensors', loadChildren: () => - import('./dlp-sensors/dlp-sensors.module').then( - m => m.DlpSensorsModule + import('./dlp-sensors-page/dlp-sensors-page.module').then( + m => m.DlpSensorsPageModule ), }, { path: 'waf-sensors', loadChildren: () => - import('./waf-sensors/waf-sensors.module').then( - m => m.WafSensorsModule + import('./waf-sensors-page/waf-sensors-page.module').then( + m => m.WafSensorsPageModule ), }, { diff --git a/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.component.html b/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.component.html new file mode 100644 index 000000000..760ee5694 --- /dev/null +++ b/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.component.html @@ -0,0 +1 @@ + diff --git a/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.component.scss b/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.component.spec.ts b/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.component.spec.ts new file mode 100644 index 000000000..761279d27 --- /dev/null +++ b/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { WafSensorsPageComponent } from './waf-sensors-page.component'; + +describe('WafSensorsPageComponent', () => { + let component: WafSensorsPageComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [WafSensorsPageComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(WafSensorsPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.component.ts b/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.component.ts new file mode 100644 index 000000000..ed4ef77dc --- /dev/null +++ b/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.component.ts @@ -0,0 +1,16 @@ +import { Component, OnInit } from '@angular/core'; +import { GlobalConstant } from '@common/constants/global.constant'; + +@Component({ + selector: 'app-waf-sensors-page', + templateUrl: './waf-sensors-page.component.html', + styleUrls: ['./waf-sensors-page.component.scss'], +}) +export class WafSensorsPageComponent implements OnInit { + public navSource: string; + constructor() {} + + ngOnInit(): void { + this.navSource = GlobalConstant.NAV_SOURCE.SELF; + } +} diff --git a/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.module.ts b/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.module.ts new file mode 100644 index 000000000..71de0ab1b --- /dev/null +++ b/admin/webapp/websrc/app/routes/waf-sensors-page/waf-sensors-page.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { Routes, RouterModule } from '@angular/router'; +import { WafSensorsPageComponent } from './waf-sensors-page.component'; +import { WafSensorsModule } from '@components/waf-sensors/waf-sensors.module'; + +const routes: Routes = [ + { path: '', component: WafSensorsPageComponent }, + { path: '*', redirectTo: '' }, +]; + +@NgModule({ + declarations: [WafSensorsPageComponent], + imports: [CommonModule, WafSensorsModule, RouterModule.forChild(routes)], +}) +export class WafSensorsPageModule {} diff --git a/admin/webapp/websrc/assets/i18n/en-common.json b/admin/webapp/websrc/assets/i18n/en-common.json index d967fcf1c..b4602fce9 100644 --- a/admin/webapp/websrc/assets/i18n/en-common.json +++ b/admin/webapp/websrc/assets/i18n/en-common.json @@ -2128,6 +2128,8 @@ "POLICY_MODE": "Network Policy Mode", "PROFILE_MODE": "Process Profile Mode", "ZERODRIFT_SETTING": "Baseline Profile Setting", + "DOWNLOAD_LOCATION": "Download location", + "NAME_REFERRAL": "Use Name Referral", "TIP": { "EDIT": "Edit Group", "DELETE": "Remove Group", @@ -2339,7 +2341,8 @@ "ADD_PATTERN_NG": "Maximum amount of patterns is 16", "EXISTING_PATTERN_NG": "This pattern is existing!", "RECIPROCAL_PATTERN_NG": "There is reciprocal pattern against added pattern in the same context.", - "SENSOR_NAME_REQUIRED": "Sensor name is required!" + "SENSOR_NAME_REQUIRED": "Sensor name is required!", + "NAME_VALID": "Sensor name must start with: " }, "TIP": { "EDIT_SENSOR": "Edit Sensor", diff --git a/admin/webapp/websrc/assets/i18n/zh_cn-common.json b/admin/webapp/websrc/assets/i18n/zh_cn-common.json index eb11d7575..db7bfb626 100644 --- a/admin/webapp/websrc/assets/i18n/zh_cn-common.json +++ b/admin/webapp/websrc/assets/i18n/zh_cn-common.json @@ -2128,6 +2128,8 @@ "POLICY_MODE": "网络策略模式", "PROFILE_MODE": "进程配置模式", "ZERODRIFT_SETTING": "基线配置设置", + "DOWNLOAD_LOCATION": "下载到", + "NAME_REFERRAL": "使用组名参照", "TIP": { "EDIT": "编辑组", "DELETE": "删除组", @@ -2339,7 +2341,8 @@ "ADD_PATTERN_NG": "正则形式的最大数量为16", "EXISTING_PATTERN_NG": "此正则形式已存在", "RECIPROCAL_PATTERN_NG": "在同一语境下有与添加的正则形式互逆的表达式", - "SENSOR_NAME_REQUIRED": "需填写检测器名称" + "SENSOR_NAME_REQUIRED": "需填写检测器名称", + "NAME_VALID": "检测器名前缀必须是: " }, "TIP": { "EDIT_SENSOR": "编辑检测器",