From: Martin Stockhammer Date: Mon, 11 Jan 2021 18:16:47 +0000 (+0100) Subject: Adding tooltips and properties X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=255fc64b520e1d2c3a925e53c515301676ae03ed;p=archiva.git Adding tooltips and properties --- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/model/property-entry.spec.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/model/property-entry.spec.ts new file mode 100644 index 000000000..1c7555c0a --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/model/property-entry.spec.ts @@ -0,0 +1,25 @@ +/* + * 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 { PropertyEntry } from './property-entry'; + +describe('PropertyEntry', () => { + it('should create an instance', () => { + expect(new PropertyEntry()).toBeTruthy(); + }); +}); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/model/property-entry.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/model/property-entry.ts new file mode 100644 index 000000000..3390dcf1a --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/model/property-entry.ts @@ -0,0 +1,22 @@ +/* + * 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. + */ + +export class PropertyEntry { + key: string; + value: string; +} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration-routing.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration-routing.module.ts index 4b40ce41e..edb681d61 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration-routing.module.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration-routing.module.ts @@ -21,6 +21,7 @@ import {RoutingGuardService as Guard} from "@app/services/routing-guard.service" import {SecurityConfigurationComponent} from "./security-configuration/security-configuration.component"; import {BaseSecurityComponent} from "./security-configuration/base-security/base-security.component"; import {LdapSecurityComponent} from "./security-configuration/ldap-security/ldap-security.component"; +import {SecurityPropertiesComponent} from "@app/modules/security/security-configuration/security-properties/security-properties.component"; /** @@ -29,20 +30,23 @@ import {LdapSecurityComponent} from "./security-configuration/ldap-security/ldap */ const routes: Routes = [ - { path: '', component: SecurityConfigurationComponent,canActivate:[Guard], - data: { perm: 'menu.security.config' }, + { + path: '', component: SecurityConfigurationComponent, canActivate: [Guard], + data: {perm: 'menu.security.config'}, children: [ - {path: 'base', component: BaseSecurityComponent}, + {path: 'base', component: BaseSecurityComponent}, + {path: 'properties', component: SecurityPropertiesComponent}, {path: 'ldap', component: LdapSecurityComponent}, - {path: '', redirectTo:'base',pathMatch:'full'} + {path: '', redirectTo: 'base', pathMatch: 'full'} ] - } + } ]; @NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [], - declarations: [] + imports: [RouterModule.forChild(routes)], + exports: [], + declarations: [] }) -export class SecurityConfigurationRoutingModule { } +export class SecurityConfigurationRoutingModule { +} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration.module.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration.module.ts index e5ee11504..a36d79693 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration.module.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration.module.ts @@ -24,13 +24,15 @@ import {SecurityConfigurationComponent} from "./security-configuration/security- import {SecurityConfigurationRoutingModule} from "@app/modules/security/security-configuration-routing.module"; import { BaseSecurityComponent } from './security-configuration/base-security/base-security.component'; import { LdapSecurityComponent } from './security-configuration/ldap-security/ldap-security.component'; +import { SecurityPropertiesComponent } from './security-configuration/security-properties/security-properties.component'; @NgModule({ declarations: [ SecurityConfigurationComponent, BaseSecurityComponent, - LdapSecurityComponent + LdapSecurityComponent, + SecurityPropertiesComponent ], exports: [ SecurityConfigurationComponent diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/ldap-security/ldap-security.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/ldap-security/ldap-security.component.html index f7940741f..aa2d70615 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/ldap-security/ldap-security.component.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/ldap-security/ldap-security.component.html @@ -21,7 +21,10 @@
+ for="{{attName}}" + [openDelay]="500" + [ngbTooltip]="'security.config.ldap.attdesc.'+attName|translate" placement="top" + >{{'security.config.ldap.attributes.' + attName |translate}}
+ for="context_factory" + [openDelay]="500" [ngbTooltip]="'security.config.ldap.attdesc.context_factory'|translate" placement="top" + >{{'security.config.ldap.attributes.context_factory' |translate}}
+ for="authentication_method" + [openDelay]="500" [ngbTooltip]="'security.config.ldap.attdesc.authentication_method'|translate" placement="top" + >{{'security.config.ldap.attributes.authentication_method' |translate}}
-
-
{{'security.config.ldap.attributes.properties'|translate}}
+
{{'security.config.ldap.attributes.properties'|translate}}
{{'security.config.base.head' | translate}} + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.html b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.html new file mode 100644 index 000000000..59bcdefaf --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.html @@ -0,0 +1,39 @@ + + + +
+
+ Loading... +
+
+
+
+ + + + + + + + + + + + + + + + +
{{'headers.action' |translate}}
{{propertyEntry.key}}{{propertyEntry.value}} + + +
+
+ +
+ + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.scss b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.spec.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.spec.ts new file mode 100644 index 000000000..d1228303e --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SecurityPropertiesComponent } from './security-properties.component'; + +describe('SecurityPropertiesComponent', () => { + let component: SecurityPropertiesComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ SecurityPropertiesComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(SecurityPropertiesComponent); + 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/security-configuration/security-properties/security-properties.component.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.ts new file mode 100644 index 000000000..961866a18 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/security/security-configuration/security-properties/security-properties.component.ts @@ -0,0 +1,27 @@ +import {Component, OnInit} from '@angular/core'; +import {SortedTableComponent} from "@app/modules/shared/sorted-table-component"; +import {PropertyEntry} from '@app/model/property-entry'; +import {TranslateService} from "@ngx-translate/core"; +import {Observable} from "rxjs"; +import {PagedResult} from "@app/model/paged-result"; +import {SecurityService} from "@app/services/security.service"; + +@Component({ + selector: 'app-security-properties', + templateUrl: './security-properties.component.html', + styleUrls: ['./security-properties.component.scss'] +}) +export class SecurityPropertiesComponent extends SortedTableComponent implements OnInit { + + constructor(translator: TranslateService, securityService: SecurityService) { + super(translator, function (searchTerm: string, offset: number, limit: number, orderBy: string[], order: string): Observable> { + // console.log("Retrieving data " + searchTerm + "," + offset + "," + limit + "," + orderBy + "," + order); + return securityService.queryProperties(searchTerm, offset, limit, orderBy, order); + }); + super.sortField=['key'] + } + + ngOnInit(): void { + } + +} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/security.service.ts b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/security.service.ts index 244257ab1..8902341b1 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/security.service.ts +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/services/security.service.ts @@ -24,6 +24,9 @@ import {catchError, map} from "rxjs/operators"; import {HttpErrorResponse, HttpResponse} from "@angular/common/http"; import {BeanInformation} from "@app/model/bean-information"; import {LdapConfiguration} from "@app/model/ldap-configuration"; +import {PagedResult} from "@app/model/paged-result"; +import {Role} from "@app/model/role"; +import {PropertyEntry} from "@app/model/property-entry"; @Injectable({ providedIn: 'root' @@ -94,5 +97,23 @@ export class SecurityService { ); } + queryProperties(searchTerm: string, offset: number = 0, limit: number = 10, orderBy: string[] = ['key'], order: string = 'asc'): Observable> { + if (searchTerm == null) { + searchTerm = "" + } + if (orderBy == null || orderBy.length == 0) { + orderBy = ['key']; + } + return this.rest.executeRestCall>("get", "archiva", "security/config/properties", { + 'q': searchTerm, + 'offset': offset, + 'limit': limit, + 'orderBy': orderBy, + 'order': order + }).pipe( + catchError((error: HttpErrorResponse) => { + return throwError(this.rest.getTranslatedErrorResult(error)); + })); + } } 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 dff49c78e..18074b7d4 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 @@ -226,9 +226,30 @@ "ssl_enabled": "Enable SSL", "context_factory": "Context Factory", "properties": "Properties" - + }, + "attdesc": { + "host_name": "Fully qualified LDAP Server Name", + "port": "Port, on which the LDAP server is listening (389, 636, ...)", + "base_dn": "The Base DN used during bind and ldap queries", + "groups_base_dn": "The full DN used as base for searching groups", + "bind_dn": "The name or DN of the bind user, which is used to query the LDAP server", + "bind_password": "The password to use for binding to the LDAP server", + "authentication_method": "The method used to bind to the LDAP server. If strong is used, you may have to set additional properties.", + "bind_authenticator_enabled": "If true, LDAP query and bind is used for Archiva Login.", + "use_role_name_as_group": "If true, each role as a LDAP group with the same name", + "writable": "If true, attributes in the LDAP server can be modified", + "ssl_enabled": "If true, SSL/TLS is used for connecting to the LDAP server. You may have to add certificates to the keystore.", + "context_factory": "The LDAP JNDI Context Factory to use", + "properties": "Add additional environment properties for creating the initial directory context" }, "flags": "Flags" + }, + "properties": { + "head": "Properties", + "attributes": { + "key": "Key", + "value": "Value" + } } } },