Make role name consistent.

This commit is contained in:
kunw 2017-04-07 17:55:57 +08:00
parent afdbcc2b62
commit 3c95bbd53a
2 changed files with 10 additions and 12 deletions

View File

@ -1,7 +1,7 @@
<a *ngIf="hasSignedIn" [routerLink]="['/harbor', 'projects']">&lt; {{'PROJECT_DETAIL.PROJECTS' | translate}}</a> <a *ngIf="hasSignedIn" [routerLink]="['/harbor', 'projects']">&lt; {{'PROJECT_DETAIL.PROJECTS' | translate}}</a>
<a *ngIf="!hasSignedIn" [routerLink]="['/harbor', 'sign-in']">&lt; {{'SEARCH.BACK' | translate}}</a> <a *ngIf="!hasSignedIn" [routerLink]="['/harbor', 'sign-in']">&lt; {{'SEARCH.BACK' | translate}}</a>
<h1 class="sub-header-title">{{currentProject.name}} <span class="role-label" *ngIf="isMember">{{roleName | translate}}</span> <span class="role-label" *ngIf="isSystemAdmin">{{ 'MEMBER.SYS_ADMIN' | translate}}</span></h1> <h1 class="sub-header-title">{{currentProject.name}} <span class="role-label" *ngIf="isMember">{{roleName | translate}}</span></h1>
<nav class="subnav sub-nav-bg-color"> <nav class="subnav sub-nav-bg-color">
<ul class="nav"> <ul class="nav">
<li class="nav-item"> <li class="nav-item">

View File

@ -24,19 +24,17 @@ export class ProjectRoutingResolver implements Resolve<Project>{
if(project) { if(project) {
let currentUser = this.sessionService.getCurrentUser(); let currentUser = this.sessionService.getCurrentUser();
if(currentUser) { if(currentUser) {
let projectMembers = this.sessionService.getProjectMembers();
if(projectMembers) {
let currentMember = projectMembers.find(m=>m.user_id === currentUser.user_id);
if(currentMember) {
project.is_member = true;
project.has_project_admin_role = (currentMember.role_name === 'projectAdmin');
project.role_name = currentMember.role_name;
}
}
if(currentUser.has_admin_role === 1) { if(currentUser.has_admin_role === 1) {
project.has_project_admin_role = true; project.has_project_admin_role = true;
project.role_name = 'sysAdmin';
} else {
let projectMembers = this.sessionService.getProjectMembers();
if(projectMembers) {
let currentMember = projectMembers.find(m=>m.user_id === currentUser.user_id);
if(currentMember) {
project.is_member = true;
project.has_project_admin_role = (currentMember.role_name === 'projectAdmin');
project.role_name = currentMember.role_name;
}
}
} }
} }
return project; return project;