commit 87c1bdd1f5fb15ba8236c18f880740366a968cd2
Author: hlavja <hlavjah@gmail.com>
Date:   Mon Apr 26 14:42:44 2021 +0200

    Re #8728 - Implemetace autorizace přes nové API endpointy
    
    * login with nes endpoints
    + getting user info from endpoint
    + defining new endpoints to OpenAPI

diff --git a/nginx.conf b/nginx.conf
index 3eff8c8..cd6e825 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -52,32 +52,46 @@ http {
 
     }
 
-        location /api/SensLogV1/OGCSensorThings {
-                  proxy_set_header X-Forwarded-Host $host;
-                  proxy_set_header X-Forwarded-Server $host;
-                  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-                  #proxy_pass http://<ContainerName>:<PortNumber>;
-                  # In our case Container name is as we setup in docker-compose `beservice` and port 8080
-                  proxy_pass http://51.15.45.95:9080;
-                  proxy_max_temp_file_size "1024m";
-                  proxy_read_timeout       "60s";
-
-                  add_header X-Frame-Options SAMEORIGIN always;
-
-        }
-
-        location /analytics {
-                  proxy_set_header X-Forwarded-Host $host;
-                  proxy_set_header X-Forwarded-Server $host;
-                  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-                  #proxy_pass http://<ContainerName>:<PortNumber>;
-                  # In our case Container name is as we setup in docker-compose `beservice` and port 8080
-                  proxy_pass http://51.15.45.95:9090;
-                  proxy_max_temp_file_size "1024m";
-                  proxy_read_timeout       "60s";
-
-                  add_header X-Frame-Options SAMEORIGIN always;
-
-        }
+    location /api/SensLogV1/OGCSensorThings {
+              proxy_set_header X-Forwarded-Host $host;
+              proxy_set_header X-Forwarded-Server $host;
+              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+              #proxy_pass http://<ContainerName>:<PortNumber>;
+              # In our case Container name is as we setup in docker-compose `beservice` and port 8080
+              proxy_pass http://51.15.45.95:9080;
+              proxy_max_temp_file_size "1024m";
+              proxy_read_timeout       "60s";
+
+              add_header X-Frame-Options SAMEORIGIN always;
+
+    }
+
+    location /analytics {
+              proxy_set_header X-Forwarded-Host $host;
+              proxy_set_header X-Forwarded-Server $host;
+              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+              #proxy_pass http://<ContainerName>:<PortNumber>;
+              # In our case Container name is as we setup in docker-compose `beservice` and port 8080
+              proxy_pass http://51.15.45.95:9090;
+              proxy_max_temp_file_size "1024m";
+              proxy_read_timeout       "60s";
+
+              add_header X-Frame-Options SAMEORIGIN always;
+
+    }
+
+    location /senslog15 {
+              proxy_set_header X-Forwarded-Host $host;
+              proxy_set_header X-Forwarded-Server $host;
+              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+              #proxy_pass http://<ContainerName>:<PortNumber>;
+              # In our case Container name is as we setup in docker-compose `beservice` and port 8080
+              proxy_pass http://51.15.45.95:8080;
+              proxy_max_temp_file_size "1024m";
+              proxy_read_timeout       "60s";
+
+              add_header X-Frame-Options SAMEORIGIN always;
+
+    }
   }
 }
diff --git a/proxy-config.json b/proxy-config.json
index 41df279..99b1564 100644
--- a/proxy-config.json
+++ b/proxy-config.json
@@ -14,5 +14,9 @@
   "/analytics": {
     "target": "http://51.15.45.95:9090",
     "secure": false
+  },
+  "/senslog15": {
+    "target": "http://51.15.45.95:8080",
+    "secure": false
   }
 }
diff --git a/src/app/auth/guards/role.guard.ts b/src/app/auth/guards/role.guard.ts
index 0f9e3ee..b767e6c 100644
--- a/src/app/auth/guards/role.guard.ts
+++ b/src/app/auth/guards/role.guard.ts
@@ -23,7 +23,7 @@ export class RoleGuard implements CanActivate {
     state: RouterStateSnapshot
   ): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
     const expectedRole: string[] = routeSnapshot.data.expectedRole;
