Merge Angular 16 Irish Monitor to develop #33

Merged
k.triantafyllou merged 151 commits from angular-16-irish-monitor into develop 2024-02-13 09:32:41 +01:00
9 changed files with 29 additions and 38 deletions
Showing only changes of commit bc4e30c3f2 - Show all commits

View File

@ -37,7 +37,6 @@ export class ClaimsAdminComponent {
@Input() isConnect: boolean = false;
@Input() externalPortalUrl: string;
@Input() claimsInfoURL: string;
@Input() userInfoURL: string;
public user: User = null;
sub;

View File

@ -30,7 +30,6 @@ import {Subscriber} from "rxjs";
export class MyClaimsComponent {
@Input() claimsInfoURL: string;
@Input() communityId:string;
@Input() userInfoURL: string;
public user: User = null;
constructor(private userManagementService: UserManagementService, private _router: Router) {}

View File

@ -11,7 +11,7 @@ import * as url from "url";
@Injectable()
export class ErrorInterceptorService implements HttpInterceptor {
private static UNAUTHORIZED_WHITELIST = [properties.userInfoUrl, properties.orcidAPIURL, properties.registryUrl? (properties.registryUrl + 'verification/'):null, properties.eoscDataTransferAPI].filter(value => !!value);
private static UNAUTHORIZED_WHITELIST = [properties.orcidAPIURL, properties.registryUrl? (properties.registryUrl + 'verification/'):null, properties.eoscDataTransferAPI].filter(value => !!value);
private url: string = null;
constructor(private router: Router) {

View File

@ -122,12 +122,8 @@ export class UserMiniComponent implements OnInit, OnChanges {
public isAuthorized: boolean = false;
@Input() public mobileView: boolean = false;
public firstLetters: string = "";
public server: boolean = true;
public routerHelper: RouterHelper = new RouterHelper();
@Input() userMenuItems;
@Input() logInUrl;
@Input() logOutUrl;
@Input() cookieDomain;
@Input() notificationConfiguration: NotificationConfiguration;
@ViewChild('notificationsSidebar') notificationsSidebar: NotificationsSidebarComponent;
public showNotifications = false;
@ -137,9 +133,6 @@ export class UserMiniComponent implements OnInit, OnChanges {
}
ngOnInit() {
if (typeof document !== 'undefined') {
this.server = false;
}
this.initUser();
}

View File

@ -42,7 +42,7 @@ export class User {
this.role = [];
if (info.roles) {
info.roles.forEach(role => {
this.role.push(role);
this.role.push(decodeURIComponent(role).replace('$$', '::'));
});
} else {
if (info.edu_person_entitlements) {

View File

@ -14,6 +14,9 @@ import {isArray} from "rxjs/internal-compatibility";
})
export class UserManagementService {
private readonly getUserInfoSubject: AdvancedAsyncSubject<User> = new AdvancedAsyncSubject<User>();
private static LOGIN = 'openid_connect_login';
private static LOGOUT: string = 'openid_logout';
private static USERINFO: string = 'userInfo';
public fixRedirectURL: string = null;
private redirectUrl: string = null;
private subscription;
@ -40,10 +43,17 @@ export class UserManagementService {
return this.getUserInfoSubject.asObservable();
}
public updateUserInfo(resolve: Function = null) {
this.subscription = this.http.get<User>(properties.userInfoUrl, CustomOptions.registryOptions()).pipe(map(userInfo => {
public getUserInfoAt(index = 1): Observable<User> {
return this.http.get<User>((isArray(properties.loginServiceURL)?properties.loginServiceURL[index]:properties.loginServiceURL) +
UserManagementService.USERINFO, CustomOptions.registryOptions()).pipe(map(userInfo => {
return new User(userInfo);
})).subscribe(user => {
}))
}
public updateUserInfo(resolve: Function = null) {
this.subscription = this.getUserInfoAt().subscribe(user => {
console.log(user)
this.getUserInfoSubject.next(user);
if (resolve) {
resolve();
@ -85,20 +95,24 @@ export class UserManagementService {
if(redirect) {
this.redirectUrl = redirect;
} else if (this.fixRedirectURL) {
console.log(this.fixRedirectURL)
this.setRedirectUrl(this.fixRedirectURL);
} else {
this.setRedirectUrl();
}
window.location.href = this.setURL(properties.loginUrl) + encodeURIComponent(this.redirectUrl);
let loginURL: string | string[] = isArray(properties.loginServiceURL)?properties.loginServiceURL.map(url => url + UserManagementService.LOGIN):(properties.loginServiceURL + UserManagementService.LOGIN);
window.location.href = this.setURL(loginURL) + this.redirectUrl;
}
public logout() {
this.setRedirectUrl();
Session.removeUser();
window.location.href = this.setURL(properties.logoutUrl) + encodeURIComponent(this.redirectUrl);
let logoutURL: string | string[] = isArray(properties.loginServiceURL)?properties.loginServiceURL.map(url => url + UserManagementService.LOGOUT):(properties.loginServiceURL + UserManagementService.LOGOUT);
window.location.href = this.setURL(logoutURL) + this.redirectUrl;
}
setURL(url: string | string[]) {
console.log(url);
if(isArray(url)) {
let redirectURL = '';
url.forEach((url, index) => {

View File

@ -12,9 +12,7 @@
</div>
<div *ngIf="!onlyTop || userMenu" class="uk-navbar-right" [class.uk-light]='activeHeader.darkBg'>
<ng-container *ngIf="userMenu">
<user-mini [user]="user" mobileView=true
[userMenuItems]=userMenuItems [logInUrl]=properties.loginUrl [notificationConfiguration]="notificationConfiguration"
[logOutUrl]=properties.logoutUrl [cookieDomain]=properties.cookieDomain></user-mini>
<user-mini [user]="user" mobileView=true [userMenuItems]=userMenuItems [notificationConfiguration]="notificationConfiguration"></user-mini>
</ng-container>
</div>
</nav>
@ -192,9 +190,7 @@
</div>
</div>
<user-mini *ngIf="!searchMode && userMenu" [user]="user"
[userMenuItems]=userMenuItems [logInUrl]=properties.loginUrl [logOutUrl]=properties.logoutUrl
[cookieDomain]=properties.cookieDomain></user-mini>
<user-mini *ngIf="!searchMode && userMenu" [user]="user" [userMenuItems]=userMenuItems></user-mini>
<div class="uk-visible@m">
<ng-content select="[extra-m]"></ng-content>
</div>

View File

@ -57,10 +57,8 @@ export interface EnvProperties {
vocabulariesAPI?: string;
piwikBaseUrl?: string;
piwikSiteId?: string;
loginUrl?: string | string[];
loginServiceURL?: string | string[];
registryUrl?: string;
logoutUrl?: string | string[];
userInfoUrl?: string;
developersApiUrl?: string,
cookieDomain?: string;
feedbackmail?: string;

View File

@ -107,9 +107,7 @@ export let commonDev: EnvProperties = {
orcidClientId: "APP-A5M3KTX6NCN67L91",
utilsService: "http://mpagasas.di.uoa.gr:8000",
vocabulariesAPI: "https://dev-openaire.d4science.org/provision/mvc/vocabularies/",
loginUrl: "http://mpagasas.di.uoa.gr:19080/login-service/openid_connect_login",
userInfoUrl: "http://mpagasas.di.uoa.gr:19080/login-service/userInfo",
logoutUrl: "http://mpagasas.di.uoa.gr:19080/login-service/openid_logout",
loginServiceURL: "http://mpagasas.di.uoa.gr:19080/login-service/",
cookieDomain: ".di.uoa.gr",
feedbackmail: "kostis30fylloy@gmail.com",
cacheUrl: "http://dl170.madgik.di.uoa.gr:3000/get?url=",
@ -146,9 +144,7 @@ export let commonTest: EnvProperties = {
csvAPIURL: "https://services.openaire.eu/search/v2/api/reports",
utilsService: "https://explore.openaire.eu/utils-service",
vocabulariesAPI: "https://services.openaire.eu/provision/mvc/vocabularies/",
loginUrl: " https://services.openaire.eu/login-service/openid_connect_login",
userInfoUrl: " https://services.openaire.eu/login-service/userInfo",
logoutUrl: "https://services.openaire.eu/login-service/openid_logout",
loginServiceURL: " https://services.openaire.eu/login-service/",
cacheUrl: "https://explore.openaire.eu/cache/get?url=",
datasourcesAPI: "https://services.openaire.eu/openaire/ds/api/",
monitorServiceAPIURL: "https://services.openaire.eu/uoa-monitor-service",
@ -177,9 +173,7 @@ export let commonBeta: EnvProperties = {
csvAPIURL: "https://beta.services.openaire.eu/search/v2/api/reports",
utilsService: "https://demo.openaire.eu/utils-service",
vocabulariesAPI: "https://beta.services.openaire.eu/provision/mvc/vocabularies/",
loginUrl: "https://beta.services.openaire.eu/login-service/openid_connect_login",
userInfoUrl: "https://beta.services.openaire.eu/login-service/userInfo",
logoutUrl: "https://beta.services.openaire.eu/login-service/openid_logout",
loginServiceURL: "https://beta.services.openaire.eu/login-service/",
cacheUrl: "https://demo.openaire.eu/cache/get?url=",
datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/api/",
monitorServiceAPIURL: "https://beta.services.openaire.eu/uoa-monitor-service",
@ -218,9 +212,7 @@ export let commonProd: EnvProperties = {
csvAPIURL: "https://services.openaire.eu/search/v2/api/reports",
utilsService: "https://explore.openaire.eu/utils-service",
vocabulariesAPI: "https://services.openaire.eu/provision/mvc/vocabularies/",
loginUrl: " https://services.openaire.eu/login-service/openid_connect_login",
userInfoUrl: " https://services.openaire.eu/login-service/userInfo",
logoutUrl: "https://services.openaire.eu/login-service/openid_logout",
loginServiceURL: "https://services.openaire.eu/login-service/",
cacheUrl: "https://explore.openaire.eu/cache/get?url=",
datasourcesAPI: "https://services.openaire.eu/openaire/ds/api/",
monitorServiceAPIURL: "https://services.openaire.eu/uoa-monitor-service",