Merge Angular 16 Irish Monitor to develop #33
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue