@@ -23,16 +24,13 @@
{{application.ttl}} |
{{application.notification}} |
- |
@@ -41,24 +39,19 @@
-
+
Create new application
Add a new application on the server
+
-
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/front/src/app/scene/application/applications.less b/front/src/base/scene/application/applications.less
similarity index 100%
rename from front/src/app/scene/application/applications.less
rename to front/src/base/scene/application/applications.less
diff --git a/front/src/app/scene/application/applications.ts b/front/src/base/scene/application/applications.ts
similarity index 96%
rename from front/src/app/scene/application/applications.ts
rename to front/src/base/scene/application/applications.ts
index b6649d5..0978991 100644
--- a/front/src/app/scene/application/applications.ts
+++ b/front/src/base/scene/application/applications.ts
@@ -6,7 +6,7 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
-import { ApplicationService, ApplicationModel } from 'app/service';
+import { ApplicationService, ApplicationModel } from 'base/service';
import { AsyncActionState } from 'common/component';
import { CheckerParameterType, SettingsItem, SettingType } from 'common/component/render-settings/render-settings';
import { NotificationService, PopInService } from 'common/service';
@@ -83,7 +83,7 @@ export class ApplicationsScene implements OnInit {
createApplicationMenu: SettingsItem[] = []
-
+
// this permit to clear the input menu...
configureInput() {
this.createApplicationMenu = [
@@ -93,7 +93,7 @@ export class ApplicationsScene implements OnInit {
placeholder: 'Enter application name',
key: 'name',
value: '',
- checker: (value) => { return this.checkName(value)},
+ checker: (value) => { return this.checkName(value) },
require: true,
},
{
@@ -102,7 +102,7 @@ export class ApplicationsScene implements OnInit {
placeholder: 'Enter http redirect adresses',
key: 'redirect',
value: '',
- checker: (value) => { return this.checkRedirect(value)},
+ checker: (value) => { return this.checkRedirect(value) },
require: true,
},
];
diff --git a/front/src/app/scene/change-password/change-password.html b/front/src/base/scene/change-password/change-password.html
similarity index 100%
rename from front/src/app/scene/change-password/change-password.html
rename to front/src/base/scene/change-password/change-password.html
diff --git a/front/src/app/scene/change-password/change-password.less b/front/src/base/scene/change-password/change-password.less
similarity index 100%
rename from front/src/app/scene/change-password/change-password.less
rename to front/src/base/scene/change-password/change-password.less
diff --git a/front/src/app/scene/change-password/change-password.ts b/front/src/base/scene/change-password/change-password.ts
similarity index 88%
rename from front/src/app/scene/change-password/change-password.ts
rename to front/src/base/scene/change-password/change-password.ts
index f609f21..4c2f199 100644
--- a/front/src/app/scene/change-password/change-password.ts
+++ b/front/src/base/scene/change-password/change-password.ts
@@ -7,7 +7,7 @@
import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { createPasswordState } from 'common/utils';
-import { AdminUserService } from 'app/service';
+import { AdminUserService } from 'base/service';
export enum PasswordState {
FILLING = "filling",
@@ -25,9 +25,9 @@ export class ChangePasswordScene {
/// State of the password scene...
public updateState: PasswordState = PasswordState.FILLING;
/// status of the 3 fields:
- public passwordOldState: boolean|string = false;
- public password1State: boolean|string = false;
- public password2State: boolean|string = false;
+ public passwordOldState: boolean | string = false;
+ public password1State: boolean | string = false;
+ public password2State: boolean | string = false;
/// data of the 3 field
public passwordOld: string = '';
public password1: string = '';
@@ -35,12 +35,12 @@ export class ChangePasswordScene {
/// Validation button state
public validateButtonDisabled: boolean = true;
- public error: string= "";
+ public error: string = "";
constructor(
private locate: Location,
private adminUserService: AdminUserService
- ) {}
+ ) { }
/**
* update the state of the validation button. if all is OK, the button will became clickable
*/
@@ -100,13 +100,13 @@ export class ChangePasswordScene {
onChangePassword(): void {
this.updateState = PasswordState.SENDING;
this.adminUserService.changePassword(this.passwordOld, this.password1)
- .then(() => {
- this.updateState = PasswordState.DONE;
- })
- .catch((error: any) => {
- this.updateState = PasswordState.ERROR;
- this.error = error;
- });
+ .then(() => {
+ this.updateState = PasswordState.DONE;
+ })
+ .catch((error: any) => {
+ this.updateState = PasswordState.ERROR;
+ this.error = error;
+ });
}
/**
* Apply cancel on this page
diff --git a/front/src/app/scene/error-viewer/error-viewer.html b/front/src/base/scene/error-viewer/error-viewer.html
similarity index 100%
rename from front/src/app/scene/error-viewer/error-viewer.html
rename to front/src/base/scene/error-viewer/error-viewer.html
diff --git a/front/src/app/scene/error-viewer/error-viewer.less b/front/src/base/scene/error-viewer/error-viewer.less
similarity index 100%
rename from front/src/app/scene/error-viewer/error-viewer.less
rename to front/src/base/scene/error-viewer/error-viewer.less
diff --git a/front/src/app/scene/error-viewer/error-viewer.ts b/front/src/base/scene/error-viewer/error-viewer.ts
similarity index 100%
rename from front/src/app/scene/error-viewer/error-viewer.ts
rename to front/src/base/scene/error-viewer/error-viewer.ts
diff --git a/front/src/app/scene/forgot-password/forgot-password.html b/front/src/base/scene/forgot-password/forgot-password.html
similarity index 100%
rename from front/src/app/scene/forgot-password/forgot-password.html
rename to front/src/base/scene/forgot-password/forgot-password.html
diff --git a/front/src/app/scene/forgot-password/forgot-password.less b/front/src/base/scene/forgot-password/forgot-password.less
similarity index 100%
rename from front/src/app/scene/forgot-password/forgot-password.less
rename to front/src/base/scene/forgot-password/forgot-password.less
diff --git a/front/src/app/scene/forgot-password/forgot-password.ts b/front/src/base/scene/forgot-password/forgot-password.ts
similarity index 97%
rename from front/src/app/scene/forgot-password/forgot-password.ts
rename to front/src/base/scene/forgot-password/forgot-password.ts
index f7cff35..a72ccfd 100644
--- a/front/src/app/scene/forgot-password/forgot-password.ts
+++ b/front/src/base/scene/forgot-password/forgot-password.ts
@@ -8,7 +8,7 @@ import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Location } from '@angular/common';
import { UserService } from 'common/service';
-import { AdminUserService } from 'app/service';
+import { AdminUserService } from 'base/service';
export function checkLoginValidity(value: string): boolean {
let regexCheck = new RegExp('^[a-zA-Z0-9_\\.-]+$');
@@ -54,9 +54,9 @@ export class ForgotPasswordScene implements OnInit {
private locate: Location,
private userService: UserService,
private adminUserService: AdminUserService
- ) {}
+ ) { }
- ngOnInit() {}
+ ngOnInit() { }
updateButtonVisibility(): void {
if (this.loginOK === true && this.notARobot === true) {
diff --git a/front/src/app/scene/help/help.html b/front/src/base/scene/help/help.html
similarity index 100%
rename from front/src/app/scene/help/help.html
rename to front/src/base/scene/help/help.html
diff --git a/front/src/app/scene/help/help.less b/front/src/base/scene/help/help.less
similarity index 100%
rename from front/src/app/scene/help/help.less
rename to front/src/base/scene/help/help.less
diff --git a/front/src/app/scene/help/help.ts b/front/src/base/scene/help/help.ts
similarity index 100%
rename from front/src/app/scene/help/help.ts
rename to front/src/base/scene/help/help.ts
diff --git a/front/src/app/scene/home-unregistered/home-unregistered.html b/front/src/base/scene/home-unregistered/home-unregistered.html
similarity index 100%
rename from front/src/app/scene/home-unregistered/home-unregistered.html
rename to front/src/base/scene/home-unregistered/home-unregistered.html
diff --git a/front/src/app/scene/home-unregistered/home-unregistered.less b/front/src/base/scene/home-unregistered/home-unregistered.less
similarity index 100%
rename from front/src/app/scene/home-unregistered/home-unregistered.less
rename to front/src/base/scene/home-unregistered/home-unregistered.less
diff --git a/front/src/app/scene/home-unregistered/home-unregistered.ts b/front/src/base/scene/home-unregistered/home-unregistered.ts
similarity index 100%
rename from front/src/app/scene/home-unregistered/home-unregistered.ts
rename to front/src/base/scene/home-unregistered/home-unregistered.ts
diff --git a/front/src/app/scene/home/home.html b/front/src/base/scene/home/home.html
similarity index 100%
rename from front/src/app/scene/home/home.html
rename to front/src/base/scene/home/home.html
diff --git a/front/src/app/scene/home/home.less b/front/src/base/scene/home/home.less
similarity index 100%
rename from front/src/app/scene/home/home.less
rename to front/src/base/scene/home/home.less
diff --git a/front/src/app/scene/home/home.ts b/front/src/base/scene/home/home.ts
similarity index 92%
rename from front/src/app/scene/home/home.ts
rename to front/src/base/scene/home/home.ts
index 5baf2e6..50b38af 100644
--- a/front/src/app/scene/home/home.ts
+++ b/front/src/base/scene/home/home.ts
@@ -5,8 +5,8 @@
*/
import { Component, OnInit } from '@angular/core';
-import { ApplicationService } from 'app/service';
-import { GetApplicationSmallResponse, SpecificTokenResponse } from 'app/service/application';
+import { ApplicationService } from 'base/service';
+import { GetApplicationSmallResponse, SpecificTokenResponse } from 'base/service/application';
import { UserService } from 'common/service';
@Component({
@@ -17,7 +17,7 @@ import { UserService } from 'common/service';
export class HomeScene implements OnInit {
error = '';
dataList: GetApplicationSmallResponse[];
- constructor(private applicationService: ApplicationService, private userService: UserService) {}
+ constructor(private applicationService: ApplicationService, private userService: UserService) { }
ngOnInit() {
let self = this;
diff --git a/front/src/app/scene/index.ts b/front/src/base/scene/index.ts
similarity index 100%
rename from front/src/app/scene/index.ts
rename to front/src/base/scene/index.ts
diff --git a/front/src/app/scene/manage-accounts/manage-accounts.html b/front/src/base/scene/manage-accounts/manage-accounts.html
similarity index 100%
rename from front/src/app/scene/manage-accounts/manage-accounts.html
rename to front/src/base/scene/manage-accounts/manage-accounts.html
diff --git a/front/src/app/scene/manage-accounts/manage-accounts.less b/front/src/base/scene/manage-accounts/manage-accounts.less
similarity index 100%
rename from front/src/app/scene/manage-accounts/manage-accounts.less
rename to front/src/base/scene/manage-accounts/manage-accounts.less
diff --git a/front/src/app/scene/manage-accounts/manage-accounts.ts b/front/src/base/scene/manage-accounts/manage-accounts.ts
similarity index 96%
rename from front/src/app/scene/manage-accounts/manage-accounts.ts
rename to front/src/base/scene/manage-accounts/manage-accounts.ts
index e8ccf41..61498b3 100644
--- a/front/src/app/scene/manage-accounts/manage-accounts.ts
+++ b/front/src/base/scene/manage-accounts/manage-accounts.ts
@@ -5,7 +5,7 @@
*/
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
-import { AdminUserService } from 'app/service';
+import { AdminUserService } from 'base/service';
import { AsyncActionState } from 'common/component';
import { SessionService } from 'common/service';
import {
@@ -110,7 +110,7 @@ export class ManageAccountsScene implements OnInit {
private adminUserService: AdminUserService,
private sessionService: SessionService,
private cdr: ChangeDetectorRef,
- ) {
+ ) {
}
ngOnInit() {
this.adminLogin = this.sessionService.getLogin();
@@ -141,7 +141,7 @@ export class ManageAccountsScene implements OnInit {
user.adminState = undefined;
self.cdr.detectChanges();
}, 3000);
-
+
}
).catch(
(error: any) => {
@@ -155,7 +155,7 @@ export class ManageAccountsScene implements OnInit {
}
);
}
- onSetBlocked(value:boolean, user: any) {
+ onSetBlocked(value: boolean, user: any) {
user.blocked = value;
console.log(`onSetBlocked: ${value} on ${user.login}`);
user.blockedState = AsyncActionState.LOADING;
@@ -189,13 +189,13 @@ export class ManageAccountsScene implements OnInit {
public password: string = '';
- public passwordState: boolean|string = false;
-
+ public passwordState: boolean | string = false;
+
public login: string = '';
- public loginState: boolean|string = false;
+ public loginState: boolean | string = false;
public email: string = '';
- public emailState: boolean|string = false;
+ public emailState: boolean | string = false;
public validateButtonCreateUserDisabled: boolean = true;
/**
@@ -254,7 +254,7 @@ export class ManageAccountsScene implements OnInit {
/**
* Check the login writing rules
*/
- checkLogin(newValue: string): void {
+ checkLogin(newValue: string): void {
this.login = newValue;
this.loginState = createLoginState(this.login);
if (this.loginState === true) {
@@ -315,7 +315,7 @@ export class ManageAccountsScene implements OnInit {
self.emailState = 'ErrorOccured in fetching data ...';
self.updateButtonVisibility();
}
- );
+ );
this.updateButtonVisibility();
}
formatTimestamp(unix_timestamp: number): string {
diff --git a/front/src/app/scene/settings/settings.html b/front/src/base/scene/settings/settings.html
similarity index 100%
rename from front/src/app/scene/settings/settings.html
rename to front/src/base/scene/settings/settings.html
diff --git a/front/src/app/scene/settings/settings.less b/front/src/base/scene/settings/settings.less
similarity index 100%
rename from front/src/app/scene/settings/settings.less
rename to front/src/base/scene/settings/settings.less
diff --git a/front/src/app/scene/settings/settings.ts b/front/src/base/scene/settings/settings.ts
similarity index 95%
rename from front/src/app/scene/settings/settings.ts
rename to front/src/base/scene/settings/settings.ts
index 4c72aae..10e5188 100644
--- a/front/src/app/scene/settings/settings.ts
+++ b/front/src/base/scene/settings/settings.ts
@@ -6,7 +6,7 @@
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
-import { SettingsService } from 'app/service';
+import { SettingsService } from 'base/service';
import { isSettingsItem, SettingsItem, SettingType } from 'common/component/render-settings/render-settings';
import {
isNullOrUndefined,
@@ -67,17 +67,17 @@ export class SettingsScene implements OnInit {
constructor(
private settingService: SettingsService,
private cdr: ChangeDetectorRef,
- ) {}
+ ) { }
menu: SettingsItem222[] = [
- {
- title: 'Authentication:',
- description: 'Manage the right of access to the web-services',
- values: undefined,
- },
- ];
-
+ {
+ title: 'Authentication:',
+ description: 'Manage the right of access to the web-services',
+ values: undefined,
+ },
+ ];
+
// this permit to clear the input menu...
-
+
configureEditInput() {
const root = this.menu[0];
root.values = [
@@ -113,7 +113,7 @@ export class SettingsScene implements OnInit {
value: root.serverValues["EMAIL_VALIDATION_REQUIRED"],
},
],
- this.menu[0].state = undefined;
+ this.menu[0].state = undefined;
this.menu[0].newValues = {};
}
diff --git a/front/src/app/scene/sign-in/sign-in.html b/front/src/base/scene/sign-in/sign-in.html
similarity index 100%
rename from front/src/app/scene/sign-in/sign-in.html
rename to front/src/base/scene/sign-in/sign-in.html
diff --git a/front/src/app/scene/sign-in/sign-in.less b/front/src/base/scene/sign-in/sign-in.less
similarity index 100%
rename from front/src/app/scene/sign-in/sign-in.less
rename to front/src/base/scene/sign-in/sign-in.less
diff --git a/front/src/app/scene/sign-in/sign-in.ts b/front/src/base/scene/sign-in/sign-in.ts
similarity index 95%
rename from front/src/app/scene/sign-in/sign-in.ts
rename to front/src/base/scene/sign-in/sign-in.ts
index ceed98c..364b00f 100644
--- a/front/src/app/scene/sign-in/sign-in.ts
+++ b/front/src/base/scene/sign-in/sign-in.ts
@@ -9,8 +9,8 @@ import { ActivatedRoute, Router } from '@angular/router';
import { Location } from '@angular/common';
import { SessionService } from 'common/service';
import { createLoginState, createPasswordState, getLoginType, isNullOrUndefined } from 'common/utils';
-import { AdminUserService, ApplicationService } from 'app/service';
-import { SpecificTokenResponse } from 'app/service/application';
+import { AdminUserService, ApplicationService } from 'base/service';
+import { SpecificTokenResponse } from 'base/service/application';
@Component({
@@ -19,10 +19,10 @@ import { SpecificTokenResponse } from 'app/service/application';
styleUrls: ['./sign-in.less'],
})
export class SignInScene implements OnInit {
- public loginState: boolean|string = false;
+ public loginState: boolean | string = false;
public login: string = '';
-
- public passwordState: boolean|string = false;
+
+ public passwordState: boolean | string = false;
public password: string = '';
public loginButtonDisabled: boolean = true;
@@ -45,7 +45,7 @@ export class SignInScene implements OnInit {
private sessionService: SessionService,
private applicationService: ApplicationService,
private adminUserService: AdminUserService
- ) {}
+ ) { }
ngOnInit() {
const ssoApplicationId = this.route.snapshot.paramMap.get('applicationId');
diff --git a/front/src/app/scene/sign-out/sign-out.html b/front/src/base/scene/sign-out/sign-out.html
similarity index 100%
rename from front/src/app/scene/sign-out/sign-out.html
rename to front/src/base/scene/sign-out/sign-out.html
diff --git a/front/src/app/scene/sign-out/sign-out.less b/front/src/base/scene/sign-out/sign-out.less
similarity index 100%
rename from front/src/app/scene/sign-out/sign-out.less
rename to front/src/base/scene/sign-out/sign-out.less
diff --git a/front/src/app/scene/sign-out/sign-out.ts b/front/src/base/scene/sign-out/sign-out.ts
similarity index 95%
rename from front/src/app/scene/sign-out/sign-out.ts
rename to front/src/base/scene/sign-out/sign-out.ts
index a36fdc1..caf5b28 100644
--- a/front/src/app/scene/sign-out/sign-out.ts
+++ b/front/src/base/scene/sign-out/sign-out.ts
@@ -9,8 +9,8 @@ import { ActivatedRoute, Router } from '@angular/router';
import { Location } from '@angular/common';
import { UserService } from 'common/service/user';
import { isNullOrUndefined } from 'common/utils';
-import { AdminUserService, ApplicationService } from 'app/service';
-import { SpecificReturnResponse } from 'app/service/application';
+import { AdminUserService, ApplicationService } from 'base/service';
+import { SpecificReturnResponse } from 'base/service/application';
export function checkLoginValidity(value: string): boolean {
let regexCheck = new RegExp('^[a-zA-Z0-9_\\.-]+$');
@@ -53,7 +53,7 @@ export class SignOutScene implements OnInit {
private userService: UserService,
private applicationService: ApplicationService,
private adminUserService: AdminUserService
- ) {}
+ ) { }
ngOnInit() {
const ssoApplicationId = this.route.snapshot.paramMap.get('applicationId');
diff --git a/front/src/app/scene/sign-up/sign-up.html b/front/src/base/scene/sign-up/sign-up.html
similarity index 100%
rename from front/src/app/scene/sign-up/sign-up.html
rename to front/src/base/scene/sign-up/sign-up.html
diff --git a/front/src/app/scene/sign-up/sign-up.less b/front/src/base/scene/sign-up/sign-up.less
similarity index 100%
rename from front/src/app/scene/sign-up/sign-up.less
rename to front/src/base/scene/sign-up/sign-up.less
diff --git a/front/src/app/scene/sign-up/sign-up.ts b/front/src/base/scene/sign-up/sign-up.ts
similarity index 99%
rename from front/src/app/scene/sign-up/sign-up.ts
rename to front/src/base/scene/sign-up/sign-up.ts
index e04e851..f74a6e1 100644
--- a/front/src/app/scene/sign-up/sign-up.ts
+++ b/front/src/base/scene/sign-up/sign-up.ts
@@ -7,7 +7,7 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { SSOService, UserService } from 'common/service';
-import { AdminUserService } from 'app/service';
+import { AdminUserService } from 'base/service';
import { checkLoginValidity, checkEmailValidity, checkPasswordValidity } from '../forgot-password/forgot-password';
@Component({
diff --git a/front/src/app/scene/validate-email/validate-email.html b/front/src/base/scene/validate-email/validate-email.html
similarity index 100%
rename from front/src/app/scene/validate-email/validate-email.html
rename to front/src/base/scene/validate-email/validate-email.html
diff --git a/front/src/app/scene/validate-email/validate-email.less b/front/src/base/scene/validate-email/validate-email.less
similarity index 100%
rename from front/src/app/scene/validate-email/validate-email.less
rename to front/src/base/scene/validate-email/validate-email.less
diff --git a/front/src/app/scene/validate-email/validate-email.ts b/front/src/base/scene/validate-email/validate-email.ts
similarity index 100%
rename from front/src/app/scene/validate-email/validate-email.ts
rename to front/src/base/scene/validate-email/validate-email.ts
diff --git a/front/src/app/service/admin-user.ts b/front/src/base/service/admin-user.ts
similarity index 96%
rename from front/src/app/service/admin-user.ts
rename to front/src/base/service/admin-user.ts
index 941b802..9bd4b4d 100644
--- a/front/src/app/service/admin-user.ts
+++ b/front/src/base/service/admin-user.ts
@@ -23,7 +23,7 @@ interface MessageLogIn {
time: string;
password: string;
}
-
+/*
interface MessageAnswer_USER_CONNECT {
sessionId: string;
login: string;
@@ -31,6 +31,7 @@ interface MessageAnswer_USER_CONNECT {
role: string;
avatar: string;
}
+*/
@Injectable()
export class AdminUserService {
@@ -55,7 +56,7 @@ export class AdminUserService {
private loginSha(login: string, password: string, rememberMe?: boolean): Promise {
// remove the current session interface
this.userService.removeSession();
- let self = this;
+ const self = this;
return new Promise((resolve, reject) => {
self.getTocken(login, password)
.then((value: any) => {
@@ -82,7 +83,7 @@ export class AdminUserService {
// TODO: skip this part if the token is valid !!!
// this is here we need to route to the SSO on external system.
- let currentDate: string = new Date().toISOString();
+ const currentDate: string = new Date().toISOString();
let data: MessageLogIn;
// create request:
if (this.identificationVersion === 1) {
@@ -139,7 +140,7 @@ export class AdminUserService {
setAdmin(userId: number, state: boolean): Promise {
- let body = state;
+ const body = state;
return new Promise((resolve, reject) => {
this.http
.requestJson({
@@ -160,7 +161,7 @@ export class AdminUserService {
}
setBlocked(userId: number, state: boolean): Promise {
- let body = state;
+ const body = state;
return new Promise((resolve, reject) => {
this.http
.requestJson({
@@ -181,7 +182,7 @@ export class AdminUserService {
}
createUsers(email: string, login: string, password: string): Promise {
- let body = {
+ const body = {
email,
login,
password: sha512(password)
@@ -210,7 +211,7 @@ export class AdminUserService {
return this.createSha(login, email, sha512(password));
}
createSha(login: string, email: string, password: string) {
- let data = {
+ const data = {
method: 'v?',
login: login,
email: email,
@@ -244,7 +245,7 @@ export class AdminUserService {
}
checkLogin(login: string): Promise {
- let params = {
+ const params = {
login: login,
};
return new Promise((resolve, reject) => {
@@ -274,7 +275,7 @@ export class AdminUserService {
}
checkEMail(email: string): Promise {
- let params = {
+ const params = {
email: email,
};
return new Promise((resolve, reject) => {
@@ -307,8 +308,8 @@ export class AdminUserService {
}
changePassword(oldPassword: string, newPassword: string): Promise {
- let time: string = new Date().toISOString();
- let login: string = this.sessionService.getLogin();
+ const time: string = new Date().toISOString();
+ const login: string = this.sessionService.getLogin();
let method = null;
let password = null;
if (this.identificationVersion === 1) {
@@ -319,14 +320,14 @@ export class AdminUserService {
reject(`Internal Fail (contact administrator).`);
});
}
- let body = {
+ const body = {
method,
time,
login,
password,
newPassword: sha512(newPassword),
- }
- let self = this;
+ };
+ const self = this;
return new Promise((resolve, reject) => {
self.http
.request({
diff --git a/front/src/app/service/application-token.ts b/front/src/base/service/application-token.ts
similarity index 100%
rename from front/src/app/service/application-token.ts
rename to front/src/base/service/application-token.ts
diff --git a/front/src/app/service/application.ts b/front/src/base/service/application.ts
similarity index 100%
rename from front/src/app/service/application.ts
rename to front/src/base/service/application.ts
diff --git a/front/src/app/service/index.ts b/front/src/base/service/index.ts
similarity index 100%
rename from front/src/app/service/index.ts
rename to front/src/base/service/index.ts
diff --git a/front/src/app/service/settings.ts b/front/src/base/service/settings.ts
similarity index 99%
rename from front/src/app/service/settings.ts
rename to front/src/base/service/settings.ts
index ab98f4e..e9fa9a5 100644
--- a/front/src/app/service/settings.ts
+++ b/front/src/base/service/settings.ts
@@ -122,7 +122,6 @@ export class SettingsService {
for (let key of keys) {
this.set(key, data[key])
.then((result: boolean) => {
-
multipleResponse.add(key, result);
})
.catch((error: any) => {
diff --git a/front/src/common/service/session.ts b/front/src/common/service/session.ts
index 2b23384..5efc58b 100644
--- a/front/src/common/service/session.ts
+++ b/front/src/common/service/session.ts
@@ -6,98 +6,97 @@
import { Injectable, Output, EventEmitter } from '@angular/core';
import { CanActivate, Router } from '@angular/router';
+import { isNullOrUndefined } from 'common/utils';
+import { environment } from 'environments/environment';
export enum UserRoles222 {
- admin = 10000,
- user = 1,
- guest = 10,
+ admin = 'admin',
+ user = 'user',
+ guest = 'guest',
}
@Injectable()
export class SessionService {
private tokenJwt = null;
- public sessionId = null;
public userLogin = null;
- public userAdmin = null;
- public userEMail = null;
- public userAvatar = null;
public userId = null;
+ public right: any = {};
@Output() change: EventEmitter = new EventEmitter();
- constructor() {}
+ constructor() { }
/**
* @brief Create a new session.
*
- * @param sessionId -
* @param userId -
* @param userLogin -
- * @param userEMail -
- * @param userAdmin -
- * @param userAvatar -
+ * @param tokenJwt -
*/
create({
- sessionId,
userId,
userLogin,
- userEMail,
- userAdmin,
- userAvatar,
tokenJwt,
}: {
- sessionId;
userId: string;
userLogin: string;
- userEMail: string;
- userAdmin: boolean;
- userBlocked: boolean;
- userRemoved: boolean;
- userAvatar: string;
tokenJwt: string;
}) {
console.log(
- `Session Create: userId=${userId} userLogin=${userLogin} userEMail=${userEMail} userAdmin=${userAdmin} userAvatar=${userAvatar} sessionId = ${sessionId} tokenJwt = ${tokenJwt}`
+ `Session Create: userId=${userId} userLogin=${userLogin} tokenJwt = ${tokenJwt}`
);
this.tokenJwt = tokenJwt;
- this.sessionId = sessionId;
this.userId = userId;
this.userLogin = userLogin;
- this.userAdmin = userAdmin;
- this.userEMail = userEMail;
- this.userAvatar = userAvatar;
+ this.right = this.parseToken(tokenJwt);
+ console.log(`Retrieve right: ${JSON.stringify(this.right, null, 4)}`);
this.change.emit(true);
}
+ b64_to_utf8(str: string): string {
+ return decodeURIComponent(window.atob(str));
+ }
+ parseToken(token: string): any {
+ const cut = token.split('.');
+ const decoded = this.b64_to_utf8(cut[1]);
+ const jsonModel = JSON.parse(decoded);
+ if (isNullOrUndefined(jsonModel.right)) {
+ return {};
+ }
+ if (isNullOrUndefined(jsonModel.right[environment.applName])) {
+ return {};
+ }
+ return jsonModel.right[environment.applName];
+ }
/**
* @brief destroy the current session.
*/
destroy() {
console.log('Session REMOVE');
- let last = this.sessionId;
- this.sessionId = null;
this.tokenJwt = undefined;
this.userId = null;
this.userLogin = null;
- this.userAdmin = null;
- this.userEMail = null;
- this.userAvatar = null;
+ this.right = {};
this.change.emit(false);
}
getToken(): string | undefined {
return this.tokenJwt;
}
islogged() {
- return this.sessionId !== null;
+ return this.userId !== null;
}
- hasRight(type) {
+ hasRight(type: UserRoles222): boolean {
if (type === UserRoles222.admin) {
- // sometime needed...
- return this.userAdmin;
+ if (isNullOrUndefined(this.right.ADMIN)) {
+ return false;
+ }
+ return this.right.ADMIN;
}
if (type === UserRoles222.user) {
- // is connected ==> is user
- return this.sessionId !== null;
+ if (isNullOrUndefined(this.right.USER)) {
+ return false;
+ }
+ return this.right.USER;
}
if (type === UserRoles222.guest) {
// all the other ... maybe unneeded
@@ -113,7 +112,7 @@ export class SessionService {
}
getAvatar() {
return 'assets/images/avatar_generic.svg';
- /* This is not ready :
+ /* This is not ready:
if(this.userAvatar === false) {
return 'assets/images/avatar_generic.svg';
}
@@ -124,7 +123,7 @@ export class SessionService {
@Injectable()
export class OnlyUsersGuard implements CanActivate {
- constructor(private sessionService: SessionService, private router: Router) {}
+ constructor(private sessionService: SessionService, private router: Router) { }
canActivate() {
console.log('OnlyLoggedInUsers');
@@ -139,7 +138,7 @@ export class OnlyUsersGuard implements CanActivate {
@Injectable()
export class OnlyUsersGuardHome implements CanActivate {
- constructor(private sessionService: SessionService, private router: Router) {}
+ constructor(private sessionService: SessionService, private router: Router) { }
canActivate() {
if (this.sessionService.hasRight(UserRoles222.user) || this.sessionService.hasRight(UserRoles222.admin)) {
@@ -152,7 +151,7 @@ export class OnlyUsersGuardHome implements CanActivate {
}
@Injectable()
export class OnlyUnregisteredGuardHome implements CanActivate {
- constructor(private sessionService: SessionService, private router: Router) {}
+ constructor(private sessionService: SessionService, private router: Router) { }
canActivate() {
if (!this.sessionService.islogged()) {
@@ -166,7 +165,7 @@ export class OnlyUnregisteredGuardHome implements CanActivate {
@Injectable()
export class OnlyAdminGuard implements CanActivate {
- constructor(private sessionService: SessionService, private router: Router) {}
+ constructor(private sessionService: SessionService, private router: Router) { }
canActivate() {
if (this.sessionService.hasRight(UserRoles222.user)) {
diff --git a/front/src/common/service/sso.ts b/front/src/common/service/sso.ts
index 339bd75..5bd459e 100644
--- a/front/src/common/service/sso.ts
+++ b/front/src/common/service/sso.ts
@@ -44,7 +44,7 @@ export class SSOService {
) {
return this.utf8_to_b64(data);
}
- let pathName = getApplicationLocation();
+ const pathName = getApplicationLocation();
if (isInArray(pathName, ['sso', '/sso', '/sso/'])) {
return this.utf8_to_b64('home');
}
@@ -80,6 +80,12 @@ export class SSOService {
}
return undefined;
}
+ /**
+ * Request Open SSO Global website
+ */
+ requestOpenSite(): void {
+ window.location.href = environment.ssoSite;
+ }
/**
* Request SSO connection
*/
diff --git a/front/src/common/service/user.ts b/front/src/common/service/user.ts
index b03edf2..2892c94 100644
--- a/front/src/common/service/user.ts
+++ b/front/src/common/service/user.ts
@@ -14,13 +14,13 @@ import { SessionService } from './session';
import { SSOService } from './sso';
import { getApplicationLocation, isNullOrUndefined, sha512 } from 'common/utils';
+/*
interface MessageLogIn {
login: string;
method: string;
time: number;
password: string;
}
-
interface MessageAnswer_USER_CONNECT {
sessionId: string;
login: string;
@@ -28,7 +28,7 @@ interface MessageAnswer_USER_CONNECT {
role: string;
avatar: string;
}
-
+*/
@Injectable()
export class UserService {
// 0: Not hide password; 1 hide password;
@@ -69,9 +69,9 @@ export class UserService {
if (elems.length !== 3) {
return false;
}
- //const tokenHeader = decodeURIComponent(window.atob( elems[0] ));
+ // const tokenHeader = decodeURIComponent(window.atob( elems[0] ));
const tokenData = decodeURIComponent(window.atob(elems[1]));
- //console.error(`Retreive local token: \nheader=${tokenHeader} \ndata=${tokenData}`);
+ // console.error(`Retreive local token: \nheader=${tokenHeader} \ndata=${tokenData}`);
const parsedData = JSON.parse(tokenData);
console.debug(
`Retreive token exp data=${new Date(parsedData.exp * 1000).toISOString()} < ${new Date().toISOString()}`
@@ -91,13 +91,13 @@ export class UserService {
*/
checkAutoConnect(): Promise {
let locationOrigin = getApplicationLocation();
- let self = this;
+ const self = this;
return new Promise((resolve, reject) => {
// Need to use the windows global route to prevent the log in cycle ...
// And in the mlain application position, the route does not have curently root the page
let pathName = window.location.pathname;
- //console.log("start Path-name: '" + pathName + "'");
- //console.log("check with: '" + environment.applName + "/sso/" + "'");
+ // console.log("start Path-name: '" + pathName + "'");
+ // console.log("check with: '" + environment.applName + "/sso/" + "'");
if (pathName.startsWith('/sso/') || pathName.startsWith(environment.applName + '/sso/')) {
console.log(' ==> SSo section');
reject();
@@ -154,7 +154,7 @@ export class UserService {
}
startSession(token: string, rememberMe: boolean): Promise {
- let self = this;
+ const self = this;
return new Promise((resolve, reject) => {
self.retreiveMe(token)
.then((value2: boolean) => {
@@ -178,11 +178,11 @@ export class UserService {
}
retreiveMe(token: string): Promise {
console.log(`AuthService.loginWithToken ... '${token}'`);
- let self = this;
+ const self = this;
return new Promise((resolve, reject) => {
this.http
.requestJson({
- //server: 'karso',
+ // server: 'karso',
endPoint: 'users/me',
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
@@ -193,14 +193,14 @@ export class UserService {
// TODO: check type ...
console.log(`loginWithToken : get some data to check: ${JSON.stringify(response.data)}`);
self.sessionService.create({
- sessionId: response.data.sessionId,
+ //sessionId: response.data.sessionId,
userId: response.data.id,
userLogin: response.data.login,
- userEMail: response.data.email,
- userAdmin: response.data.admin,
- userBlocked: response.data.blocked,
- userRemoved: response.data.removed,
- userAvatar: response.data.avatar,
+ //userEMail: response.data.email,
+ //userAdmin: response.data.admin,
+ //userBlocked: response.data.blocked,
+ //userRemoved: response.data.removed,
+ //userAvatar: response.data.avatar,
tokenJwt: token,
});
resolve(true);
@@ -258,8 +258,8 @@ export class UserService {
authorizedRoles = [_authorizedRoles];
}
return ( authService.isAuthenticated()
- && _authorizedRoles.indexOf(Session.userRole) !== -1
- );
+ && _authorizedRoles.indexOf(Session.userRole) !== -1
+ );
*/
return false;
}
diff --git a/front/src/environments/environment.edge.prod.ts b/front/src/environments/environment.edge.prod.ts
new file mode 100644
index 0000000..6cf3da0
--- /dev/null
+++ b/front/src/environments/environment.edge.prod.ts
@@ -0,0 +1,21 @@
+// The file contents for the current environment will overwrite these during build.
+// The build system defaults to the dev environment which uses `environment.ts`, but if you do
+// `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 = {
+ production: true,
+ // URL of development API
+ applName: 'karso',
+ defaultServer: 'karso',
+ server: {
+ karso: `${location.origin}/karso/api`,
+ },
+ edgeMode: true,
+ // set to undefined sso* in case of internal authentication model
+ ssoSite: `${location.origin}/karso-edge`,
+ ssoSignIn: undefined,
+ ssoSignOut: undefined,
+ ssoSignUp: undefined,
+ tokenStoredInPermanentStorage: true,
+};
diff --git a/front/src/environments/environment.edge.ts b/front/src/environments/environment.edge.ts
new file mode 100644
index 0000000..02f8209
--- /dev/null
+++ b/front/src/environments/environment.edge.ts
@@ -0,0 +1,21 @@
+// The file contents for the current environment will overwrite these during build.
+// The build system defaults to the dev environment which uses `environment.ts`, but if you do
+// `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 = {
+ production: false,
+ // URL of development API
+ applName: 'karso-edge',
+ defaultServer: 'karso',
+ server: {
+ karso: 'http://localhost:15080/karso-edge/api',
+ },
+ edgeMode: true,
+ // set to undefined sso* in case of internal authentication model
+ ssoSite: 'http://localhost:15080/karso',
+ ssoSignIn: undefined,
+ ssoSignOut: undefined,
+ ssoSignUp: undefined,
+ tokenStoredInPermanentStorage: true,
+};
diff --git a/front/src/environments/environment.prod.ts b/front/src/environments/environment.prod.ts
index 642eb56..691dc07 100644
--- a/front/src/environments/environment.prod.ts
+++ b/front/src/environments/environment.prod.ts
@@ -11,7 +11,9 @@ export const environment = {
server: {
karso: `${location.origin}/karso/api`,
},
- // set to undefined sso* in case of internal authentification model
+ edgeMode: false,
+ // set to undefined sso* in case of internal authentication model
+ ssoSite: undefined,
ssoSignIn: undefined,
ssoSignOut: undefined,
ssoSignUp: undefined,
diff --git a/front/src/environments/environment.ts b/front/src/environments/environment.ts
index 1a909bf..f3c8e9e 100644
--- a/front/src/environments/environment.ts
+++ b/front/src/environments/environment.ts
@@ -11,7 +11,9 @@ export const environment = {
server: {
karso: 'http://localhost:15080/karso/api',
},
- // set to undefined sso* in case of internal authentification model
+ edgeMode: false,
+ // set to undefined sso* in case of internal authentication model
+ ssoSite: undefined,
ssoSignIn: undefined,
ssoSignOut: undefined,
ssoSignUp: undefined,
diff --git a/front/src/tsconfig.app.json b/front/src/tsconfig.app-edge.json
similarity index 65%
rename from front/src/tsconfig.app.json
rename to front/src/tsconfig.app-edge.json
index b521d97..60f6e69 100644
--- a/front/src/tsconfig.app.json
+++ b/front/src/tsconfig.app-edge.json
@@ -5,5 +5,9 @@
"baseUrl": "./",
"types": []
},
- "exclude": ["test.ts", "**/*.spec.ts"]
-}
+ "exclude": [
+ "test.ts",
+ "**/*.spec.ts",
+ "app-root/**"
+ ]
+}
\ No newline at end of file
diff --git a/front/src/tsconfig.app-root.json b/front/src/tsconfig.app-root.json
new file mode 100644
index 0000000..fe58fc3
--- /dev/null
+++ b/front/src/tsconfig.app-root.json
@@ -0,0 +1,13 @@
+{
+ "extends": "../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../out-tsc/app",
+ "baseUrl": "./",
+ "types": []
+ },
+ "exclude": [
+ "test.ts",
+ "**/*.spec.ts",
+ "app-edge/**"
+ ]
+}
\ No newline at end of file
diff --git a/front/tsconfig.json b/front/tsconfig.json
index bbd5b6b..6d60e4e 100644
--- a/front/tsconfig.json
+++ b/front/tsconfig.json
@@ -10,13 +10,28 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2018",
- "typeRoots": ["node_modules/@types"],
- "lib": ["es2018", "dom"],
+ "typeRoots": [
+ "node_modules/@types"
+ ],
+ "lib": [
+ "es2018",
+ "dom"
+ ],
"module": "es2020",
"baseUrl": "./src/",
"paths": {
- "@app/*": ["./src/app/"],
- "@common/*": ["./src/common/"]
+ "@app-base/*": [
+ "./src/base/"
+ ],
+ "@app-root/*": [
+ "./src/app-root/"
+ ],
+ "@app-edge/*": [
+ "./src/app-edge/"
+ ],
+ "@common/*": [
+ "./src/common/"
+ ]
}
}
-}
+}
\ No newline at end of file
diff --git a/front/tslint.json b/front/tslint.json
index 8f9f9ac..c966cdd 100644
--- a/front/tslint.json
+++ b/front/tslint.json
@@ -1,39 +1,66 @@
{
- "rulesDirectory": ["node_modules/codelyzer"],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
- "comment-format": [true, "check-space"],
+ "comment-format": [
+ true,
+ "check-space"
+ ],
"curly": true,
"deprecation": {
"severity": "warn"
},
"eofline": true,
"forin": true,
- "import-blacklist": [true, "rxjs/Rx"],
+ "import-blacklist": [
+ true,
+ "rxjs/Rx"
+ ],
"import-spacing": true,
- "indent": [true, "spaces"],
+ "indent": [
+ true,
+ "tabs"
+ ],
"interface-over-type-literal": true,
"label-position": true,
- "max-line-length": [true, 140],
+ "max-line-length": [
+ true,
+ 140
+ ],
"member-access": false,
"member-ordering": [
true,
{
- "order": ["static-field", "instance-field", "static-method", "instance-method"]
+ "order": [
+ "static-field",
+ "instance-field",
+ "static-method",
+ "instance-method"
+ ]
}
],
"no-arg": true,
"no-bitwise": true,
- "no-console": [true, "debug", "info", "time", "timeEnd", "trace"],
+ "no-console": [
+ true,
+ "debug",
+ "info",
+ "time",
+ "timeEnd",
+ "trace"
+ ],
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
- "no-inferrable-types": [true, "ignore-params"],
+ "no-inferrable-types": [
+ true,
+ "ignore-params",
+ "ignore-properties"
+ ],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-shadowed-variable": true,
@@ -45,12 +72,27 @@
"no-unused-expression": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
- "one-line": [true, "check-open-brace", "check-catch", "check-else", "check-whitespace"],
+ "one-line": [
+ true,
+ "check-open-brace",
+ "check-catch",
+ "check-else",
+ "check-whitespace"
+ ],
"prefer-const": true,
- "quotemark": [true, "single"],
+ "quotemark": [
+ true,
+ "single"
+ ],
"radix": true,
- "semicolon": [true, "always"],
- "triple-equals": [true, "allow-null-check"],
+ "semicolon": [
+ true,
+ "always"
+ ],
+ "triple-equals": [
+ true,
+ "allow-null-check"
+ ],
"typedef-whitespace": [
true,
{
@@ -63,9 +105,26 @@
],
"unified-signatures": true,
"variable-name": false,
- "whitespace": [true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type"],
- "directive-selector": [true, "attribute", "app", "camelCase"],
- "component-selector": [true, "element", "app", "kebab-case"],
+ "whitespace": [
+ true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type"
+ ],
+ "directive-selector": [
+ true,
+ "attribute",
+ "app",
+ "camelCase"
+ ],
+ "component-selector": [
+ true,
+ "element",
+ "app",
+ "kebab-case"
+ ],
"no-output-on-prefix": true,
"no-inputs-metadata-property": true,
"no-outputs-metadata-property": true,
@@ -77,4 +136,4 @@
"component-class-suffix": true,
"directive-class-suffix": true
}
-}
+}
\ No newline at end of file
diff --git a/readme.md b/readme.md
index 02ac594..b283bc2 100644
--- a/readme.md
+++ b/readme.md
@@ -24,7 +24,7 @@ CREATE USER 'karso'@'%' IDENTIFIED BY 'base_db_password';
GRANT ALL PRIVILEGES ON `karso`.* TO 'karso'@'%';
FLUSH PRIVILEGES;
```
-> **_Note_** the base_db_password with the production password. this one is for development environment
+> **_Note_** the `base_db_password` with the production password. this one is for development environment
To start the service