[DEV] it works without security

This commit is contained in:
Edouard DUPIN 2024-04-07 17:05:36 +02:00
parent 763875fbdf
commit 2402fc31ed
15 changed files with 61 additions and 85 deletions

View File

@ -29,13 +29,12 @@ const routes: Routes = [
{ {
path: 'home', path: 'home',
component: HomeScene, component: HomeScene,
canActivate: [OnlyUsersGuardHome], // this route to unregistered path when not logged ==> permit to simplify display // canActivate: [OnlyUsersGuardHome], // this route to unregistered path when not logged ==> permit to simplify display
}, },
/*
{ {
path: 'unregistered', path: 'unregistered',
component: HomeOutScene, component: HomeOutScene,
canActivate: [OnlyUnregisteredGuardHome], // jump to the home when registered // canActivate: [OnlyUnregisteredGuardHome], // jump to the home when registered
}, },
// ------------------------------------ // ------------------------------------
// -- SSO Generic interface // -- SSO Generic interface
@ -56,7 +55,7 @@ const routes: Routes = [
{ {
path: 'upload', path: 'upload',
component: UploadScene, component: UploadScene,
canActivate: [OnlyAdminGuard], // canActivate: [OnlyAdminGuard],
}, },
// ------------------------------------ // ------------------------------------
// -- gender: // -- gender:
@ -65,13 +64,13 @@ const routes: Routes = [
{ {
path: 'gender', path: 'gender',
component: GenderScene, component: GenderScene,
canActivate: [OnlyUsersGuard], // canActivate: [OnlyUsersGuard],
}, },
// display all (artist | album | traks) // display all (artist | album | traks)
{ {
path: 'gender/:genderId', path: 'gender/:genderId',
component: GenderScene, component: GenderScene,
canActivate: [OnlyUsersGuard], // canActivate: [OnlyUsersGuard],
}, },
//{ path: 'gender-edit/:genderId', component: GenderEditScene }, //{ path: 'gender-edit/:genderId', component: GenderEditScene },
@ -84,12 +83,12 @@ const routes: Routes = [
{ {
path: 'playlist', path: 'playlist',
component: PlaylistScene, component: PlaylistScene,
canActivate: [OnlyUsersGuard], // canActivate: [OnlyUsersGuard],
}, },
{ {
path: 'playlist/:playlistId', path: 'playlist/:playlistId',
component: PlaylistScene, component: PlaylistScene,
canActivate: [OnlyUsersGuard], // canActivate: [OnlyUsersGuard],
}, },
//{ path: 'playlist-edit/:playlistId', component: PlaylistEditScene }, //{ path: 'playlist-edit/:playlistId', component: PlaylistEditScene },
@ -101,23 +100,23 @@ const routes: Routes = [
{ {
path: 'artist', path: 'artist',
component: ArtistsScene, component: ArtistsScene,
canActivate: [OnlyUsersGuard], // canActivate: [OnlyUsersGuard],
}, },
// display list af all artist with a specific gender // display list af all artist with a specific gender
{ {
path: 'artist/:artistId', path: 'artist/:artistId',
component: ArtistScene, component: ArtistScene,
canActivate: [OnlyUsersGuard], // canActivate: [OnlyUsersGuard],
}, },
{ {
path: 'artist/:artistId/edit', path: 'artist/:artistId/edit',
component: ArtistEditScene, component: ArtistEditScene,
canActivate: [OnlyAdminGuard], // canActivate: [OnlyAdminGuard],
}, },
{ {
path: 'artist/:artistId/:albumId', path: 'artist/:artistId/:albumId',
component: ArtistAlbumScene, component: ArtistAlbumScene,
canActivate: [OnlyUsersGuard], // canActivate: [OnlyUsersGuard],
}, },
// ------------------------------------ // ------------------------------------
@ -127,17 +126,17 @@ const routes: Routes = [
{ {
path: 'album', path: 'album',
component: AlbumsScene, component: AlbumsScene,
canActivate: [OnlyUsersGuard], // canActivate: [OnlyUsersGuard],
}, },
{ {
path: 'album/:albumId/edit', path: 'album/:albumId/edit',
component: AlbumEditScene, component: AlbumEditScene,
canActivate: [OnlyAdminGuard], // canActivate: [OnlyAdminGuard],
}, },
{ {
path: 'album/:albumId', path: 'album/:albumId',
component: AlbumScene, component: AlbumScene,
canActivate: [OnlyUsersGuard], // canActivate: [OnlyUsersGuard],
}, },
// ------------------------------------ // ------------------------------------
@ -146,12 +145,12 @@ const routes: Routes = [
{ {
path: 'track/:trackId/edit', path: 'track/:trackId/edit',
component: TrackEditScene, component: TrackEditScene,
canActivate: [OnlyAdminGuard], // canActivate: [OnlyAdminGuard],
}, },
{ {
path: 'track/:genderId/:artistId/:albumId/:trackId', path: 'track/:genderId/:artistId/:albumId/:trackId',
component: TrackScene, component: TrackScene,
canActivate: [OnlyUsersGuard], // canActivate: [OnlyUsersGuard],
}, },
// ------------------------------------ // ------------------------------------
@ -160,13 +159,12 @@ const routes: Routes = [
{ {
path: 'settings', path: 'settings',
component: SettingsScene, component: SettingsScene,
canActivate: [OnlyUsersGuard], // canActivate: [OnlyUsersGuard],
}, },
{ {
path: '**', path: '**',
component: NotFound404Scene, component: NotFound404Scene,
}, },
*/
]; ];
@NgModule({ @NgModule({

View File

@ -1,8 +1,6 @@
<!-- Generic global menu --> <!-- Generic global menu -->
<karcw-top-menu [menu]="currentMenu" (callback)="eventOnMenu($event)"/> <karcw-top-menu [menu]="currentMenu" (callback)="eventOnMenu($event)"/>
<!-- all interfaced pages --> <!-- all interfaced pages -->
<router-outlet ></router-outlet>
<!--
<div class="main-content"> <div class="main-content">
@if(autoConnectedDone) { @if(autoConnectedDone) {
<router-outlet ></router-outlet> <router-outlet ></router-outlet>
@ -17,4 +15,3 @@
} }
</div> </div>
<app-element-player-audio></app-element-player-audio> <app-element-player-audio></app-element-player-audio>
-->

View File

@ -45,11 +45,11 @@ export class AppComponent implements OnInit {
location: string = "home"; location: string = "home";
constructor( constructor(
/*private userService: UserService,
private sessionService: SessionService, private sessionService: SessionService,
private ssoService: SSOService, private ssoService: SSOService,
private arianeService: ArianeService private arianeService: ArianeService,
*/) { private userService: UserService
) {
} }
@ -58,7 +58,6 @@ export class AppComponent implements OnInit {
this.isConnected = false; this.isConnected = false;
this.updateMainMenu(); this.updateMainMenu();
let self = this; let self = this;
/*
this.sessionService.change.subscribe((isConnected) => { this.sessionService.change.subscribe((isConnected) => {
console.log(`receive event from session ...${isConnected}`); console.log(`receive event from session ...${isConnected}`);
self.isConnected = isConnected; self.isConnected = isConnected;
@ -109,13 +108,11 @@ export class AppComponent implements OnInit {
//console.log(`>>> change trackId=${trackId}`); //console.log(`>>> change trackId=${trackId}`);
self.updateMainMenu(); self.updateMainMenu();
}); });
*/
} }
eventOnMenu(data: EventOnMenu): void { eventOnMenu(data: EventOnMenu): void {
//console.log(`plopppppppppp ${JSON.stringify(this.route.snapshot.url)}`); //console.log(`plopppppppppp ${JSON.stringify(this.route.snapshot.url)}`);
//console.log(`Get event on menu: ${JSON.stringify(data, null, 4)}`); console.log(`Get event on menu: ${JSON.stringify(data, null, 4)}`);
/*
switch (data.menu.otherData) { switch (data.menu.otherData) {
case MenuEventType.SSO_LOGIN: case MenuEventType.SSO_LOGIN:
this.ssoService.requestSignIn(); this.ssoService.requestSignIn();
@ -154,8 +151,6 @@ export class AppComponent implements OnInit {
case MenuEventType.PLAYLIST: case MenuEventType.PLAYLIST:
break; break;
} }
*/
} }
updateMainMenu(): void { updateMainMenu(): void {
console.log("update main menu :"); console.log("update main menu :");
@ -187,35 +182,35 @@ export class AppComponent implements OnInit {
title: this.getSegmentDisplayable(), title: this.getSegmentDisplayable(),
otherData: MenuEventType.TYPE, otherData: MenuEventType.TYPE,
callback: true, callback: true,
enable: true//!isNullOrUndefined(this.arianeService.getTypeId()), enable: !isNullOrUndefined(this.arianeService.getTypeId()),
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "person", icon: "person",
title: "true", //this.arianeService.getArtistName(), title: this.arianeService.getArtistName(),
otherData: MenuEventType.ARTIST, otherData: MenuEventType.ARTIST,
callback: true, callback: true,
enable: true// !isNullOrUndefined(this.arianeService.getArtistId()), enable: !isNullOrUndefined(this.arianeService.getArtistId()),
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "album", icon: "album",
title: "true", //this.arianeService.getAlbumName(), title: this.arianeService.getAlbumName(),
otherData: MenuEventType.ALBUM, otherData: MenuEventType.ALBUM,
callback: true, callback: true,
enable: true// !isNullOrUndefined(this.arianeService.getAlbumId()), enable: !isNullOrUndefined(this.arianeService.getAlbumId()),
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "music_note", icon: "music_note",
title: "true", //this.arianeService.getTrackName(), title: this.arianeService.getTrackName(),
otherData: MenuEventType.TRACK, otherData: MenuEventType.TRACK,
callback: true, callback: true,
enable: true// !isNullOrUndefined(this.arianeService.getTrackId()), enable: !isNullOrUndefined(this.arianeService.getTrackId()),
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "queue_music", icon: "queue_music",
title: "true",//this.arianeService.getPlaylistName(), title: "true",//this.arianeService.getPlaylistName(),
otherData: MenuEventType.PLAYLIST, otherData: MenuEventType.PLAYLIST,
callback: true, callback: true,
enable: true// !isNullOrUndefined(this.arianeService.getPlaylistId()), enable: !isNullOrUndefined(this.arianeService.getPlaylistId()),
} }
], ],
}, { }, {
@ -225,14 +220,14 @@ export class AppComponent implements OnInit {
subMenu: [ subMenu: [
{ {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
hover: "true", //`You are logged as: <b>${this.sessionService.getLogin()}</b>`, hover: `You are logged as: <b>${this.sessionService.getLogin()}</b>`,
title: "true", //`Sign in as ${this.sessionService.getLogin()}`, title: `Sign in as ${this.sessionService.getLogin()}`,
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "add_circle", icon: "add_circle",
title: "Add media", title: "Add media",
navigateTo: "upload", navigateTo: "upload",
enable: true, //this.sessionService.hasRight(UserRoles222.admin), enable: this.sessionService.hasRight(UserRoles222.admin),
}, { }, {
position: MenuPosition.LEFT, position: MenuPosition.LEFT,
icon: "settings", icon: "settings",
@ -284,7 +279,6 @@ export class AppComponent implements OnInit {
} }
getSegmentDisplayable(): string { getSegmentDisplayable(): string {
/*
let segment = this.arianeService.getCurrrentSegment(); let segment = this.arianeService.getCurrrentSegment();
if (segment === "artist") { if (segment === "artist") {
return "Artists" return "Artists"
@ -299,9 +293,8 @@ export class AppComponent implements OnInit {
return "Tracks" return "Tracks"
} }
if (segment === "playlist") { if (segment === "playlist") {
return "Playlistq" return "Playlist"
} }
*/
return ""; return "";
} }
} }

View File

@ -24,7 +24,7 @@ import { GenderService, DataService, PlaylistService, ArtistService, AlbumServic
import { UploadScene } from './scene/upload/upload'; import { UploadScene } from './scene/upload/upload';
import { ElementSeriesComponent, ElementTrackComponent, ElementSeasonComponent, ElementVideoComponent, ElementPlayerAudioComponent, DescriptionAreaComponent } from './component'; import { ElementSeriesComponent, ElementTrackComponent, ElementSeasonComponent, ElementVideoComponent, ElementPlayerAudioComponent, DescriptionAreaComponent } from './component';
import { ALL_COMPONENTS, ALL_SCENES, ALL_SERVICES, ALL_GUARDS, KarCWModule, UserService, TopMenuComponent } from '@kangaroo-and-rabbit/kar-cw'; import { ALL_COMPONENTS, ALL_SCENES, ALL_SERVICES, ALL_GUARDS, KarCWModule, UserService, TopMenuComponent } from '@kangaroo-and-rabbit/kar-cw';
import { KarusicEnvironmentService, environment } from 'environments/environment'; import { environment } from 'environments/environment';
import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
@ -72,10 +72,10 @@ import { CommonModule } from "@angular/common";
KarCWModule, KarCWModule,
], ],
providers: [ providers: [
/*KarusicEnvironmentService, { provide: 'ENVIRONMENT', useValue: environment },
{ provide: 'ENVIRONMENT', useValue: KarusicEnvironmentService },
//...ALL_SERVICES, //...ALL_SERVICES,
//...ALL_GUARDS, //...ALL_GUARDS,
ArianeService,
PlayerService, PlayerService,
GenderService, GenderService,
DataService, DataService,
@ -83,8 +83,6 @@ import { CommonModule } from "@angular/common";
ArtistService, ArtistService,
AlbumService, AlbumService,
TrackService, TrackService,
ArianeService,
*/
], ],
exports: [ exports: [
//...ALL_COMPONENTS, //...ALL_COMPONENTS,

View File

@ -17,8 +17,8 @@
.controls-inner { .controls-inner {
position: relative; position: relative;
width: fill; //width: fill;
height: fill; //height: fill;
font-family: monospace; font-family: monospace;
color: white; color: white;
margin: 10px 15px 1px 15px; margin: 10px 15px 1px 15px;
@ -44,7 +44,7 @@
.slider { .slider {
position: relative; position: relative;
-webkit-appearance: none; //-webkit-appearance: none;
width: 100%; width: 100%;
height: 10px; height: 10px;
top: 5px; top: 5px;

View File

@ -5,7 +5,7 @@
<div class="fill-all colomn_mutiple"> <div class="fill-all colomn_mutiple">
@for (data of dataList; track data.id) { @for (data of dataList; track data.id) {
<div class="item-home" (click)="onSelectType($event, data.id)" (auxclick)="onSelectType($event, data.id)"> <div class="item-home" (click)="onSelectType($event, data.id)" (auxclick)="onSelectType($event, data.id)">
<app-element-type [element]="data"></app-element-type> <app-element-type [element]="data"/>
</div> </div>
} }
<div class="clear"></div> <div class="clear"></div>

View File

@ -11,7 +11,7 @@ import { ArianeService, GenderService } from 'app/service';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
templateUrl: './home.html', templateUrl: './home.html',
styleUrls: [ './home.less' ] styleUrls: ['./home.less']
}) })
export class HomeScene implements OnInit { export class HomeScene implements OnInit {
dataList = [ dataList = [
@ -53,17 +53,17 @@ export class HomeScene implements OnInit {
*/ */
this.arianeService.reset(); this.arianeService.reset();
} }
onSelectType(event: any, idSelected: number):void { onSelectType(event: any, idSelected: number): void {
if (idSelected === 1) { if (idSelected === 1) {
this.arianeService.navigateGender({newWindows: event.which === 2}); this.arianeService.navigateGender({ newWindows: event.which === 2 });
} else if (idSelected === 2) { } else if (idSelected === 2) {
this.arianeService.navigateArtist({newWindows: event.which === 2}); this.arianeService.navigateArtist({ newWindows: event.which === 2 });
} else if (idSelected === 3) { } else if (idSelected === 3) {
this.arianeService.navigateAlbum({newWindows: event.which === 2}); this.arianeService.navigateAlbum({ newWindows: event.which === 2 });
} else if (idSelected === 4) { } else if (idSelected === 4) {
this.arianeService.navigateTrack({newWindows: event.which === 2}); this.arianeService.navigateTrack({ newWindows: event.which === 2 });
} else if (idSelected === 5) { } else if (idSelected === 5) {
this.arianeService.navigatePlaylist({newWindows: event.which === 2}); this.arianeService.navigatePlaylist({ newWindows: event.which === 2 });
} }
} }
} }

View File

@ -28,6 +28,7 @@ export class AlbumService extends GenericDataService<Album> {
constructor(private session: SessionService) { constructor(private session: SessionService) {
super(); super();
console.log('Start AlbumService');
this.setStore(new DataStore<Album>(() => this.lambdaGets())); this.setStore(new DataStore<Album>(() => this.lambdaGets()));
} }

View File

@ -58,7 +58,7 @@ export class ArianeService {
private artistService: ArtistService, private artistService: ArtistService,
private albumService: AlbumService, private albumService: AlbumService,
private trackService: TrackService) { private trackService: TrackService) {
//console.log('Start ArianeService'); console.log('Start ArianeService');
//this.route. //this.route.
let self = this; let self = this;
this.router.events.subscribe((event: any) => { this.router.events.subscribe((event: any) => {

View File

@ -28,6 +28,7 @@ export class ArtistService extends GenericDataService<Artist> {
constructor(private session: SessionService) { constructor(private session: SessionService) {
super(); super();
console.log('Start ArtistService');
const self = this; const self = this;
this.setStore(new DataStore<Artist>(() => self.lambdaGets())); this.setStore(new DataStore<Artist>(() => self.lambdaGets()));
} }

View File

@ -33,6 +33,7 @@ export class GenderService extends GenericDataService<Gender> {
constructor(private session: SessionService) { constructor(private session: SessionService) {
super(); super();
console.log('Start GenderService');
const self = this; const self = this;
this.setStore(new DataStore<Gender>(() => this.lambdaGets())); this.setStore(new DataStore<Gender>(() => this.lambdaGets()));
} }

View File

@ -27,6 +27,7 @@ export class PlaylistService extends GenericDataService<Playlist> {
constructor(private session: SessionService) { constructor(private session: SessionService) {
super(); super();
console.log('Start PlaylistService');
const self = this; const self = this;
this.setStore(new DataStore<Playlist>(() => this.lambdaGets())); this.setStore(new DataStore<Playlist>(() => this.lambdaGets()));
} }

View File

@ -27,6 +27,7 @@ export class TrackService extends GenericDataService<Track> {
constructor(private session: SessionService) { constructor(private session: SessionService) {
super(); super();
console.log('Start TrackService');
const self = this; const self = this;
this.setStore(new DataStore<Track>(() => this.lambdaGets())); this.setStore(new DataStore<Track>(() => this.lambdaGets()));
} }

View File

@ -3,7 +3,9 @@
// `ng build --env=prod` then `environment.prod.ts` will be used instead. // `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`. // The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = { import { Environment } from "@kangaroo-and-rabbit/kar-cw";
export const environment: Environment = {
production: true, production: true,
// URL of development API // URL of development API
applName: "karusic", applName: "karusic",

View File

@ -3,12 +3,11 @@
// `ng build --env=prod` then `environment.prod.ts` will be used instead. // `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`. // The list of which env maps to which file can be found in `.angular-cli.json`.
import { Injectable } from "@angular/core"; import { Environment } from "@kangaroo-and-rabbit/kar-cw";
import { EnvironmentService } from '@kangaroo-and-rabbit/kar-cw';
const serverSSOAddress = 'http://atria-soft.org' const serverSSOAddress = 'http://atria-soft.org'
const environment_back_prod = { const environment_back_prod: Environment = {
production: false, production: false,
// URL of development API // URL of development API
applName: "karusic", applName: "karusic",
@ -24,7 +23,7 @@ const environment_back_prod = {
tokenStoredInPermanentStorage: false, tokenStoredInPermanentStorage: false,
}; };
const environment_local = { const environment_local: Environment = {
production: false, production: false,
// URL of development API // URL of development API
applName: "karusic", applName: "karusic",
@ -40,7 +39,7 @@ const environment_local = {
tokenStoredInPermanentStorage: false, tokenStoredInPermanentStorage: false,
}; };
const environment_full_local = { const environment_full_local: Environment = {
production: false, production: false,
// URL of development API // URL of development API
applName: "karusic", applName: "karusic",
@ -56,7 +55,7 @@ const environment_full_local = {
tokenStoredInPermanentStorage: false, tokenStoredInPermanentStorage: false,
}; };
const environment_hybrid = { const environment_hybrid: Environment = {
production: false, production: false,
// URL of development API // URL of development API
applName: "karusic", applName: "karusic",
@ -73,19 +72,3 @@ const environment_hybrid = {
}; };
export const environment = environment_local; export const environment = environment_local;
@Injectable({ providedIn: 'root' })
export class KarusicEnvironmentService extends EnvironmentService {
public production = environment.production;
// URL of development API
public applName = environment.applName;
public defaultServer = environment.defaultServer;
public server = environment.server;
public ssoSite = environment.ssoSite;
public ssoSignIn = environment.ssoSignIn;
public ssoSignUp = environment.ssoSignUp;
public ssoSignOut = environment.ssoSignOut;
public tokenStoredInPermanentStorage = environment.tokenStoredInPermanentStorage;
};