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
1 changed files with 19 additions and 3 deletions
Showing only changes of commit 8f009f3fee - Show all commits

View File

@ -13,6 +13,7 @@ import {UserManagementService} from "../services/user-management.service";
import {OpenaireEntities} from "../utils/properties/searchFields";
import {FullScreenModalComponent} from "../utils/modal/full-screen-modal/full-screen-modal.component";
import {LogService} from "../utils/log/log.service";
import {UserProfileService} from "../services/userProfile.service";
declare var UIkit: any;
@ -365,7 +366,7 @@ export class OrcidWorkComponent {
public window: any;
public isLoggedIn: boolean = false;
public hasConsent: boolean = false;
public currentAction: string = "";
public hoverAdd: boolean = false;
@ -378,7 +379,7 @@ export class OrcidWorkComponent {
private _router: Router,
private orcidService: OrcidService,
private resultLandingService: ResultLandingService,
private userManagementService: UserManagementService, private _logService: LogService) {
private userManagementService: UserManagementService, private _logService: LogService, private _userProfileService: UserProfileService) {
if (typeof document !== 'undefined') {
this.tokenUrl = properties.orcidTokenURL
+ "client_id=" + properties.orcidClientId
@ -402,6 +403,13 @@ export class OrcidWorkComponent {
}, error => {
this.isLoggedIn = false;
}));
if(properties.adminToolsPortalType == 'irish'){
this.subscriptions.push(this._userProfileService.getUserProfile().subscribe(userProfile => {
this.hasConsent = userProfile.consent;
}, error =>{
this.hasConsent = false;
}));
}
}
ngOnDestroy() {
@ -523,7 +531,15 @@ export class OrcidWorkComponent {
}
});
} else {
if(properties.adminToolsPortalType == 'irish' && !this.hasConsent){
this._router.navigate(['/consent'], {
queryParams: {
"errorCode": LoginErrorCodes.NOT_VALID,
"redirectUrl": this._router.url
}
});
return;
}
if (this.requestGrant) {
this.openGrantModal("Add, delete or edit work in your ORCID record");
} else {