[Library|Trunk]
User info: add user information when user is logged in and there is no error or redirect parameters Add spaces lost after ang 7 migration (funded by component, orcid dropdown, search results labels) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56056 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
bcd11e1589
commit
64eebccc47
|
@ -42,7 +42,7 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
||||||
</mark>
|
</mark>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="uk-icon">
|
{{" "}}<span class="uk-icon">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -1,58 +1,76 @@
|
||||||
|
<div [id]="(mainComponent)?'tm-main':''" [class]="(mainComponent)?'uk-section uk-margin-small-top tm-middle':''">
|
||||||
<div [id]="(mainComponent)?'tm-main':''" [class]="(mainComponent)?'uk-section uk-margin-small-top tm-middle':''" >
|
|
||||||
<div uk-grid uk-grid>
|
<div uk-grid uk-grid>
|
||||||
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
|
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
|
||||||
|
|
||||||
<div *ngIf="!server" class="uk-margin-top uk-container uk-container-small uk-position-relative">
|
<div *ngIf="!server" class="uk-container uk-container-small uk-position-relative">
|
||||||
|
|
||||||
<div *ngIf="loggedIn">
|
<div *ngIf="loggedIn" class="">
|
||||||
<div class="uk-alert uk-alert-success">
|
<div class="uk-h2 uk-text-center">User Information</div>
|
||||||
Hello {{user.fullname}}!
|
<div>
|
||||||
</div>
|
<span class="uk-text-muted"> Full name </span> <span> {{user.fullname}} </span>
|
||||||
<!-- <button (click)="logout()" class=" uk-button uk-button-default">Log out</button> -->
|
</div>
|
||||||
</div>
|
<div>
|
||||||
<!--form *ngIf="!loggedIn" class=" ">
|
<span class="uk-text-muted"> E-mail </span> <span> {{user.email}} </span>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="user.role.length > 1">
|
||||||
|
<span class="uk-text-muted"> Roles </span> <span> {{getTheRolesFormatted(user.role)}} </span>
|
||||||
|
</div>
|
||||||
|
<div class="uk-margin-top " *ngIf="user.role.length > 1">
|
||||||
|
<a class="uk-button uk-button-primary" href="https://aai.openaire.eu/roles/index.php"
|
||||||
|
target="_blank">Manage your roles</a> {{" "}}
|
||||||
|
<a *ngIf="isUSerManager()" class="uk-button uk-button-primary"
|
||||||
|
href="https://aai.openaire.eu/roles/admin.php"
|
||||||
|
target="_blank">Manage role requests</a>{{" "}}
|
||||||
|
<a *ngIf="isUSerManager()" class="uk-button uk-button-primary" href="https://aai.openaire.eu/registry"
|
||||||
|
target="_blank">Manage users</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3>Welcome to OpenAIRE's Discover Portal</h3>
|
|
||||||
|
|
||||||
<p>This service uses the same ldap sign-in as the OpenAIRE services so you can use the same
|
<!-- <button (click)="logout()" class=" uk-button uk-button-default">Log out</button> -->
|
||||||
credentials.</p>
|
</div>
|
||||||
|
<!--form *ngIf="!loggedIn" class=" ">
|
||||||
|
|
||||||
<p>Login in. To see it in action.</p>
|
<h3>Welcome to OpenAIRE's Discover Portal</h3>
|
||||||
<div class="uk-margin">
|
|
||||||
<input class="uk-input uk-form-width-medium" placeholder="Username" type="text" name="username" [(ngModel)]="username">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="uk-margin">
|
<p>This service uses the same ldap sign-in as the OpenAIRE services so you can use the same
|
||||||
<input placeholder="Password" class="uk-input uk-form-width-medium" type="password" name="password" [(ngModel)]="password">
|
credentials.</p>
|
||||||
</div>
|
|
||||||
<div class="uk-margin">
|
<p>Login in. To see it in action.</p>
|
||||||
<button (click)="login()" class=" uk-button uk-button-primary">Login</button>
|
<div class="uk-margin">
|
||||||
</div>
|
<input class="uk-input uk-form-width-medium" placeholder="Username" type="text" name="username" [(ngModel)]="username">
|
||||||
</form-->
|
</div>
|
||||||
<div *ngIf="errorCode == '1'" class="uk-alert uk-alert-warning">
|
|
||||||
The requested page requires authentication.
|
<div class="uk-margin">
|
||||||
<span *ngIf="!loggedIn">
|
<input placeholder="Password" class="uk-input uk-form-width-medium" type="password" name="password" [(ngModel)]="password">
|
||||||
Please <a class="" (click)="logIn()" > sign in</a> to continue.
|
</div>
|
||||||
|
<div class="uk-margin">
|
||||||
|
<button (click)="login()" class=" uk-button uk-button-primary">Login</button>
|
||||||
|
</div>
|
||||||
|
</form-->
|
||||||
|
<div *ngIf="errorCode == '1'" class="uk-alert uk-alert-warning">
|
||||||
|
The requested page requires authentication.
|
||||||
|
<span *ngIf="!loggedIn">
|
||||||
|
Please <a class="" (click)="logIn()"> sign in</a> to continue.
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="errorCode == '2'" class="uk-alert uk-alert-warning">
|
<div *ngIf="errorCode == '2'" class="uk-alert uk-alert-warning">
|
||||||
You are not authorized to use the requested page.
|
You are not authorized to use the requested page.
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="errorCode == '3'" class="uk-alert uk-alert-warning">
|
<div *ngIf="errorCode == '3'" class="uk-alert uk-alert-warning">
|
||||||
The session has expired. Please <a class="" (click)="logIn()" >sign in</a> again or continue <a class="" (click)="redirect();">browsing as a guest</a>.
|
The session has expired. Please <a class="" (click)="logIn()">sign in</a> again or continue <a class=""
|
||||||
</div>
|
(click)="redirect();">browsing as a guest</a>.
|
||||||
<div *ngIf="errorCode == '4'" class="uk-alert uk-alert-warning">
|
</div>
|
||||||
You are not authorized to use the requested page.
|
<div *ngIf="errorCode == '4'" class="uk-alert uk-alert-warning">
|
||||||
</div>
|
You are not authorized to use the requested page.
|
||||||
<div *ngIf="errorCode == '5'" class="uk-alert uk-alert-warning">
|
</div>
|
||||||
There is no research community selected.
|
<div *ngIf="errorCode == '5'" class="uk-alert uk-alert-warning">
|
||||||
</div>
|
There is no research community selected.
|
||||||
|
</div>
|
||||||
|
|
||||||
<div *ngIf="!loggedIn && errorMessage.length > 0" class="uk-alert uk-alert-danger">{{errorMessage}}</div>
|
<div *ngIf="!loggedIn && errorMessage.length > 0" class="uk-alert uk-alert-danger">{{errorMessage}}</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -88,9 +88,10 @@ export class UserComponent {
|
||||||
}else{
|
}else{
|
||||||
this.router.navigate([baseUrl]);
|
this.router.navigate([baseUrl]);
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
this.router.navigate(['/']);
|
|
||||||
}
|
}
|
||||||
|
// else{
|
||||||
|
// this.router.navigate(['/']);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
logIn(){
|
logIn(){
|
||||||
|
@ -112,6 +113,19 @@ export class UserComponent {
|
||||||
|
|
||||||
window.location.href = this.properties.loginUrl;
|
window.location.href = this.properties.loginUrl;
|
||||||
}
|
}
|
||||||
|
getTheRolesFormatted(roles:string[]){
|
||||||
|
let formattedRoles = [];
|
||||||
|
for(let role of roles ){
|
||||||
|
let formattedRole = role.split("urn:geant:openaire.eu:group:")[1];
|
||||||
|
formattedRole=formattedRole.split("#aai.openaire.eu")[0]
|
||||||
|
formattedRole = formattedRole.replace("+"," ");
|
||||||
|
formattedRole = formattedRole.split("+").join(" ");
|
||||||
|
formattedRoles.push(formattedRole);
|
||||||
|
}
|
||||||
|
return formattedRoles.join(", ");
|
||||||
|
}
|
||||||
|
isUSerManager(){
|
||||||
|
return Session.isUserManager();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,20 @@ export class Session{
|
||||||
}
|
}
|
||||||
return isAuthorized;
|
return isAuthorized;
|
||||||
}
|
}
|
||||||
|
public static isUserManager():boolean {
|
||||||
|
var isAuthorized = false;
|
||||||
|
if(Session.isLoggedIn()){
|
||||||
|
var roles = ["urn:geant:openaire.eu:group:User+Manager#aai.openaire.eu"];
|
||||||
|
for (var i = 0; i < roles.length; i++) {
|
||||||
|
if ((Session.getUser().role).indexOf(roles[i]) > -1) {
|
||||||
|
isAuthorized = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isAuthorized;
|
||||||
|
}
|
||||||
|
return isAuthorized;
|
||||||
|
}
|
||||||
public static isRegisteredUser():boolean {
|
public static isRegisteredUser():boolean {
|
||||||
var isAuthorized = false;
|
var isAuthorized = false;
|
||||||
if(Session.isLoggedIn()){
|
if(Session.isLoggedIn()){
|
||||||
|
|
|
@ -39,9 +39,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="result.publisher != undefined && result.publisher != ''"><span class="uk-text-bold">Publisher:</span> {{result.publisher}}</div>
|
<div *ngIf="result.publisher != undefined && result.publisher != ''"><span class="uk-text-bold">Publisher:</span> {{result.publisher}}</div>
|
||||||
<span *ngIf="result['type'] != undefined && result['type'] != ''" class="uk-label custom-label label-blue label-dataprovider" title="Type"> {{result['type']}}</span>
|
<span *ngIf="result['type'] != undefined && result['type'] != ''" class="uk-label custom-label label-blue label-dataprovider" title="Type"> {{result['type']}}</span>{{' '}}
|
||||||
<span *ngIf="result['compatibility'] != undefined && result['compatibility'] != ''" class="uk-label custom-label label-compatibility" title="Compatibility">{{result.compatibility}}</span>
|
<span *ngIf="result['compatibility'] != undefined && result['compatibility'] != ''" class="uk-label custom-label label-compatibility" title="Compatibility">{{result.compatibility}}</span>{{' '}}
|
||||||
<span *ngIf="result.country != undefined && result.country != ''" class="uk-label custom-label label-country" title="Country"> {{result.country}}</span>
|
<span *ngIf="result.country != undefined && result.country != ''" class="uk-label custom-label label-country" title="Country"> {{result.country}}</span>{{' '}}
|
||||||
<div *ngIf="result['projects'] != undefined">
|
<div *ngIf="result['projects'] != undefined">
|
||||||
<span> Project: </span>
|
<span> Project: </span>
|
||||||
<span *ngFor="let project of result['projects'].slice(0,15) let i=index">
|
<span *ngFor="let project of result['projects'].slice(0,15) let i=index">
|
||||||
|
|
|
@ -21,12 +21,12 @@ import {EnvProperties} from '../properties/env-properties';
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class="uk-text-muted">ORCID</div>
|
<div class="uk-text-muted">ORCID</div>
|
||||||
<span><code class="uk-padding-small" [id]="'orcid_clipboard_auhtor_'+i">{{author.orcid}}</code></span>
|
<span><code class="uk-padding-small" [id]="'orcid_clipboard_auhtor_'+i">{{author.orcid}}</code></span>{{" "}}
|
||||||
<span>
|
<span>
|
||||||
<button [class]="'uk-icon-clipboard uk-button uk-button-primary uk-button-small orcid_clipboard_btn_auhtor_'+i"
|
<button [class]="'uk-icon-clipboard uk-button uk-button-primary uk-button-small orcid_clipboard_btn_auhtor_'+i"
|
||||||
[attr.data-clipboard-target]="'#orcid_clipboard_auhtor_'+i" title="Copy to clipboard">
|
[attr.data-clipboard-target]="'#orcid_clipboard_auhtor_'+i" title="Copy to clipboard">
|
||||||
Copy
|
Copy
|
||||||
</button>
|
</button>{{" "}}
|
||||||
<a class="uk-button uk-button-primary uk-button-small" title="Visit author in Orcid"
|
<a class="uk-button uk-button-primary uk-button-small" title="Visit author in Orcid"
|
||||||
[href]="properties.orcidURL+author.orcid" target="_blank">
|
[href]="properties.orcidURL+author.orcid" target="_blank">
|
||||||
Visit
|
Visit
|
||||||
|
|
Loading…
Reference in New Issue