Project

General

Profile

« Previous | Next » 

Revision 52780

added authorization check to some post methods

View differences:

modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-data.component.ts
18 18
  HelpContentComponent
19 19
} from "../../../shared/reusablecomponents/help-content.component";
20 20
import {ConfirmationDialogComponent} from "../../../shared/reusablecomponents/confirmation-dialog.component";
21
import {AuthenticationService} from "../../../services/authentication.service";
21 22

  
22 23
@Component ({
23 24
  selector: 'app-sr-data',
......
210 211
      response => {
211 212
        if (response) {
212 213
          this.repo = response;
213
          console.log(`updateInterface responded: ${JSON.stringify(response)}`);
214
          console.log(`updateRepository responded: ${response.id}, ${response.registeredBy}`);
214 215
        }
215 216
      },
216 217
      error => {
......
229 230
      let failed: boolean = false;
230 231
      for (let intrf of this.repoInterfaces) {
231 232
        if (intrf.id) {
232
          this.repoService.updateInterface(this.repo.id, intrf).subscribe(
233
          this.repoService.updateInterface(this.repo.id, this.repo.registeredBy, intrf).subscribe(
233 234
            response => {
234 235
              console.log(`updateRepository responded ${JSON.stringify(response)}`);
235 236
              intrf = response;
......
240 241
            }
241 242
          );
242 243
        } else {
243
          this.repoService.addInterface(this.repo.datasourceType, this.repo.id, intrf).subscribe (
244
          this.repoService.addInterface(this.repo.datasourceType, this.repo.id, this.repo.registeredBy, intrf).subscribe (
244 245
            addedInterface => {
245 246
              console.log(`addInterface responded ${JSON.stringify(addedInterface)}`);
246 247
              intrf = addedInterface;
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-journal.component.ts
13 13
} from "../../../shared/reusablecomponents/help-content.component";
14 14
import {RepositoryService} from "../../../services/repository.service";
15 15
import {ConfirmationDialogComponent} from "../../../shared/reusablecomponents/confirmation-dialog.component";
16
import {AuthenticationService} from "../../../services/authentication.service";
16 17

  
17 18
@Component ({
18 19
  selector: 'app-sr-journal',
......
60 61
    private fb: FormBuilder,
61 62
    private route: ActivatedRoute,
62 63
    private router: Router,
63
    private repoService: RepositoryService) {}
64
    private repoService: RepositoryService,
65
    private authService: AuthenticationService) {}
64 66

  
65 67
  ngOnInit() {
66 68
    this.setQueryParam('basicInformation');
......
125 127
      this.errorMessage = '';
126 128
      this.repoService.addRepository(this.repo.datasourceType, this.repo).subscribe(
127 129
        response => {
128
          console.log(`addRepository responded:\n${JSON.stringify(response)}`);
130
          console.log(`addRepository responded: ${response.id}, ${response.registeredBy}`);
129 131
          this.repo = response;
130 132
        },
131 133
        error => {
......
145 147
      let failed: boolean = false;
146 148
      for (let intrf of this.repoInterfaces) {
147 149
        if (intrf.id) {
148
          this.repoService.updateInterface(this.repo.id, intrf).subscribe(
150
          this.repoService.updateInterface(this.repo.id, this.repo.registeredBy, intrf).subscribe(
149 151
            response => {
150 152
              console.log(`updateInterface responded ${JSON.stringify(response)}`);
151 153
              intrf = response;
......
156 158
            }
157 159
          );
158 160
        } else {
159
          this.repoService.addInterface(this.repo.datasourceType, this.repo.id, intrf).subscribe (
161
          this.repoService.addInterface(this.repo.datasourceType, this.repo.id, this.repo.registeredBy, intrf).subscribe (
160 162
            addedInterface => {
161 163
              console.log(`addInterface responded ${JSON.stringify(addedInterface)}`);
162 164
              intrf = addedInterface;
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-literature.component.ts
23 23
  HelpContentComponent
24 24
} from "../../../shared/reusablecomponents/help-content.component";
25 25
import {ConfirmationDialogComponent} from "../../../shared/reusablecomponents/confirmation-dialog.component";
26
import {AuthenticationService} from "../../../services/authentication.service";
26 27

  
27 28
@Component ({
28 29
  selector:'app-sr-literature',
......
215 216
      response => {
216 217
        if (response) {
217 218
          this.repo = response;
218
          console.log(`updateInterface responded: ${JSON.stringify(response)}`);
219
          console.log(`updateRepository responded: ${response.id}, ${response.registeredBy}`);
219 220
        }
220 221
      },
221 222
      error => {
......
234 235
      let failed: boolean = false;
235 236
      for (let intrf of this.repoInterfaces) {
236 237
        if (intrf.id) {
237
          this.repoService.updateInterface(this.repo.id, intrf).subscribe(
238
          this.repoService.updateInterface(this.repo.id, this.repo.registeredBy, intrf).subscribe(
238 239
            response => {
239 240
              console.log(`updateInterface responded ${JSON.stringify(response)}`);
240 241
              intrf = response;
......
245 246
            }
246 247
          );
247 248
        } else {
248
          this.repoService.addInterface(this.repo.datasourceType, this.repo.id, intrf).subscribe (
249
          this.repoService.addInterface(this.repo.datasourceType, this.repo.registeredBy, this.repo.id, intrf).subscribe (
249 250
            addedInterface => {
250 251
              console.log(`addInterface responded ${JSON.stringify(addedInterface)}`);
251 252
              intrf = addedInterface;
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-aggregator.component.ts
13 13
} from "../../../shared/reusablecomponents/help-content.component";
14 14
import {ConfirmationDialogComponent} from "../../../shared/reusablecomponents/confirmation-dialog.component";
15 15
import {RepositoryService} from "../../../services/repository.service";
16
import {AuthenticationService} from "../../../services/authentication.service";
16 17

  
17 18
@Component ({
18 19
  selector: 'sr-aggregator',
......
125 126
      this.errorMessage = '';
126 127
      this.repoService.addRepository(this.repo.datasourceType, this.repo).subscribe(
127 128
        response => {
128
          console.log(`addRepository responded:\n${JSON.stringify(response)}`);
129
          console.log(`addRepository responded: ${response.id}, ${response.registeredBy}`);
129 130
          this.repo = response;
130 131
        },
131 132
        error => {
......
145 146
      let failed: boolean = false;
146 147
      for (let intrf of this.repoInterfaces) {
147 148
        if (intrf.id) {
148
          this.repoService.updateInterface(this.repo.id, intrf).subscribe(
149
          this.repoService.updateInterface(this.repo.id, this.repo.registeredBy, intrf).subscribe(
149 150
            response => {
150 151
              console.log(`updateInterface responded ${JSON.stringify(response)}`);
151 152
              intrf = response;
......
156 157
            }
157 158
          );
158 159
        } else {
159
          this.repoService.addInterface(this.repo.datasourceType, this.repo.id, intrf).subscribe (
160
          this.repoService.addInterface(this.repo.datasourceType, this.repo.id, this.repo.registeredBy, intrf).subscribe (
160 161
            addedInterface => {
161 162
              console.log(`addInterface responded ${JSON.stringify(addedInterface)}`);
162 163
              intrf = addedInterface;
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-interface-form.component.ts
296 296
  }
297 297

  
298 298
  addInterface() {
299
    this.repoService.addInterface(this.currentRepository.datasourceType, this.currentRepository.id, this.currentInterface).subscribe(
299
    this.repoService.addInterface(this.currentRepository.datasourceType, this.currentRepository.id, this.currentRepository.registeredBy, this.currentInterface).subscribe(
300 300
      addedInterface => {
301 301
        console.log(`addInterface responded ${JSON.stringify(addedInterface)}`);
302 302
        this.currentInterface = addedInterface;
......
321 321
  }
322 322

  
323 323
  updateInterface() {
324
    this.repoService.updateInterface(this.currentRepository.id, this.currentInterface).subscribe(
324
    this.repoService.updateInterface(this.currentRepository.id, this.currentRepository.registeredBy, this.currentInterface).subscribe(
325 325
      response => {
326 326
        console.log(`updateRepository responded ${JSON.stringify(response)}`);
327 327
        if (response) {
......
344 344

  
345 345
  ngOnDestroy() {
346 346
    if (this.currentInterface && this.currentInterface.id && this.toBeDeleted) {
347
      this.repoService.deleteInterface(this.currentInterface.id).subscribe(
347
      this.repoService.deleteInterface(this.currentInterface.id, this.currentRepository.registeredBy).subscribe(
348 348
        response => console.log(`deleteInterface responded: ${JSON.stringify(response)}`),
349 349
        error => console.log(error),
350 350
        () => console.log(`deleted ${this.currentInterface.id}`)
modules/uoa-repository-dashboard-gui/trunk/app/pages/compatibility/compatibility-validation-history.component.ts
162 162
    }
163 163
  }
164 164

  
165
  resubmitJob (id: string) {
166
    this.valService.reSubmitJobForValidation(id).subscribe(
165
  resubmitJob (id: string, email: string) {
166
    this.valService.reSubmitJobForValidation(id, email).subscribe(
167 167
      res => this.successMessage = `The job with id ${id} was successfully resubmitted`,
168 168
      error => {
169 169
        this.failureMessage = `Could not resubmit the job with id ${id}`;
modules/uoa-repository-dashboard-gui/trunk/app/pages/compatibility/compatibility-validation-history.component.html
143 143
                              </a>
144 144
                            </div>
145 145
                            <div>
146
                              <a class="resubmitJob" (click)="resubmitJob(job.id)">Resubmit Job<i class="fa fa-repeat"></i></a>
146
                              <a class="resubmitJob" (click)="resubmitJob(job.id, job.userEmail)">Resubmit Job<i class="fa fa-repeat"></i></a>
147 147
                            </div>
148 148
                          </div>
149 149
                        </td>
modules/uoa-repository-dashboard-gui/trunk/app/services/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'});
modules/uoa-repository-dashboard-gui/trunk/app/services/validator.service.ts
70 70
    return this.httpClient.get<InterfaceInformation>(url,headerOptions);
71 71
  }
72 72

  
73
  reSubmitJobForValidation(id: string) {
74
    let url = `${this.apiUrl}reSubmitJobForValidation/${id}`;
73
  reSubmitJobForValidation(id: string, userEmail: string) {
74
    let url = `${this.apiUrl}reSubmitJobForValidation/${userEmail}/${id}`;
75 75
    console.log(`knocking on: ${url}`);
76 76
    const body = {};
77 77

  
modules/uoa-repository-dashboard-gui/trunk/app/shared/reusablecomponents/403-forbidden-page.component.html
30 30

  
31 31
              <div class="uk-text-center">
32 32
                Sorry, access to this resource on the server is forbidden.<br>
33
                Either check the URL or <a href="/landing">go home</a><!--, or feel free to <a href="http://openminted.eu/support/">report this issue--></a>.
33
                Either check the URL or <a href="/landing">go home</a><!--, or feel free to <a href="http://openminted.eu/support/">report this issue</a>-->.
34 34
              </div>
35 35

  
36 36
            </div>

Also available in: Unified diff