-    if (expectedRole.includes(this.authService.getUser().userInfo.rights.toString())) {
+    if (expectedRole.includes(this.authService.getUser().userInfo.rightsId.toString())) {
       console.log('You have enough rights!');
      return true;
     }
diff --git a/src/app/auth/interceptors/auth.interceptor.ts b/src/app/auth/interceptors/auth.interceptor.ts
index d6a36d0..84e9408 100644
--- a/src/app/auth/interceptors/auth.interceptor.ts
+++ b/src/app/auth/interceptors/auth.interceptor.ts
@@ -40,7 +40,8 @@ export class AuthInterceptor implements HttpInterceptor {
     return next.handle(request)
       .pipe(
         catchError(err => {
-          if ((err instanceof HttpErrorResponse && err.status === 504 || err.status === 502 || err.status === 0 || err.status === 500)) {
+          if ((err instanceof HttpErrorResponse && err.status === 504 || err.status === 502 || err.status === 401 ||
+            err.status === 0 || err.status === 500)) {
             return this.handleError(request, next);
           } else {
             return throwError(err);
diff --git a/src/app/auth/models/user.ts b/src/app/auth/models/user.ts
index 8d4f6ab..5825f1b 100644
--- a/src/app/auth/models/user.ts
+++ b/src/app/auth/models/user.ts
@@ -1,9 +1,10 @@
 /* tslint:disable */
 /* eslint-disable */
 import {UserInfo} from '../../shared/api/endpoints/models/user-info';
+import {UserCookie} from '../../shared/api/endpoints/models/user-cookie';
 
 export interface User {
   userInfo?: UserInfo;
   isLoggedIn?: boolean;
-  userName?: string
+  userCookie?: UserCookie
 }
diff --git a/src/app/auth/services/auth.service.ts b/src/app/auth/services/auth.service.ts
index 77b4a78..064ef06 100644
--- a/src/app/auth/services/auth.service.ts
+++ b/src/app/auth/services/auth.service.ts
@@ -9,6 +9,7 @@ import {LoginService} from '../../shared/api/endpoints/services/login.service';
 import {UserInfo} from '../../shared/api/endpoints/models/user-info';
 import {User} from '../models/user';
 import {GlobalVariable} from '../../globals';
+import {UserCookie} from '../../shared/api/endpoints/models/user-cookie';
 
 @Injectable({
   providedIn: 'root'
@@ -26,20 +27,19 @@ export class AuthService {
 
   setFromCookie() {
     const user: User = {
-      userInfo: {
-        rights: JSON.parse(localStorage.getItem(GlobalVariable.RIGHTS)),
+      userCookie: {
+        rightsID: JSON.parse(localStorage.getItem(GlobalVariable.RIGHTS)),
         language: this.cookieService.get(GlobalVariable.LANGUAGE),
         audio: JSON.parse(this.cookieService.get(GlobalVariable.AUDIO)),
         sessionid: this.cookieService.get(GlobalVariable.SESSION_ID)
       },
-      userName: localStorage.getItem(GlobalVariable.USER_NAME),
       isLoggedIn: true
     }
     this.userState.setUser(user);
   }
 
   getUser() {
-    console.log('Auth Service', this.userState.getUser());
+    console.log('Auth Service');
     if (!this.userState.getUser() && this.cookieService.get(GlobalVariable.SESSION_ID)) {
       console.log('Session in cookie!');
       this.setFromCookie();
@@ -54,7 +54,7 @@ export class AuthService {
   doLogin(loginInput): Observable<boolean> {
     return this.loginService.login$Response(loginInput)
       .pipe(
-        tap((userInfo: HttpResponse<UserInfo>) => this.setUserFromResponse(userInfo.body, loginInput.username)),
+        tap((userCookie: HttpResponse<UserCookie>) => this.setUserFromResponse(userCookie.body, loginInput.username)),
         mapTo(true),
         catchError(() => {
           return of<boolean>(false);
@@ -62,16 +62,14 @@ export class AuthService {
       );
   }
 
-  setUserFromResponse(userInfo: UserInfo, username): UserInfo {
-    userInfo = this.setRights(userInfo, username);
+  setUserFromResponse(userCookie: UserCookie, username): UserCookie {
     console.log('Setting user from login!');
     this.userState.setUser({
-      userInfo,
-      isLoggedIn: true,
-      userName: username
+      userCookie,
+      isLoggedIn: true
     });
-    this.setSessionStorage(userInfo, username);
-    return userInfo;
+    this.setSessionStorage(userCookie, username);
+    return userCookie;
   }
 
   doLogout() {
@@ -81,18 +79,8 @@ export class AuthService {
     this.router.navigate(['/login']);
   }
 
-  setSessionStorage(userInfo: UserInfo, username) {
+  setSessionStorage(userCookie: UserCookie, username) {
     localStorage.setItem(GlobalVariable.USER_NAME, username)
-    localStorage.setItem(GlobalVariable.RIGHTS, userInfo.rights.toString());
-  }
-
-  setRights(userInfo: UserInfo, username: string): UserInfo {
-    // TODO - todle je pene naho... naprd
-    if (username === 'kiv') {
-      userInfo.rights = 1;
-    } else {
-      userInfo.rights = 2;
-    }
-    return userInfo;
+    localStorage.setItem(GlobalVariable.RIGHTS, userCookie.rightsID.toString());
   }
 }
diff --git a/src/app/auth/states/user.state.ts b/src/app/auth/states/user.state.ts
index 10e382f..7151e9d 100644
--- a/src/app/auth/states/user.state.ts
+++ b/src/app/auth/states/user.state.ts
@@ -1,6 +1,8 @@
 import {Injectable} from '@angular/core';
 import {BehaviorSubject, Observable} from 'rxjs';
 import {User} from '../models/user';
+import {AuthService} from '../services/auth.service';
+import {LoginService} from '../../shared/api/endpoints/services/login.service';
 
 @Injectable({
   providedIn: 'root'
@@ -8,7 +10,9 @@ import {User} from '../models/user';
 export class UserState {
   private userState$: BehaviorSubject<User> = new BehaviorSubject<User>(null);
 
-  constructor() {}
+  constructor(
+    private loginService: LoginService
+  ) {}
 
   setUser(user: User): void {
     this.userState$.next(user);
@@ -23,6 +27,9 @@ export class UserState {
   }
 
   getUser$(refresh: boolean = false): Observable<User> {
+   if (this.userState$.getValue()){
+      this.loginService.getUserInfo().subscribe(res => this.userState$.next({...this.userState$.getValue(), userInfo: res}));
+    }
     return this.userState$.asObservable();
   }
 
diff --git a/src/app/dashboard/components/dashboard.component.ts b/src/app/dashboard/components/dashboard.component.ts
index eda1b4c..aeb0225 100644
--- a/src/app/dashboard/components/dashboard.component.ts
+++ b/src/app/dashboard/components/dashboard.component.ts
@@ -5,7 +5,6 @@ import {GeneralInfo} from '../../shared/api/endpoints/models/general-info';
 import {Lastpos} from '../../shared/api/endpoints/models/lastpos';
 import {Sensor} from '../../shared/api/endpoints/models/sensor';
 import {Unit} from '../../shared/api/endpoints/models/unit';
-import {GroupService} from '../../shared/api/endpoints/services/group.service';
 import {DataService} from '../../shared/api/endpoints/services/data.service';
 import {tap} from 'rxjs/operators';
 
@@ -22,7 +21,6 @@ export class DashboardComponent implements OnInit {
   editedUnit: Unit;
 
   constructor(
-    private groupService: GroupService,
     private dataService: DataService
   ) {
   }
@@ -31,13 +29,6 @@ export class DashboardComponent implements OnInit {
     this.getUnits();
   }
 
-  getGroups() {
-    console.log('Get Groups');
-    this.groupService.getGroups({Operation: 'GetGroups'}).pipe(
-      tap(data => this.groups = data)
-    ).subscribe();
-  }
-
   getUnits() {
     this.dataService.getData().pipe(
       tap(data => {
diff --git a/src/app/shared/api/endpoints/api.module.ts b/src/app/shared/api/endpoints/api.module.ts
index c21dd2b..9df291e 100644
--- a/src/app/shared/api/endpoints/api.module.ts
+++ b/src/app/shared/api/endpoints/api.module.ts
@@ -6,7 +6,6 @@ import { ApiConfiguration, ApiConfigurationParams } from './api-configuration';
 
 import { LoginService } from './services/login.service';
 import { GroupService } from './services/group.service';
-import { ObservationService } from './services/observation.service';
 import { DataService } from './services/data.service';
 import { AnalyticsService } from './services/analytics.service';
 
@@ -20,7 +19,6 @@ import { AnalyticsService } from './services/analytics.service';
   providers: [
     LoginService,
     GroupService,
-    ObservationService,
     DataService,
     AnalyticsService,
     ApiConfiguration
diff --git a/src/app/shared/api/endpoints/models.ts b/src/app/shared/api/endpoints/models.ts
index 581b861..2318690 100644
--- a/src/app/shared/api/endpoints/models.ts
+++ b/src/app/shared/api/endpoints/models.ts
@@ -1,3 +1,4 @@
+export { UserCookie } from './models/user-cookie';
 export { UserInfo } from './models/user-info';
 export { Group } from './models/group';
 export { Unit } from './models/unit';
@@ -9,9 +10,8 @@ export { AlertEvents } from './models/alert-events';
 export { Lastpos } from './models/lastpos';
 export { GeneralInfo } from './models/general-info';
 export { Drivers } from './models/drivers';
-export { Observation } from './models/observation';
 export { Sensors } from './models/sensors';
 export { SensorsData } from './models/sensors-data';
 export { Data } from './models/data';
-export { Obser } from './models/obser';
+export { Observation } from './models/observation';
 export { Statistics } from './models/statistics';
diff --git a/src/app/shared/api/endpoints/models/data.ts b/src/app/shared/api/endpoints/models/data.ts
index e6f1a17..16e21f7 100644
--- a/src/app/shared/api/endpoints/models/data.ts
+++ b/src/app/shared/api/endpoints/models/data.ts
@@ -1,6 +1,6 @@
 /* tslint:disable */
 /* eslint-disable */
-import { Obser } from './obser';
+import { Observation } from './observation';
 export interface Data {
-  observation?: Obser;
+  observation?: Observation;
 }
diff --git a/src/app/shared/api/endpoints/models/obser.ts b/src/app/shared/api/endpoints/models/obser.ts
deleted file mode 100644
index b1ed022..0000000
--- a/src/app/shared/api/endpoints/models/obser.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/* tslint:disable */
-/* eslint-disable */
-export interface Obser {
-  avg?: number;
-  max?: number;
-  min?: number;
-  sum?: number;
-  timestamp?: string;
-}
diff --git a/src/app/shared/api/endpoints/models/observation.ts b/src/app/shared/api/endpoints/models/observation.ts
index f265607..6516061 100644
--- a/src/app/shared/api/endpoints/models/observation.ts
+++ b/src/app/shared/api/endpoints/models/observation.ts
@@ -1,7 +1,9 @@
 /* tslint:disable */
 /* eslint-disable */
 export interface Observation {
-  gid?: number;
-  time?: string;
-  value?: number;
+  avg?: number;
+  max?: number;
+  min?: number;
+  sum?: number;
+  timestamp?: string;
 }
diff --git a/src/app/shared/api/endpoints/models/user-cookie.ts b/src/app/shared/api/endpoints/models/user-cookie.ts
new file mode 100644
index 0000000..50957e2
--- /dev/null
+++ b/src/app/shared/api/endpoints/models/user-cookie.ts
@@ -0,0 +1,8 @@
+/* tslint:disable */
+/* eslint-disable */
+export interface UserCookie {
+  audio?: boolean;
+  language?: string;
+  rightsID?: number;
+  sessionid?: string;
+}
diff --git a/src/app/shared/api/endpoints/models/user-info.ts b/src/app/shared/api/endpoints/models/user-info.ts
index 1d19d30..8db5971 100644
--- a/src/app/shared/api/endpoints/models/user-info.ts
+++ b/src/app/shared/api/endpoints/models/user-info.ts
@@ -1,8 +1,10 @@
 /* tslint:disable */
 /* eslint-disable */
 export interface UserInfo {
-  audio?: boolean;
-  language?: string;
-  rights?: number;
-  sessionid?: string;
+  groupId?: number;
+  rightsId?: number;
+  userId?: number;
+  userName?: string;
+  userPass?: string;
+  userRealName?: string;
 }
diff --git a/src/app/shared/api/endpoints/services.ts b/src/app/shared/api/endpoints/services.ts
index d475b8e..7815fff 100644
--- a/src/app/shared/api/endpoints/services.ts
+++ b/src/app/shared/api/endpoints/services.ts
@@ -1,5 +1,4 @@
 export { LoginService } from './services/login.service';
 export { GroupService } from './services/group.service';
-export { ObservationService } from './services/observation.service';
 export { DataService } from './services/data.service';
 export { AnalyticsService } from './services/analytics.service';
diff --git a/src/app/shared/api/endpoints/services/login.service.ts b/src/app/shared/api/endpoints/services/login.service.ts
index d2c8567..92cdb8f 100644
--- a/src/app/shared/api/endpoints/services/login.service.ts
+++ b/src/app/shared/api/endpoints/services/login.service.ts
@@ -9,6 +9,7 @@ import { RequestBuilder } from '../request-builder';
 import { Observable } from 'rxjs';
 import { map, filter } from 'rxjs/operators';
 
+import { UserCookie } from '../models/user-cookie';
 import { UserInfo } from '../models/user-info';
 
 
@@ -29,7 +30,7 @@ export class LoginService extends BaseService {
   /**
    * Path part for operation login
    */
-  static readonly LoginPath = '/senslog1/ControllerServlet';
+  static readonly LoginPath = '/senslog15/ControllerServlet';
 
   /**
    * Authorize login.
@@ -52,7 +53,7 @@ export class LoginService extends BaseService {
      * User password
      */
     password?: string;
-  }): Observable<StrictHttpResponse<UserInfo>> {
+  }): Observable<StrictHttpResponse<UserCookie>> {
 
     const rb = new RequestBuilder(this.rootUrl, LoginService.LoginPath, 'post');
     if (params) {
@@ -66,7 +67,7 @@ export class LoginService extends BaseService {
     })).pipe(
       filter((r: any) => r instanceof HttpResponse),
       map((r: HttpResponse<any>) => {
-        return r as StrictHttpResponse<UserInfo>;
+        return r as StrictHttpResponse<UserCookie>;
       })
     );
   }
@@ -92,9 +93,60 @@ export class LoginService extends BaseService {
      * User password
      */
     password?: string;
-  }): Observable<UserInfo> {
+  }): Observable<UserCookie> {
 
     return this.login$Response(params).pipe(
+      map((r: StrictHttpResponse<UserCookie>) => r.body as UserCookie)
+    );
+  }
+
+  /**
+   * Path part for operation getUserInfo
+   */
+  static readonly GetUserInfoPath = '/senslog15/rest/user';
+
+  /**
+   * User information.
+   *
+   *
+   *
+   * This method provides access to the full `HttpResponse`, allowing access to response headers.
+   * To access only the response body, use `getUserInfo()` instead.
+   *
+   * This method doesn't expect any request body.
+   */
+  getUserInfo$Response(params?: {
+  }): Observable<StrictHttpResponse<UserInfo>> {
+
+    const rb = new RequestBuilder(this.rootUrl, LoginService.GetUserInfoPath, 'get');
+    if (params) {
+    }
+
+    return this.http.request(rb.build({
+      responseType: 'json',
+      accept: 'application/json'
+    })).pipe(
+      filter((r: any) => r instanceof HttpResponse),
+      map((r: HttpResponse<any>) => {
+        return r as StrictHttpResponse<UserInfo>;
+      })
+    );
+  }
+
+  /**
+   * User information.
+   *
+   *
+   *
+   * This method provides access to only to the response body.
+   * To access the full response (for headers, for example), `getUserInfo$Response()` instead.
+   *
+   * This method doesn't expect any request body.
+   */
+  getUserInfo(params?: {
+  }): Observable<UserInfo> {
+
+    return this.getUserInfo$Response(params).pipe(
       map((r: StrictHttpResponse<UserInfo>) => r.body as UserInfo)
     );
   }
diff --git a/src/app/shared/api/endpoints/services/observation.service.ts b/src/app/shared/api/endpoints/services/observation.service.ts
deleted file mode 100644
index 2f2133f..0000000
--- a/src/app/shared/api/endpoints/services/observation.service.ts
+++ /dev/null
@@ -1,92 +0,0 @@
-/* tslint:disable */
-/* eslint-disable */
-import { Injectable } from '@angular/core';
-import { HttpClient, HttpResponse } from '@angular/common/http';
-import { BaseService } from '../base-service';
-import { ApiConfiguration } from '../api-configuration';
-import { StrictHttpResponse } from '../strict-http-response';
-import { RequestBuilder } from '../request-builder';
-import { Observable } from 'rxjs';
-import { map, filter } from 'rxjs/operators';
-
-import { Observation } from '../models/observation';
-
-
-/**
- * Observations endpoints
- */
-@Injectable({
-  providedIn: 'root',
-})
-export class ObservationService extends BaseService {
-  constructor(
-    config: ApiConfiguration,
-    http: HttpClient
-  ) {
-    super(config, http);
-  }
-
-  /**
-   * Path part for operation getObservation
-   */
-  static readonly GetObservationPath = '/senslog1/SensorService?Operation=GetObservations';
-
-  /**
-   * Get observation.
-   *
-   *
-   *
-   * This method provides access to the full `HttpResponse`, allowing access to response headers.
-   * To access only the response body, use `getObservation()` instead.
-   *
-   * This method doesn't expect any request body.
-   */
-  getObservation$Response(params: {
-    unit_id: number;
-    sensor_id: number;
-    from?: string;
-    to?: string;
-  }): Observable<StrictHttpResponse<Array<Observation>>> {
-
-    const rb = new RequestBuilder(this.rootUrl, ObservationService.GetObservationPath, 'get');
-    if (params) {
-      rb.query('unit_id', params.unit_id, {});
-      rb.query('sensor_id', params.sensor_id, {});
-      rb.query('from', params.from, {});
-      rb.query('to', params.to, {});
-    }
-
-    return this.http.request(rb.build({
-      responseType: 'json',
-      accept: 'application/json'
-    })).pipe(
-      filter((r: any) => r instanceof HttpResponse),
-      map((r: HttpResponse<any>) => {
-        return r as StrictHttpResponse<Array<Observation>>;
-      })
-    );
-  }
-
-  /**
-   * Get observation.
-   *
-   *
-   *
-   * This method provides access to only to the response body.
-   * To access the full response (for headers, for example), `getObservation$Response()` instead.
-   *
-   * This method doesn't expect any request body.
-   */
-  getObservation(params: {
-    unit_id: number;
-    sensor_id: number;
-    from?: string;
-    to?: string;
-  }): Observable<Array<Observation>> {
-
-    return this.getObservation$Response(params).pipe(
-      map((r: StrictHttpResponse<Array<Observation>>) => r.body as Array<Observation>)
-    );
-  }
-
-}
diff --git a/src/app/shared/api/openapi.yaml b/src/app/shared/api/openapi.yaml
index 0283aea..b7184f6 100644
--- a/src/app/shared/api/openapi.yaml
+++ b/src/app/shared/api/openapi.yaml
@@ -23,7 +23,7 @@ tags:
   description: Analitics endpoints
 
 paths:
-  /senslog1/ControllerServlet:
+  /senslog15/ControllerServlet:
     post:
       tags:
       - login
@@ -40,6 +40,20 @@ paths:
           schema:
             type: string
           description: User password
+      responses:
+        200:
+          description: successful operation
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/UserCookie'
+
+  /senslog15/rest/user:
+    get:
+      tags:
+        - login
+      summary: User information
+      operationId: getUserInfo
       responses:
         200:
           description: successful operation
@@ -80,41 +94,6 @@ paths:
                 items:
                   $ref: '#/components/schemas/Group'
 
-  /senslog1/SensorService?Operation=GetObservations:
-    get:
-      tags:
-        - observation
-      summary: Get observation
-      operationId: getObservation
-      parameters:
-        - in: query
-          name: unit_id
-          required: true
-          schema:
-            type: integer
-        - in: query
-          name: sensor_id
-          required: true
-          schema:
-            type: integer
-        - in: query
-          name: from
-          schema:
-            type: string
-        - in: query
-          name: to
-          schema:
-            type: string
-      responses:
-        200:
-          description: Get observation for unitId and sensorId
-          content:
-            application/json:
-              schema:
-                type: array
-                items:
-                  $ref: '#/components/schemas/Observation'
-
   /senslog1/DataService?Operation=GetUnits:
     get:
       tags:
@@ -189,7 +168,7 @@ paths:
 
 components:
   schemas:
-    UserInfo:
+    UserCookie:
       type: object
       properties:
         sessionid:
@@ -198,7 +177,23 @@ components:
           type: string
         audio:
           type: boolean
-        rights:
+        rightsID:
+          type: integer
+
+    UserInfo:
+      type: object
+      properties:
+        userId:
+          type: integer
+        userName:
+          type: string
+        userPass:
+          type: string
+        userRealName:
+          type: string
+        groupId:
+          type: integer
+        "rightsId":
           type: integer
 
     Group:
@@ -303,17 +298,6 @@ components:
     Drivers:
       type: array
 
-    Observation:
-      type: object
-      properties:
-        gid:
-          type: integer
-        time:
-          type: string
-          format: date-time
-        value:
-          type: number
-
     Sensors:
       type: object
       properties:
@@ -334,9 +318,9 @@ components:
       type: object
       properties:
         observation:
-          $ref: '#/components/schemas/Obser'
+          $ref: '#/components/schemas/Observation'
 
-    Obser:
+    Observation:
       type: object
       properties:
         min:
diff --git a/src/app/shared/nav-bar/components/nav-bar.component.html b/src/app/shared/nav-bar/components/nav-bar.component.html
index f36751b..9196e22 100644
--- a/src/app/shared/nav-bar/components/nav-bar.component.html
+++ b/src/app/shared/nav-bar/components/nav-bar.component.html
@@ -10,7 +10,7 @@
             <li class="nav-item">
               <a class="nav-link" [routerLink]="['/dashboard']"><h2>Dashboard</h2></a>
             </li>
-            <li *ngIf="loggedUser.userInfo.rights == 1" class="nav-item">
+            <li *ngIf="loggedUser?.userInfo?.rightsId == 1" class="nav-item">
               <a class="nav-link" [routerLink]="['/administration']"><h2>Administration</h2></a>
             </li>
           </ul>
@@ -20,7 +20,7 @@
           </a>
           <ul class="navbar-nav right">
             <li class="nav-item">
-              <a class="nav-link" href="#"><h2>User:&nbsp;<strong>{{loggedUser?.userName?.toUpperCase()}}</strong></h2></a>
+              <a class="nav-link" href="#"><h2>User:&nbsp;<strong>{{loggedUser?.userInfo?.userName.toUpperCase()}}</strong></h2></a>
             </li>
             <li class="nav-item">
               <a class='nav-link' [routerLink]="['/login']" (click)="logOut()"><h2>Logout</h2></a>
