Project

General

Profile

« Previous | Next » 

Revision 51561

added inline validation messages to create-update repository forms

View differences:

topmenu.component.ts
12 12
})
13 13

  
14 14
export class TopMenuComponent implements OnInit {
15
  userLoggedIn: boolean = false;
16
  userName: string = '';
17
  isUserAdmin: boolean = false;
15 18

  
16 19
  constructor(public authService: AuthenticationService) { }
17 20

  
18
  ngOnInit() {}
21
  ngOnInit() {
22
    this.getIsUserLoggedIn();
23
    this.getUserName();
24
    this.getIsUserAdmin();
25
  }
19 26

  
20 27

  
21 28
  onClick(id: string) {
......
29 36
  }
30 37

  
31 38
  logout(){
32
    if(this.getIsUserLoggedIn()){
39
    if( this.userLoggedIn ){
33 40
      this.authService.logout();
34 41
    }
35 42
  }
36 43

  
37
  register(){
38
    this.authService.loginWithState();
39
  }
40 44

  
41 45
  getUserName() {
42
    return this.authService.getUserName();
46
    this.userName = this.authService.getUserName();
47
    return this.userName;
43 48
  }
44 49

  
45 50
  getIsUserLoggedIn() {
46
    return this.authService.getIsUserLoggedIn();
51
    this.userLoggedIn = this.authService.getIsUserLoggedIn();
52
    return this.userLoggedIn;
47 53
  }
48 54

  
49
  isUserAdmin() {
50
    return this.authService.getUserRole().includes('ROLE_ADMIN');
55
  getIsUserAdmin() {
56
    this.isUserAdmin = (this.authService.getUserRole().includes('ROLE_ADMIN'));
57
    return this.isUserAdmin;
51 58
  }
52 59
}

Also available in: Unified diff