Skip to content

Commit bdbc898

Browse files
authored
feat(backend): New Backend and authentication for Phonebook data. (#7)
The following are the changes, most of them are breaking changes: - replace the json file with a real backend - the backend connects directly to a database - currently, it try to return the same stuff as the old JSON file - Open Source the backend - add authentification to the people data - currently, supported is WsFederation over Azure or ADFS (and tested) There are some issues that currently are known: - the search for numbers is broken - this is not related to this change but good to know (#591 ) - the last hierarchy in the org structure isn't visible in any view - organigram - users supervisor - Users organigram information - after login the user is redirected to `/` and not to the path the redirection starts. (#586 ) - the picture backend asked for login - this will change soon because we plan to use the same auth like this backend. But we must ship this because the old source is broken. (after more than 15 years!) So let's ![ship it gif](https://media1.tenor.com/images/6727709a62756a117203bbbf42c23ad9/tenor.gif?itemid=14131994) BREAKING CHANGE closes #18 closes #271
1 parent 6c4a130 commit bdbc898

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2365
-517
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
11
# TODO: #18
2+
trigger: none
3+
pr:
4+
branches:
5+
include:
6+
- master
7+
paths:
8+
include:
9+
- Phonebook.Source.PeopleSoft/**
10+
11+
jobs:
12+
- job: build
13+
displayName: build docker image
14+
pool:
15+
vmImage: 'ubuntu-16.04'
16+
steps:
17+
- bash: |
18+
docker build .
19+
workingDirectory: 'Phonebook.Source.PeopleSoft/'
Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1-
# TODO: #18
1+
trigger:
2+
batch: true
3+
branches:
4+
include:
5+
- master
6+
paths:
7+
include:
8+
- Phonebook.Source.PeopleSoft/
9+
pr: none
10+
11+
jobs:
12+
- job: build
13+
displayName: build docker image
14+
pool:
15+
vmImage: 'ubuntu-16.04'
16+
steps:
17+
- bash: |
18+
docker build -t $dockerRepo:$tag .
19+
docker login -u $DOCKER_REGISTRY_USER -p $DOCKER_REGISTRY_PASSWORD
20+
docker push $dockerRepo:$tag
21+
workingDirectory: 'Phonebook.Source.PeopleSoft/'
22+
env:
23+
DOCKER_REGISTRY_PASSWORD: $(DOCKER_REGISTRY_PASSWORD)
24+
DOCKER_REGISTRY_USER: $(DOCKER_REGISTRY_USER)
25+
dockerRepo: tsystemsmms/phonebook-build
26+
tag: source-peoplesoft

.vscode/launch.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
// Use IntelliSense to find out which attributes exist for C# debugging
3+
// Use hover for the description of the existing attributes
4+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (web)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/Phonebook.Source.PeopleSoft/src/Phonebook.Source.PeopleSoft/bin/Debug/netcoreapp2.2/Phonebook.Source.PeopleSoft.dll",
14+
"args": [],
15+
"cwd": "${workspaceFolder}/Phonebook.Source.PeopleSoft/src/Phonebook.Source.PeopleSoft",
16+
"stopAtEntry": false,
17+
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
18+
"serverReadyAction": {
19+
"action": "openExternally",
20+
"pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
21+
},
22+
"env": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
},
25+
"sourceFileMap": {
26+
"/Views": "${workspaceFolder}/Views"
27+
}
28+
},
29+
{
30+
"name": ".NET Core Attach",
31+
"type": "coreclr",
32+
"request": "attach",
33+
"processId": "${command:pickProcess}"
34+
}
35+
]
36+
}

.vscode/tasks.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/Phonebook.Source.PeopleSoft/src/Phonebook.Source.PeopleSoft/Phonebook.Source.PeopleSoft.csproj"
11+
],
12+
"problemMatcher": "$tsc"
13+
},
14+
{
15+
"label": "publish",
16+
"command": "dotnet",
17+
"type": "process",
18+
"args": [
19+
"publish",
20+
"${workspaceFolder}/Phonebook.Source.PeopleSoft/src/Phonebook.Source.PeopleSoft/Phonebook.Source.PeopleSoft.csproj"
21+
],
22+
"problemMatcher": "$tsc"
23+
},
24+
{
25+
"label": "watch",
26+
"command": "dotnet",
27+
"type": "process",
28+
"args": [
29+
"watch",
30+
"run",
31+
"${workspaceFolder}/Phonebook.Source.PeopleSoft/src/Phonebook.Source.PeopleSoft/Phonebook.Source.PeopleSoft.csproj"
32+
],
33+
"problemMatcher": "$tsc"
34+
}
35+
]
36+
}

Phonebook.Frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"scripts": {
66
"ng": "ng",
77
"start": "npm run start:en",
8-
"start:en": "concurrently -n mock-backend,assets,angular \"docker run --rm -p 8080:80 --name phonebook-backend-mock tsystemsmms/phonebook-build:mock-backend\" \"docker run --rm -p 8081:80 --name phonebook-assets tsystemsmms/phonebook-build:assets\" \"ng serve --ssl --proxy-config proxy.conf.json --configuration en\"",
9-
"start:de": "concurrently -n mock-backend,assets,angular \"docker run --rm -p 8080:80 --name phonebook-backend-mock tsystemsmms/phonebook-build:mock-backend\" \"docker run --rm -p 8081:80 --name phonebook-assets tsystemsmms/phonebook-build:assets\" \"ng serve --ssl --proxy-config proxy.conf.json --configuration de\"",
8+
"start:en": "concurrently -n mock-backend,assets,angular \"docker run --rm -p 8080:80 --name phonebook-source-mock -e ASPNETCORE_ENVIRONMENT=Development tsystemsmms/phonebook-build:source-peoplesoft\" \"docker run --rm -p 8081:80 --name phonebook-assets tsystemsmms/phonebook-build:assets\" \"ng serve --ssl --proxy-config proxy.conf.json --configuration en\"",
9+
"start:de": "concurrently -n mock-backend,assets,angular \"docker run --rm -p 8080:80 --name phonebook-source-mock -e ASPNETCORE_ENVIRONMENT=Development tsystemsmms/phonebook-build:source-peoplesoft\" \"docker run --rm -p 8081:80 --name phonebook-assets tsystemsmms/phonebook-build:assets\" \"ng serve --ssl --proxy-config proxy.conf.json --configuration de\"",
1010
"start:debug": "ng serve --ssl --proxy-config=proxy.conf.json --configuration debug",
1111
"start-compose": "npm run compose-build && docker-compose run --rm --service-ports angular npm run start:en",
1212
"start-compose:debug": "npm run compose-build && docker-compose run --rm --service-ports angular npm run start:debug",

Phonebook.Frontend/proxy.conf.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{
2+
"/signin-wsfed": {
3+
"target": "http://localhost:8080",
4+
"secure": false,
5+
"changeOrigin": true,
6+
"logLevel": "debug"
7+
},
28
"/api/*": {
39
"target": "http://localhost:8080",
410
"secure": false,
511
"changeOrigin": true,
6-
"pathRewrite": {
7-
"^/api": ""
8-
},
912
"logLevel": "debug"
1013
},
1114
"/external_assets/*": {

Phonebook.Frontend/src/app/app.module.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//Angular Imports
22
import { DragDropModule } from '@angular/cdk/drag-drop';
33
import { PlatformModule } from '@angular/cdk/platform';
4-
import { HttpClientModule } from '@angular/common/http';
4+
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
55
import { NgModule } from '@angular/core';
66
import { MatBadgeModule } from '@angular/material/badge';
77
import { MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
@@ -52,6 +52,7 @@ import { environment } from 'src/environments/environment';
5252
// Services
5353
import { FloorplanService } from './services/floorplan.service';
5454
import { SearchComponent } from './shared/components/search/search.component';
55+
import { HttpRedirectToLogin } from 'src/app/shared/interceptors/HttpRedirectToLogin';
5556

5657
declare const require;
5758

@@ -95,6 +96,7 @@ declare const require;
9596
UserPagesModule
9697
],
9798
providers: [
99+
{ provide: HTTP_INTERCEPTORS, useClass: HttpRedirectToLogin, multi: true },
98100
// {
99101
// provide: TRANSLATIONS,
100102
// useFactory: (locale: string) => {
@@ -115,4 +117,4 @@ declare const require;
115117
],
116118
bootstrap: [AppComponent]
117119
})
118-
export class AppModule {}
120+
export class AppModule { }

Phonebook.Frontend/src/app/modules/rooms/components/city/city.component.html

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</mat-card-header>
3131
<img
3232
mat-card-image
33-
[src]="runtimeEnvironment.assetsEndpoint + location.LinkPicture"
33+
[src]="runtimeEnvironment.assetsEndpoint + '/locations/' + location.LinkPicture"
3434
[alt]="location.LinkRoutingInfo"
3535
/>
3636
<mat-card-content>
@@ -43,16 +43,11 @@ <h3 mat-subheader>
4343
[href]="location.LinkRoutingWebsite"
4444
target="_blank"
4545
rel="noopener"
46-
*ngIf="
47-
location.LinkRoutingWebsite != '' &&
48-
location.LinkRoutingWebsite != null
49-
"
46+
*ngIf="location.LinkRoutingWebsite != '' && location.LinkRoutingWebsite != null"
5047
class="mat-small"
5148
>
5249
<mat-icon>open_in_new</mat-icon>
53-
<span i18n="@@GeneralShowOnMapButton"
54-
>Show on Google-Maps</span
55-
>
50+
<span i18n="@@GeneralShowOnMapButton">Show on Google-Maps</span>
5651
</a>
5752
</h3>
5853
<mat-list-item>
@@ -61,12 +56,7 @@ <h3 mat-subheader>
6156
</div>
6257
</mat-list-item>
6358
<h3 mat-subheader i18n="@@DataLocationContact">Contact</h3>
64-
<mat-list-item
65-
*ngIf="
66-
location.ReceptionPhone != '' &&
67-
location.ReceptionPhone != null
68-
"
69-
>
59+
<mat-list-item *ngIf="location.ReceptionPhone != '' && location.ReceptionPhone != null">
7060
<mat-icon mat-list-icon>call</mat-icon>
7161
<h4 mat-line i18n="@@ColumnTitlePhone">Phone</h4>
7262
<p mat-line>
@@ -81,43 +71,27 @@ <h4 mat-line i18n="@@ColumnTitlePhone">Phone</h4>
8171
</button>
8272
</p>
8373
</mat-list-item>
84-
<mat-list-item
85-
*ngIf="
86-
location.ReceptionFax != '' && location.ReceptionFax != null
87-
"
88-
>
74+
<mat-list-item *ngIf="location.ReceptionFax != '' && location.ReceptionFax != null">
8975
<mat-icon mat-list-icon>print</mat-icon>
9076
<h4 mat-line i18n="@@DataPersonFax">Fax</h4>
9177
<p mat-line>
92-
<button
93-
mat-button
94-
actionDrawer
95-
[copy]="location.ReceptionFax"
96-
>
78+
<button mat-button actionDrawer [copy]="location.ReceptionFax">
9779
{{ location.ReceptionFax }}
9880
</button>
99-
</p></mat-list-item
100-
>
81+
</p>
82+
</mat-list-item>
10183

102-
<mat-list-item
103-
*ngIf="
104-
location.ContactPerson != '' && location.ContactPerson != null
105-
"
106-
>
84+
<mat-list-item *ngIf="location.ContactPerson != '' && location.ContactPerson != null">
10785
<mat-icon mat-list-icon>person</mat-icon>
10886
<h4 mat-line i18n="@@DataLocationContactPerson">
10987
Contact Person
11088
</h4>
11189
<p mat-line>
112-
<button
113-
mat-button
114-
stopPropagation
115-
[routerLink]="['/search/' + location.ContactPerson]"
116-
>
90+
<button mat-button stopPropagation [routerLink]="['/search/' + location.ContactPerson]">
11791
{{ location.ContactPerson }}
11892
</button>
119-
</p></mat-list-item
120-
>
93+
</p>
94+
</mat-list-item>
12195
</mat-list>
12296
</mat-card-content>
12397
</mat-card>

Phonebook.Frontend/src/app/modules/rooms/components/room/room.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class RoomDetailComponent implements OnInit {
5555
this.room = this.node.data as Room;
5656
}
5757
this.personService
58-
.getPersonsByRoom(RoomHelpers.getParamsAsArray(params, ['cityId', 'buildingId', 'floorId', 'roomId']))
58+
.getPersonsByRoom(RoomHelpers.getParamsAsArray(params, ['roomId'])[0])
5959
.subscribe(person => {
6060
this.persons = person;
6161
});

Phonebook.Frontend/src/app/modules/table/helpers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ export class Helpers {
9393
* Removes Accents from the string.
9494
* @param str Any String
9595
*/
96-
public static removeAccents(str: string): string {
96+
public static removeAccents(str: string | null): string {
97+
if(str === null){
98+
return '';
99+
}
97100
return str.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
98101
}
99102
}

0 commit comments

Comments
 (0)