Skip to content

Commit

Permalink
moved auth settings to its own security tab (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfinnessy-caci authored Oct 17, 2024
1 parent 66ca164 commit 0ba8568
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 17 deletions.
4 changes: 2 additions & 2 deletions service/src/routes/authenticationconfigurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ module.exports = function (app, security) {

const securityData = {};

const settings = JSON.parse(req.body.settings);
const { settings } = req.body;

Object.keys(settings).forEach(key => {
if (blacklist && blacklist.indexOf(key.toLowerCase()) != -1) {
Expand Down Expand Up @@ -184,7 +184,7 @@ module.exports = function (app, security) {

const securityData = {};

const settings = JSON.parse(req.body.settings);
const { settings } = req.body;

Object.keys(settings).forEach(key => {
if (blacklist && blacklist.indexOf(key.toLowerCase()) != -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import { Strategy } from '../../admin-authentication/admin-settings.model';
})
export class AuthenticationCreateComponent implements OnInit {
breadcrumbs: AdminBreadcrumb[] = [{
title: 'Settings',
icon: 'build',
title: 'Security',
icon: 'shield',
state: {
name: 'admin.settings'
name: 'admin.security'
}
}];
strategy: Strategy;
Expand Down Expand Up @@ -124,13 +124,13 @@ export class AuthenticationCreateComponent implements OnInit {

save(): void {
this.authenticationConfigurationService.createConfiguration(this.strategy).then(() => {
this.stateService.go('admin.settings');
this.stateService.go('admin.security');
}).catch((err: any) => {
console.error(err);
this.snackBar.open('An error occured while creating ' + this.strategy.title, null, {
duration: 2000,
})
this.stateService.go('admin.settings');
this.stateService.go('admin.security');
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<section class="mat-typography">
<admin-breadcrumb [breadcrumbs]="breadcrumbs"></admin-breadcrumb>
</section>
<section class="mat-typography">
<div class="auth__action--new">
<button mat-stroked-button color="primary" (click)="$event.stopPropagation(); createAuthentication()"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import _ from 'underscore'
import { Component, OnInit, Inject, EventEmitter, Output, Input, OnChanges, SimpleChanges } from '@angular/core';
import { Team, Event, LocalStorageService, AuthenticationConfigurationService, UserService } from '../../upgrade/ajs-upgraded-providers';
import { AdminBreadcrumb } from '../admin-breadcrumb/admin-breadcrumb.model'
import { Strategy } from '../admin-authentication/admin-settings.model';
import { MatDialog } from '@angular/material/dialog';
import { StateService } from '@uirouter/angular';
Expand All @@ -17,6 +18,11 @@ export class AdminAuthenticationComponent implements OnInit, OnChanges {
@Output() onDirty = new EventEmitter<boolean>();
@Input() beginSave: any;

readonly breadcrumbs: AdminBreadcrumb[] = [{
title: 'Security',
icon: 'shield'
}];

teams: any[] = [];
events: any[] = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
<div class="page-container">
<div class="content">
<mat-tab-group color="primary" mat-stretch-tabs>
<mat-tab label="Authentication">
<admin-authentication (saveComplete)="onAuthenticationSaved($event)"
(onDirty)="onAuthenticationDirty($event)" (deleteComplete)="onAuthenticationDeleted($event)" [beginSave]="(onSave)">
</admin-authentication>
</mat-tab>
<mat-tab label="Banner">
<security-banner (saveComplete)="onBannerSaved($event)" (onDirty)="onBannerDirty($event)"
[beginSave]="(onSave)"></security-banner>
Expand Down
6 changes: 6 additions & 0 deletions web-app/admin/src/ng1/admin/admin.tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
<div>Map</div>
</div>

<div class="admin-action" ng-if="$ctrl.hasPermission('UPDATE_SETTINGS')" ng-class="{'admin-action-selected': $ctrl.stateName === 'admin.security'}" ng-click="$ctrl.tabChanged('admin.security')">
<div ng-class="{'admin-action-arrow-left': $ctrl.stateName === 'admin.security'}"></div>
<i class="fa fa-shield"></i>
<div>Security</div>
</div>

<div class="admin-action" ng-if="$ctrl.hasPermission('UPDATE_SETTINGS')" ng-class="{'admin-action-selected': $ctrl.stateName === 'admin.settings'}" ng-click="$ctrl.tabChanged('admin.settings')">
<div ng-class="{'admin-action-arrow-left': $ctrl.stateName === 'admin.settings'}"></div>
<i class="fa fa-wrench"></i>
Expand Down
19 changes: 14 additions & 5 deletions web-app/admin/src/ng1/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { UserReadService } from '@ngageoint/mage.web-core-lib/user';
import { ContactComponent } from '../app/contact/contact.component';

import { AdminSettingsComponent } from '../app/admin/admin-settings/admin-settings.component';
import { AdminAuthenticationComponent } from '../app/admin/admin-authentication/admin-authentication.component';
import { AdminMapComponent } from '../app/admin/admin-map/admin-map.component';
import { AdminFeedsComponent } from '../app/admin/admin-feeds/admin-feeds.component';
import { AdminFeedComponent } from '../app/admin/admin-feeds/admin-feed/admin-feed.component';
Expand Down Expand Up @@ -58,6 +59,7 @@ app
.directive('feedEdit', downgradeComponent({ component: AdminFeedEditComponent }))
.directive('upgradedAdminMapSettings', downgradeComponent({ component: AdminMapComponent }))
.directive('upgradedAdminSettings', downgradeComponent({ component: AdminSettingsComponent }))
.directive('upgradedAdminAuthentication', downgradeComponent({ component: AdminAuthenticationComponent }))
.directive('authenticationCreate', downgradeComponent({ component: AuthenticationCreateComponent }))
.directive('contact', downgradeComponent({ component: ContactComponent }))
.directive('adminEventFormPreview', downgradeComponent({ component: AdminEventFormPreviewComponent }));
Expand Down Expand Up @@ -346,18 +348,25 @@ function config($httpProvider, $stateProvider, $urlRouterProvider, $animateProvi
resolve: resolveAdmin()
});

// Admin settings routes
$stateProvider.state('admin.settings', {
url: '/settings',
component: "upgradedAdminSettings",
// Security settings routes
$stateProvider.state('admin.security', {
url: '/security',
component: "upgradedAdminAuthentication",
resolve: resolveAdmin()
});

$stateProvider.state('admin.authenticationCreate', {
url: '/settings/new',
url: '/security/new',
component: "authenticationCreate",
resolve: resolveAdmin()
});

// Admin settings routes
$stateProvider.state('admin.settings', {
url: '/settings',
component: "upgradedAdminSettings",
resolve: resolveAdmin()
});
}

run.$inject = ['$rootScope', '$uibModal', '$state', 'Api'];
Expand Down

0 comments on commit 0ba8568

Please sign in to comment.