diff --git a/src/app/components/group-details/add-user-to-group-dialog/add-user-to-group-dialog.component.ts b/src/app/components/group-details/add-user-to-group-dialog/add-user-to-group-dialog.component.ts index 2a83777a..3f1483cb 100644 --- a/src/app/components/group-details/add-user-to-group-dialog/add-user-to-group-dialog.component.ts +++ b/src/app/components/group-details/add-user-to-group-dialog/add-user-to-group-dialog.component.ts @@ -1,3 +1,15 @@ +/* +* Software Name : GNS3 Web UI +* Version: 3 +* SPDX-FileCopyrightText: Copyright (c) 2022 Orange Business Services +* SPDX-License-Identifier: GPL-3.0-or-later +* +* This software is distributed under the GPL-3.0 or any later version, +* the text of which is available at https://www.gnu.org/licenses/gpl-3.0.txt +* or see the "LICENSE" file for more details. +* +* Author: Sylvain MATHIEU, Elise LEBEAU +*/ import {Component, Inject, OnInit} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; import {UserService} from "@services/user.service"; diff --git a/src/app/components/group-details/group-details.component.ts b/src/app/components/group-details/group-details.component.ts index 4115c571..d773634a 100644 --- a/src/app/components/group-details/group-details.component.ts +++ b/src/app/components/group-details/group-details.component.ts @@ -1,3 +1,15 @@ +/* +* Software Name : GNS3 Web UI +* Version: 3 +* SPDX-FileCopyrightText: Copyright (c) 2022 Orange Business Services +* SPDX-License-Identifier: GPL-3.0-or-later +* +* This software is distributed under the GPL-3.0 or any later version, +* the text of which is available at https://www.gnu.org/licenses/gpl-3.0.txt +* or see the "LICENSE" file for more details. +* +* Author: Sylvain MATHIEU, Elise LEBEAU +*/ import {Component, Inject, OnInit} from '@angular/core'; import {ActivatedRoute, Router} from "@angular/router"; import {Server} from "@models/server"; diff --git a/src/app/components/group-details/remove-user-to-group-dialog/remove-user-to-group-dialog.component.ts b/src/app/components/group-details/remove-user-to-group-dialog/remove-user-to-group-dialog.component.ts index 089389d0..ef70a89f 100644 --- a/src/app/components/group-details/remove-user-to-group-dialog/remove-user-to-group-dialog.component.ts +++ b/src/app/components/group-details/remove-user-to-group-dialog/remove-user-to-group-dialog.component.ts @@ -1,3 +1,15 @@ +/* +* Software Name : GNS3 Web UI +* Version: 3 +* SPDX-FileCopyrightText: Copyright (c) 2022 Orange Business Services +* SPDX-License-Identifier: GPL-3.0-or-later +* +* This software is distributed under the GPL-3.0 or any later version, +* the text of which is available at https://www.gnu.org/licenses/gpl-3.0.txt +* or see the "LICENSE" file for more details. +* +* Author: Sylvain MATHIEU, Elise LEBEAU +*/ import {Component, Inject, OnInit} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; import {User} from "@models/users/user"; diff --git a/src/app/models/permission.ts b/src/app/models/permission.ts new file mode 100644 index 00000000..4462cd33 --- /dev/null +++ b/src/app/models/permission.ts @@ -0,0 +1,23 @@ +export enum Methods { + GET = 'GET', + HEAD = 'HEAD', + POST = 'POST', + PATCH = 'PATCH', + PUT = 'PUT', + DELETE = 'DELETE' +} + +export enum PermissionActions { + ALLOW = 'ALLOW', + DENY = 'DENY' +} + +export interface Permission { + methods: Methods[], + path: string, + action: PermissionActions, + description: string, + created_at: string, + updated_at: string, + permission_id: string +} diff --git a/src/app/resolvers/group-details.resolver.ts b/src/app/resolvers/group-details.resolver.ts index ae1c5fc7..89049766 100644 --- a/src/app/resolvers/group-details.resolver.ts +++ b/src/app/resolvers/group-details.resolver.ts @@ -1,3 +1,15 @@ +/* +* Software Name : GNS3 Web UI +* Version: 3 +* SPDX-FileCopyrightText: Copyright (c) 2022 Orange Business Services +* SPDX-License-Identifier: GPL-3.0-or-later +* +* This software is distributed under the GPL-3.0 or any later version, +* the text of which is available at https://www.gnu.org/licenses/gpl-3.0.txt +* or see the "LICENSE" file for more details. +* +* Author: Sylvain MATHIEU, Elise LEBEAU +*/ import { Injectable } from '@angular/core'; import { Router, Resolve, diff --git a/src/app/services/permissions.service.spec.ts b/src/app/services/permissions.service.spec.ts new file mode 100644 index 00000000..f5972c66 --- /dev/null +++ b/src/app/services/permissions.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { PermissionsService } from './permissions.service'; + +describe('PermissionsService', () => { + let service: PermissionsService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(PermissionsService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/permissions.service.ts b/src/app/services/permissions.service.ts new file mode 100644 index 00000000..0de4e409 --- /dev/null +++ b/src/app/services/permissions.service.ts @@ -0,0 +1,29 @@ +import { Injectable } from '@angular/core'; +import {HttpServer} from "./http-server.service"; +import {Server} from "../models/server"; +import {Permission} from "../models/permission"; +import {Observable} from "rxjs/Rx"; + +@Injectable({ + providedIn: 'root' +}) +export class PermissionsService { + + constructor(private httpServer: HttpServer) { } + + list(server: Server) { + return this.httpServer.get(server, '/permissions'); + } + + add(server: Server, permission: Permission): Observable { + return this.httpServer.post(server, '/permissions', permission); + } + + update(server: Server, permission: Permission): Observable { + return this.httpServer.put(server, `/permissions/${permission.permission_id}`, permission); + } + + delete(server: Server, permission_id: string) { + return this.httpServer.delete(server, `/permissions/${permission_id}`); + } +}