Esempio n. 1
5
	changeScheduledTaskStatus(scheduledTaskId: number, actionName: string): Promise<void> {
		return this.http.patch('/api/scheduledtasks', { id: scheduledTaskId, action: actionName })
			.toPromise()
			.then(() => null)
			.catch(this.utils.handleResponseError);
	}
Esempio n. 2
1
 switchMap(user => {
   return this.http.patch('/_api/v1/user/changepassword', {
       old_password: oldPassword,
       new_password: newPassword,
       retype_password: newPassword,
     },
     {
       headers: { 'X-Authorization': 'Bearer ' + user.token }
     }
   );
 })
 modifyContactTag(contactId: number, params): Observable<any> {
     const url = `${Constants.apiContacts}/${contactId}`;
     
     return this.http
         .patch(url, params)
         .pipe(catchError(this.handleError('modifyContactTag', null)));
 }
Esempio n. 4
0
  public updateNote(note: Note): Observable<Note> {
    const updateNoteUrl = `https://whiteraven.azurewebsites.net/api/notes/${note.id}`;

    return this.http.patch<Response<Note>>(updateNoteUrl, { title: note.title, content: note.content })
      .pipe(
        tap(r => {
          const indexInAll = this.dataStore.allNotes.findIndex(x => x.id === r.data.id);

          this.dataStore.allNotes[indexInAll] = r.data;
          this._allNotes.next([...this.dataStore.allNotes]);

          const indexInMy = this.dataStore.myNotes.findIndex(x => x.id === r.data.id);
          if (indexInMy >= 0) {
            this.dataStore.myNotes[indexInMy] = r.data;
            this._myNotes.next([...this.dataStore.myNotes]);
            return;
          }

          const indexInEditable = this.dataStore.editableNotes.findIndex(x => x.id === r.data.id);
          if (indexInEditable >= 0) {
            this.dataStore.editableNotes[indexInEditable] = r.data;
            this._editableNotes.next([...this.dataStore.editableNotes]);
            return;
          }

          throw new Error('Note was not found in the editable collections');
        }),
        map(r => r.data));
  }
Esempio n. 5
0
 updateAclString(rootDn:string, aclStrVal:string){
     let headers = this.authService.getAuthHeader();
     let body  = this.constructSDJsonBody(aclStrVal);
     let url = 'https://' + this.domain + ':' + this.configService.API_PORT + '/v1/vmdir/ldap';
     url += '?dn=' + encodeURIComponent(rootDn);
     console.log(url);
     return this.httpClient.patch(url, body, {headers})
            .share()
            .map((res: Response) => res)
            .catch(this.handleError)
 }
Esempio n. 6
0
 updateAttributes(rootDn:string, originalValMap:Map<string,any>, attribsArr:string[], modifiedAttributesMap:Map<string,any>, schemaMap:Map<string,any>): Observable<string[]> {
     let headers = this.authService.getAuthHeader();
     let body = this.constructJsonBody(originalValMap, attribsArr, modifiedAttributesMap, schemaMap);
     this.getUrl = 'https://' + this.domain + ':' + this.configService.API_PORT + '/v1/vmdir/ldap';
     let updateUrl = this.getUrl + '?dn='+rootDn;
     console.log(updateUrl);
     return this.httpClient.patch(updateUrl, body, {headers})
            .share()
            .map((res: Response) => res)
            .catch(this.handleError)
 }
 patch<T>(url: string, body: string): Observable<T> {
     return this.http.patch<T>(url, body);
 }
 patch<TResponseBody>(url: string, data?: any): Observable<HttpResponse<TResponseBody>> {
     return this.httpClient.patch<TResponseBody>(url, JSON.stringify(data), { observe: 'response' });
 }
Esempio n. 9
0
 updateUser(id: any, user: any) {
   return this.http.patch(`${environment.url}/users/${id}`, user);
 }
Esempio n. 10
0
	/**
	 * Renames an existing playbook.
	 * @param playbookId Current playbook ID to change
	 * @param newName New name for the updated playbook
	 */
	renamePlaybook(playbookId: string, newName: string): Promise<Playbook> {
		return this.http.patch('/api/playbooks', { id: playbookId, name: newName })
			.toPromise()
			.then((data: object) => plainToClass(Playbook, data))
			.catch(this.utils.handleResponseError);
	}