From 8866128e14ead1883897235c0dbb7f7925435bed Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Tue, 15 Dec 2020 22:32:52 +0100 Subject: [PATCH] Additional angular code --- .../archiva-web/src/app/app-routing.module.ts | 3 +- .../modules/security/role-routing.module.ts | 50 ++++++++++++++++ .../src/app/modules/security/role.module.ts | 48 +++++++++++++++ .../manage-roles-edit.component.html} | 3 +- .../manage-roles-edit.component.scss | 18 ++++++ .../manage-roles-edit.component.spec.ts | 43 +++++++++++++ .../manage-roles-edit.component.ts} | 9 ++- .../manage-roles-list.component.html | 51 ++++++++++++++++ .../manage-roles-list.component.scss | 18 ++++++ .../manage-roles-list.component.spec.ts | 43 +++++++++++++ .../manage-roles-list.component.ts | 49 +++++++++++++++ .../manage-roles/manage-roles.component.html | 28 +++++++++ .../manage-roles/manage-roles.component.scss | 1 - .../manage-roles.component.spec.ts | 1 - .../manage-roles/manage-roles.component.ts | 60 +++++++++++++++++++ .../security-configuration.component.html | 1 - .../security-configuration.component.scss | 1 - .../security-configuration.component.spec.ts | 1 - .../security-configuration.component.ts | 1 - .../modules/security/user-routing.module.ts | 3 +- .../src/app/modules/security/user.module.ts | 7 +-- .../manage-users-list.component.html | 2 +- .../src/app/services/role.service.ts | 19 ++++++ .../main/archiva-web/src/assets/i18n/en.json | 15 +++++ 24 files changed, 453 insertions(+), 22 deletions(-) create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/role-routing.module.ts create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/role.module.ts rename archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/{manage-roles/manage-roles.component.html => roles/manage-roles-edit/manage-roles-edit.component.html} (96%) create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.scss create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.spec.ts rename archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/{manage-roles/manage-roles.component.ts => roles/manage-roles-edit/manage-roles-edit.component.ts} (82%) create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.html create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.scss create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.spec.ts create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.ts create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.html rename archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/{ => roles}/manage-roles/manage-roles.component.scss (99%) rename archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/{ => roles}/manage-roles/manage-roles.component.spec.ts (99%) create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.ts diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts index be8b0a5f7..c07b1fecc 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/app-routing.module.ts @@ -27,7 +27,6 @@ import {LoginComponent} from "./modules/shared/login/login.component"; import {SearchComponent} from './modules/repo/search/search.component'; import {BrowseComponent} from "./modules/repo/browse/browse.component"; import {UploadComponent} from "./modules/repo/upload/upload.component"; -import {ManageRolesComponent} from "./modules/security/manage-roles/manage-roles.component"; import {RoutingGuardService as Guard} from "./services/routing-guard.service"; import {SecurityConfigurationComponent} from "./modules/security/security-configuration/security-configuration.component"; @@ -51,7 +50,7 @@ const routes: Routes = [ path: 'security', component: HomeComponent,canActivate:[Guard],data:{perm: 'menu.user.section'}, children: [ {path: 'users', loadChildren: () => import('./modules/security/user.module').then(m => m.UserModule)}, - {path: 'roles', component: ManageRolesComponent}, + {path: 'roles', loadChildren: () => import('./modules/security/role.module').then(m => m.RoleModule)}, {path: 'config', component: SecurityConfigurationComponent}, ] }, diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/role-routing.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/role-routing.module.ts new file mode 100644 index 000000000..6452e6569 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/role-routing.module.ts @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import {NgModule} from '@angular/core'; +import {RouterModule, Routes} from '@angular/router'; +import {RoutingGuardService as Guard} from "@app/services/routing-guard.service"; +import {ManageRolesComponent} from "@app/modules/security/roles/manage-roles/manage-roles.component"; +import {ManageRolesListComponent} from "@app/modules/security/roles/manage-roles-list/manage-roles-list.component"; +import {ManageRolesEditComponent} from "@app/modules/security/roles/manage-roles-edit/manage-roles-edit.component"; + + +/** + * You can use Guard (RoutingGuardService) for permission checking. The service needs data with one parameter 'perm', + * that gives the path of the uiPermission map of the user service. + */ + +const routes: Routes = [ + { + path: '', component: ManageRolesComponent, canActivate: [Guard], + data: {perm: 'menu.user.roles'}, + children: [ + {path: 'list', component: ManageRolesListComponent}, + {path: 'edit/:roleid', component: ManageRolesEditComponent}, + {path: '', redirectTo: 'list', pathMatch: 'full'} + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [], + declarations: [] +}) +export class RoleRoutingModule { +} + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/role.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/role.module.ts new file mode 100644 index 000000000..018ae2b7a --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/role.module.ts @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {SharedModule} from "../shared/shared.module"; +import {FormsModule, ReactiveFormsModule} from "@angular/forms"; +import {ManageRolesComponent} from "@app/modules/security/roles/manage-roles/manage-roles.component"; +import {RoleRoutingModule} from "@app/modules/security/role-routing.module"; +import { ManageRolesListComponent } from './roles/manage-roles-list/manage-roles-list.component'; +import { ManageRolesEditComponent } from './roles/manage-roles-edit/manage-roles-edit.component'; + + +@NgModule({ + declarations: [ + ManageRolesComponent, + ManageRolesListComponent, + ManageRolesEditComponent + ], + exports: [ + ManageRolesComponent, + ManageRolesListComponent + ], + imports: [ + CommonModule, + SharedModule, + RoleRoutingModule, + FormsModule, + ReactiveFormsModule + ] +}) +export class RoleModule { +} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.html similarity index 96% rename from archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.html rename to archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.html index 1611de7c1..292d9d59b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.html @@ -8,7 +8,6 @@ ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ ~ Unless required by applicable law or agreed to in writing, ~ software distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -17,4 +16,4 @@ ~ under the License. --> -

manage-roles works!

+

manage-roles-edit works!

diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.scss b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.scss new file mode 100644 index 000000000..343c3b1c0 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.scss @@ -0,0 +1,18 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.spec.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.spec.ts new file mode 100644 index 000000000..4dd52a9f0 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.spec.ts @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ManageRolesEditComponent } from './manage-roles-edit.component'; + +describe('ManageRolesEditComponent', () => { + let component: ManageRolesEditComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ManageRolesEditComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ManageRolesEditComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.ts similarity index 82% rename from archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.ts rename to archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.ts index 5109a872a..4a642cb3c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-edit/manage-roles-edit.component.ts @@ -8,7 +8,6 @@ * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 - * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -20,11 +19,11 @@ import { Component, OnInit } from '@angular/core'; @Component({ - selector: 'app-manage-roles', - templateUrl: './manage-roles.component.html', - styleUrls: ['./manage-roles.component.scss'] + selector: 'app-manage-roles-edit', + templateUrl: './manage-roles-edit.component.html', + styleUrls: ['./manage-roles-edit.component.scss'] }) -export class ManageRolesComponent implements OnInit { +export class ManageRolesEditComponent implements OnInit { constructor() { } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.html new file mode 100644 index 000000000..8b21e6c23 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.html @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
Action
{{role.id}}{{role.name}}{{role.description}}{{role.resource}} + + +
+ +
+ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.scss b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.scss new file mode 100644 index 000000000..343c3b1c0 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.scss @@ -0,0 +1,18 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.spec.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.spec.ts new file mode 100644 index 000000000..05c448b1e --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.spec.ts @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ManageRolesListComponent } from './manage-roles-list.component'; + +describe('ManageRolesListComponent', () => { + let component: ManageRolesListComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ManageRolesListComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ManageRolesListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.ts new file mode 100644 index 000000000..e3998d779 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles-list/manage-roles-list.component.ts @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import {Component, OnInit} from '@angular/core'; +import {TranslateService} from "@ngx-translate/core"; +import {UserService} from "@app/services/user.service"; +import {EntityService} from "@app/model/entity-service"; +import {Role} from "@app/model/role"; +import {Observable} from "rxjs"; +import {PagedResult} from "@app/model/paged-result"; +import {UserInfo} from "@app/model/user-info"; +import {RoleService} from "@app/services/role.service"; + +@Component({ + selector: 'app-manage-roles-list', + templateUrl: './manage-roles-list.component.html', + styleUrls: ['./manage-roles-list.component.scss'] +}) +export class ManageRolesListComponent implements OnInit { + + service: EntityService + + constructor(private translator: TranslateService, private roleService : RoleService) { + this.service = function (searchTerm: string, offset: number, limit: number, orderBy: string[], order: string) : Observable> { + console.log("Retrieving data " + searchTerm + "," + offset + "," + limit + "," + orderBy + "," + order); + return roleService.query(searchTerm, offset, limit, orderBy, order); + } + } + + ngOnInit(): void { + } + + +} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.html new file mode 100644 index 000000000..229d1e7da --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.html @@ -0,0 +1,28 @@ + + + + + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.scss b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.scss similarity index 99% rename from archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.scss rename to archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.scss index 573c9ef45..343c3b1c0 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.scss +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.scss @@ -8,7 +8,6 @@ * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 - * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.spec.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.spec.ts similarity index 99% rename from archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.spec.ts rename to archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.spec.ts index f3d2b6407..d3bd373e2 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/manage-roles/manage-roles.component.spec.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.spec.ts @@ -8,7 +8,6 @@ * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 - * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.ts new file mode 100644 index 000000000..f2a67ddef --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/roles/manage-roles/manage-roles.component.ts @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Component, OnInit } from '@angular/core'; +import {merge, Observable} from "rxjs"; +import {map, tap} from "rxjs/operators"; +import {ActivatedRoute} from "@angular/router"; + +@Component({ + selector: 'app-manage-roles', + templateUrl: './manage-roles.component.html', + styleUrls: ['./manage-roles.component.scss'] +}) +export class ManageRolesComponent implements OnInit { + + roleId$:Observable + + constructor(private route : ActivatedRoute) { } + + ngOnInit(): void { + } + + onChildActivate(componentReference) { + // console.log("Activating "+componentReference+" - "+JSON.stringify(componentReference,getCircularReplacer())) + if (componentReference.roleIdEvent!=null) { + let componentEmit : Observable = componentReference.roleIdEvent.pipe( + tap(userid=>console.log("Event "+componentReference.class+" "+userid)), + map((userid: string) => this.getSubPath(userid))); + if (this.roleId$!=null) { + this.roleId$ = merge(this.roleId$, componentEmit) + } else { + this.roleId$ = componentEmit; + } + } + } + + getSubPath(userid:string) { + if (userid!=null && userid.length>0) { + return '/' + userid; + } else { + return ''; + } + } + +} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.html index 8ace87c6f..ec4f0f99a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.html @@ -8,7 +8,6 @@ ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ ~ Unless required by applicable law or agreed to in writing, ~ software distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.scss b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.scss index 573c9ef45..343c3b1c0 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.scss +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.scss @@ -8,7 +8,6 @@ * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 - * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.spec.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.spec.ts index d6ce62fce..7fc64d5f8 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.spec.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.spec.ts @@ -8,7 +8,6 @@ * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 - * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.ts index b97a1bcd2..303e84021 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-configuration.component.ts @@ -8,7 +8,6 @@ * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 - * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/user-routing.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/user-routing.module.ts index abb3a5e5a..c1cae57de 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/user-routing.module.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/user-routing.module.ts @@ -7,8 +7,7 @@ * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/user.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/user.module.ts index 8cef8606a..44fd8f13a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/user.module.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/user.module.ts @@ -26,8 +26,7 @@ import {SharedModule} from "../shared/shared.module"; import {FormsModule, ReactiveFormsModule} from "@angular/forms"; import {ManageUsersDeleteComponent} from './users/manage-users-delete/manage-users-delete.component'; import {UserRoutingModule} from "./user-routing.module"; -import { ManageUsersRolesComponent } from './users/manage-users-roles/manage-users-roles.component'; -import {RoutingGuardService} from "../../services/routing-guard.service"; +import {ManageUsersRolesComponent} from './users/manage-users-roles/manage-users-roles.component'; @NgModule({ @@ -48,9 +47,9 @@ import {RoutingGuardService} from "../../services/routing-guard.service"; imports: [ CommonModule, SharedModule, + UserRoutingModule, FormsModule, - ReactiveFormsModule, - UserRoutingModule + ReactiveFormsModule ] }) export class UserModule { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/users/manage-users-list/manage-users-list.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/users/manage-users-list/manage-users-list.component.html index 1c449baa0..07314877c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/users/manage-users-list/manage-users-list.component.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/users/manage-users-list/manage-users-list.component.html @@ -16,7 +16,7 @@ ~ under the License. --> - diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/role.service.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/role.service.ts index f92a4a76a..79bee947f 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/role.service.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/role.service.ts @@ -22,6 +22,8 @@ import {RoleTemplate} from "@app/model/role-template"; import { Observable } from 'rxjs'; import { Role } from '@app/model/role'; import {HttpResponse} from "@angular/common/http"; +import {PagedResult} from "@app/model/paged-result"; +import {UserInfo} from "@app/model/user-info"; @Injectable({ providedIn: 'root' @@ -42,4 +44,21 @@ export class RoleService { return this.rest.executeResponseCall("delete", "redback", "roles/" + roleId + "/user/" + userId, null); } + public query(searchTerm: string, offset: number = 0, limit: number = 10, orderBy: string[] = ['id'], order: string = 'asc'): Observable> { + console.log("getRoleList " + searchTerm + "," + offset + "," + limit + "," + orderBy + "," + order); + if (searchTerm == null) { + searchTerm = "" + } + if (orderBy == null || orderBy.length == 0) { + orderBy = ['id']; + } + return this.rest.executeRestCall>("get", "redback", "roles", { + 'q': searchTerm, + 'offset': offset, + 'limit': limit, + 'orderBy': orderBy, + 'order': order + }); + } + } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/assets/i18n/en.json b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/assets/i18n/en.json index f12c6f20b..6c39c16b9 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/assets/i18n/en.json +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/assets/i18n/en.json @@ -127,6 +127,21 @@ } } }, + "roles": { + "list": { + "head": "Roles List" + }, + "edit": { + "head": "Edit/View Role" + }, + "attributes": { + "id": "Identifier", + "name": "Name", + "description": "Description", + "template_instance": "Template Instance" + } + }, + "search": { "button": "Search", "label": "Enter your search term", -- 2.39.5