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

View File

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

View File

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

View File

@ -24,7 +24,7 @@ import { GenderService, DataService, PlaylistService, ArtistService, AlbumServic
import { UploadScene } from './scene/upload/upload';
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 { KarusicEnvironmentService, environment } from 'environments/environment';
import { environment } from 'environments/environment';
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { CommonModule } from "@angular/common";
@ -72,10 +72,10 @@ import { CommonModule } from "@angular/common";
KarCWModule,
],
providers: [
/*KarusicEnvironmentService,
{ provide: 'ENVIRONMENT', useValue: KarusicEnvironmentService },
{ provide: 'ENVIRONMENT', useValue: environment },
//...ALL_SERVICES,
//...ALL_GUARDS,
ArianeService,
PlayerService,
GenderService,
DataService,
@ -83,8 +83,6 @@ import { CommonModule } from "@angular/common";
ArtistService,
AlbumService,
TrackService,
ArianeService,
*/
],
exports: [
//...ALL_COMPONENTS,

View File

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

View File

@ -5,7 +5,7 @@
<div class="fill-all colomn_mutiple">
@for (data of dataList; track 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 class="clear"></div>

View File

@ -11,7 +11,7 @@ import { ArianeService, GenderService } from 'app/service';
@Component({
selector: 'app-home',
templateUrl: './home.html',
styleUrls: [ './home.less' ]
styleUrls: ['./home.less']
})
export class HomeScene implements OnInit {
dataList = [
@ -53,17 +53,17 @@ export class HomeScene implements OnInit {
*/
this.arianeService.reset();
}
onSelectType(event: any, idSelected: number):void {
onSelectType(event: any, idSelected: number): void {
if (idSelected === 1) {
this.arianeService.navigateGender({newWindows: event.which === 2});
this.arianeService.navigateGender({ newWindows: event.which === 2 });
} else if (idSelected === 2) {
this.arianeService.navigateArtist({newWindows: event.which === 2});
this.arianeService.navigateArtist({ newWindows: event.which === 2 });
} else if (idSelected === 3) {
this.arianeService.navigateAlbum({newWindows: event.which === 2});
this.arianeService.navigateAlbum({ newWindows: event.which === 2 });
} else if (idSelected === 4) {
this.arianeService.navigateTrack({newWindows: event.which === 2});
this.arianeService.navigateTrack({ newWindows: event.which === 2 });
} 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) {
super();
console.log('Start AlbumService');
this.setStore(new DataStore<Album>(() => this.lambdaGets()));
}

View File

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

View File

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

View File

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

View File

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

View File

@ -27,6 +27,7 @@ export class TrackService extends GenericDataService<Track> {
constructor(private session: SessionService) {
super();
console.log('Start TrackService');
const self = this;
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.
// 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,
// URL of development API
applName: "karusic",

View File

@ -3,12 +3,11 @@
// `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`.
import { Injectable } from "@angular/core";
import { EnvironmentService } from '@kangaroo-and-rabbit/kar-cw';
import { Environment } from "@kangaroo-and-rabbit/kar-cw";
const serverSSOAddress = 'http://atria-soft.org'
const environment_back_prod = {
const environment_back_prod: Environment = {
production: false,
// URL of development API
applName: "karusic",
@ -24,7 +23,7 @@ const environment_back_prod = {
tokenStoredInPermanentStorage: false,
};
const environment_local = {
const environment_local: Environment = {
production: false,
// URL of development API
applName: "karusic",
@ -40,7 +39,7 @@ const environment_local = {
tokenStoredInPermanentStorage: false,
};
const environment_full_local = {
const environment_full_local: Environment = {
production: false,
// URL of development API
applName: "karusic",
@ -56,7 +55,7 @@ const environment_full_local = {
tokenStoredInPermanentStorage: false,
};
const environment_hybrid = {
const environment_hybrid: Environment = {
production: false,
// URL of development API
applName: "karusic",
@ -73,19 +72,3 @@ const environment_hybrid = {
};
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;
};