[DEV] update version that is first full work

This commit is contained in:
Edouard DUPIN 2024-04-13 08:59:13 +02:00
parent da0e6ac9ea
commit 1950162a99
13 changed files with 1530 additions and 343 deletions

View File

@ -27,6 +27,10 @@ deploy the environment
cd dist/kar-cw
pnpm publish --no-git-checks
```
or
```bash
pnpm run deploy
```
Use development mode for the library:
=====================================

View File

@ -1,12 +1,11 @@
{
"name": "@kangaroo-and-rabbit/kar-cw",
"version": "0.1.7",
"version": "0.2.0",
"sideEffects": false,
"scripts": {
"dev": "ng build kar-cw --watch --configuration development",
"build": "ng build kar-cw",
"build": "ng build kar-cw --configuration production",
"deploy": "cd dist/kar-cw && pnpm publish --no-git-checks",
"link": "cd dist/kar-cw && pnpm link # TODO this in sudo ...",
"test": "ng test",
"lint": "ng lint",
"style": "prettier --write .",
@ -14,32 +13,33 @@
"install_dependency": "pnpm install"
},
"peerDependencies": {
"@angular/common": "^17.3.0",
"@angular/compiler": "^17.3.0",
"@angular/core": "^17.3.0",
"@angular/forms": "^17.3.0",
"@angular/platform-browser": "^17.3.0",
"@angular/platform-browser-dynamic": "^17.3.0",
"@angular/router": "^17.3.0",
"@angular/common": "^17.3.3",
"@angular/compiler": "^17.3.3",
"@angular/core": "^17.3.3",
"@angular/forms": "^17.3.3",
"@angular/platform-browser": "^17.3.3",
"@angular/platform-browser-dynamic": "^17.3.3",
"@angular/router": "^17.3.3",
"rxjs": "~7.8.0",
"zone.js": "~0.14.3"
},
"dependencies": {
"tslib": "^2.3.0"
"tslib": "^2.6.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.3.1",
"@angular/cli": "^17.3.1",
"@angular/compiler-cli": "^17.3.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
"@angular-devkit/build-angular": "^17.3.3",
"@angular/cli": "^17.3.3",
"@angular/compiler-cli": "^17.3.3",
"@types/jasmine": "~5.1.4",
"jasmine-core": "~5.1.2",
"karma": "~6.4.3",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-coverage": "~2.2.1",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"ng-packagr": "^17.3.0",
"typescript": "~5.4.2"
"ng-packagr": "^17.3.3",
"typescript": "~5.4.4",
"npm-check-updates": "^16.14.18"
},
"maintainers": [
{

File diff suppressed because it is too large Load Diff

View File

@ -29,8 +29,6 @@ import { ALL_GUARDS } from "./kar-cw.guard";
exports: [
...ALL_COMPONENTS,
...ALL_SCENES,
//...ALL_SERVICES,
//...ALL_GUARDS,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
})

View File

@ -6,9 +6,7 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
@Injectable()
export class CookiesService {
constructor() {
console.log("Start CookiesService");

View File

@ -53,9 +53,7 @@ export interface ModelResponseHttp {
/**
* This service permit to add some data like token and authorization.. ir automatically get the token if needed and retake it if expired...
*/
@Injectable({
providedIn: 'root',
})
@Injectable()
export class HttpWrapperService {
private displayReturn: boolean = false;
constructor(

View File

@ -7,9 +7,7 @@
import { Inject, Injectable } from '@angular/core';
import { Environment } from '../model/environment';
@Injectable({
providedIn: 'root',
})
@Injectable()
export class StorageService {
private baseLocalStorageName: string;

View File

@ -6,9 +6,7 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
@Injectable()
export class NotificationService {
constructor() {

View File

@ -6,9 +6,7 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
@Injectable()
export class PopInService {
private popinList: any[] = [];

View File

@ -15,21 +15,21 @@ export enum UserRoles222 {
guest = 'guest',
}
@Injectable({
providedIn: 'root',
})
@Injectable()
export class SessionService {
private tokenJwt?: string;
public userLogin?: string;
public userId?: string;
public applName?: string;
public right: any = {};
@Output() change: EventEmitter<boolean> = new EventEmitter();
constructor(
@Inject('ENVIRONMENT') private environment: Environment,
@Inject('ENVIRONMENT') environment: Environment,
) {
console.log("Start SessionService");
this.applName = environment.applName;
}
/**
@ -69,10 +69,10 @@ export class SessionService {
if (isNullOrUndefined(jsonModel.right)) {
return {};
}
if (isNullOrUndefined(jsonModel.right[this.environment.applName])) {
if (isNullOrUndefined(jsonModel.right[this.applName])) {
return {};
}
return jsonModel.right[this.environment.applName];
return jsonModel.right[this.applName];
}
/**
* @brief destroy the current session.
@ -88,7 +88,7 @@ export class SessionService {
getToken(): string | undefined {
return this.tokenJwt;
}
islogged() {
isLogged() {
return this.userId !== null;
}
hasRight(type: UserRoles222): boolean {
@ -127,66 +127,60 @@ export class SessionService {
}
}
@Injectable({
providedIn: 'root',
})
@Injectable()
export class OnlyUsersGuard {
constructor(private sessionService: SessionService, private router: Router) { }
canActivate() {
console.log(`OnlyUsersGuard : ${this.sessionService}`)
console.log('OnlyLoggedInUsers');
if (this.sessionService.hasRight(UserRoles222.user) || this.sessionService.hasRight(UserRoles222.admin)) {
if (this.sessionService.hasRight(UserRoles222.user)
|| this.sessionService.hasRight(UserRoles222.admin)) {
return true;
} else {
this.router.navigateByUrl('/forbidden');
return false;
}
return true;
this.router.navigateByUrl('/forbidden');
return false;
}
}
@Injectable({
providedIn: 'root',
})
@Injectable()
export class OnlyUsersGuardHome {
constructor(private sessionService: SessionService, private router: Router) { }
canActivate() {
if (this.sessionService.hasRight(UserRoles222.user) || this.sessionService.hasRight(UserRoles222.admin)) {
return true;
} else {
if (!this.sessionService.isLogged()) {
this.router.navigateByUrl('/unregistered');
return false;
}
return true;
if (this.sessionService.hasRight(UserRoles222.user)
|| this.sessionService.hasRight(UserRoles222.admin)) {
return true;
}
this.router.navigateByUrl('/forbidden');
return false;
}
}
@Injectable({
providedIn: 'root',
})
@Injectable()
export class OnlyUnregisteredGuardHome {
constructor(private sessionService: SessionService, private router: Router) { }
canActivate() {
if (!this.sessionService.islogged()) {
return true;
} else {
if (this.sessionService.isLogged()) {
this.router.navigateByUrl('/home');
return false;
}
return true;
}
}
@Injectable({
providedIn: 'root',
})
@Injectable()
export class OnlyAdminGuard {
constructor(private sessionService: SessionService, private router: Router) { }
canActivate() {
if (this.sessionService.hasRight(UserRoles222.user)) {
return true;
} else {
if (!this.sessionService.hasRight(UserRoles222.user)) {
this.router.navigateByUrl('/forbidden');
return false;
}

View File

@ -9,9 +9,7 @@ import { Environment } from '../model/environment';
import { getApplicationLocation, isInArray, isNullOrUndefined } from '../utils';
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
@Injectable({
providedIn: 'root',
})
@Injectable()
export class SSOService {
signUpEnable?: boolean;

View File

@ -15,9 +15,7 @@ import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp }
import { Environment } from '../model/environment';
@Injectable({
providedIn: 'root',
})
@Injectable()
export class UserService {
// 0: Not hide password; 1 hide password;
private identificationVersion: number = 1;

View File

@ -1,4 +1,5 @@
import { getApplicationLocation } from './applPath';
import { arrayUnique } from './arrayTools';
import { DataStore } from './data-store';
import { DataTools, TypeCheck } from './data-tools';
import { sha512 } from './sha512';
@ -50,4 +51,5 @@ export {
isStringNullOrUndefined,
isUndefined,
sha512,
arrayUnique,
};