Project

General

Profile

« Previous | Next » 

Revision 52780

added authorization check to some post methods

View differences:

repository.service.ts
30 30
  constructor(private http: Http,
31 31
              private httpClient: HttpClient) { }
32 32

  
33
  addInterface(datatype: string, repoId: string, newInterface: RepositoryInterface): Observable<RepositoryInterface> {
34
    let url = `${this.apiUrl}addInterface?datatype=${datatype}&repoId=${repoId}`;
33
  addInterface(datatype: string, repoId: string, registeredBy: string, newInterface: RepositoryInterface): Observable<RepositoryInterface> {
34
    let url = `${this.apiUrl}addInterface?datatype=${datatype}&repoId=${repoId}&registeredBy=${registeredBy}`;
35 35
    console.log(`knocking on: ${url}`);
36 36
    console.log(`sending ${JSON.stringify(newInterface)}`);
37 37
    httpOptions.withCredentials = true;
38 38
    return this.httpClient.post<RepositoryInterface>(url,newInterface,headerOptions);
39 39
  }
40 40

  
41
  updateInterface(repoId: string, interfaceInfo: RepositoryInterface): Observable<RepositoryInterface> {
42
    let url = `${this.apiUrl}updateRepositoryInterface?repoId=${repoId}`;
41
  updateInterface(repoId: string, registeredBy: string, interfaceInfo: RepositoryInterface): Observable<RepositoryInterface> {
42
    let url = `${this.apiUrl}updateRepositoryInterface?repoId=${repoId}&registeredBy=${registeredBy}`;
43 43
    console.log(`knocking on: ${url}`);
44 44
    console.log(`sending ${JSON.stringify(interfaceInfo)}`);
45 45
    httpOptions.withCredentials = true;
46 46
    return this.httpClient.post<RepositoryInterface>(url,interfaceInfo,headerOptions);
47 47
  }
48 48

  
49
  deleteInterface(id: string) {
50
    let url = `${this.apiUrl}deleteInterface/?id=${id}`;
49
  deleteInterface(id: string, registeredBy: string) {
50
    let url = `${this.apiUrl}deleteInterface/?id=${id}&registeredBy=${registeredBy}`;
51 51
    console.log(`knocking on: ${url}`);
52 52

  
53 53
    return this.httpClient.delete(url, {withCredentials: true, responseType:'text'});

Also available in: Unified diff