Skip to content

Commit

Permalink
fix: 解决某个组织管理员用户无权在线监控及查看录像问题
Browse files Browse the repository at this point in the history
  • Loading branch information
O-Jiangweidong committed Dec 29, 2023
1 parent e603e26 commit d868d2b
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/app/services/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@ export class HttpService {
options = {};
}
const headers = options.headers || new HttpHeaders();
const orgID = this._cookie.get('X-JMS-LUNA-ORG') || this._cookie.get('X-JMS-ORG');
options.headers = headers.set('X-JMS-ORG', orgID);
if (!options.headers || !options.headers.get('X-JMS-ORG')) {
const orgID = this._cookie.get('X-JMS-LUNA-ORG') || this._cookie.get('X-JMS-ORG');
options.headers = headers.set('X-JMS-ORG', orgID);
}
return options;
}

getJMSOrg() {
return new HttpHeaders().set('X-JMS-ORG', this._cookie.get('X-JMS-ORG'));
}

get<T>(url: string, options?: any): Observable<any> {
options = this.setOrgIDToRequestHeader(url, options);
return this.http.get(url, options).pipe(
Expand Down Expand Up @@ -191,11 +197,15 @@ export class HttpService {
}

getReplay(sessionId: string) {
return this.get(`/api/v1/terminal/sessions/${sessionId}/replay/`);
return this.get(
`/api/v1/terminal/sessions/${sessionId}/replay/`, {headers: this.getJMSOrg()}
);
}

getSessionDetail(sid: string): Promise<Session> {
return this.get<Session>(`/api/v1/terminal/sessions/${sid}/`).toPromise();
return this.get<Session>(
`/api/v1/terminal/sessions/${sid}/`, {headers: this.getJMSOrg()}
).toPromise();
}

getReplayData(src: string) {
Expand All @@ -208,7 +218,9 @@ export class HttpService {
.set('limit', '30')
.set('offset', String(30 * page))
.set('order', 'timestamp');
return this.get('/api/v1/terminal/commands/', {params: params});
return this.get(
'/api/v1/terminal/commands/', {params: params, headers: this.getJMSOrg()}
);
}

cleanRDPParams(params) {
Expand Down

0 comments on commit d868d2b

Please sign in to comment.