Add code about uaa_auth #3803

This commit is contained in:
Fuhui Peng (c) 2017-12-18 18:50:54 +08:00
parent 7946b07fce
commit fb794dac26
8 changed files with 19 additions and 7 deletions

View File

@ -138,7 +138,7 @@ export class SignInComponent implements AfterViewChecked, OnInit {
}
public get showForgetPwd(): boolean {
return this.appConfig.auth_mode != 'ldap_auth';
return this.appConfig.auth_mode !== 'ldap_auth' && this.appConfig.auth_mode !== 'uaa_auth';
}
clickRememberMe($event: any): void {

View File

@ -108,7 +108,7 @@ export class NavigatorComponent implements OnInit {
let user = this.session.getCurrentUser();
let config = this.appConfigService.getConfig();
return user && ((config && config.auth_mode != 'ldap_auth') || (user.user_id === 1 && user.username === 'admin'));
return user && ((config && !(config.auth_mode === 'ldap_auth' || config.auth_mode === 'uaa_auth')) || (user.user_id === 1 && user.username === 'admin'));
}
matchLang(lang: string): boolean {

View File

@ -6,6 +6,7 @@
<select id="authMode" name="authMode" (change)="handleOnChange($event)" [disabled]="disabled(currentConfig.auth_mode)" [(ngModel)]="currentConfig.auth_mode.value">
<option value="db_auth">{{'CONFIG.AUTH_MODE_DB' | translate }}</option>
<option value="ldap_auth">{{'CONFIG.AUTH_MODE_LDAP' | translate }}</option>
<option value="uaa_auth">{{'CONFIG.AUTH_MODE_UAA' | translate }}</option>
</select>
</div>
<a href="javascript:void(0)" role="tooltip" aria-haspopup="true" class="tooltip tooltip-top-right" style="top: -1px;">

View File

@ -11,7 +11,7 @@
// 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, Input, ViewChild } from '@angular/core';
import { Component, Input, ViewChild, OnChanges } from '@angular/core';
import { NgForm } from '@angular/forms';
import { Subscription } from 'rxjs/Subscription';
@ -22,12 +22,20 @@ import { Configuration } from 'harbor-ui';
templateUrl: "config-auth.component.html",
styleUrls: ['../config.component.css']
})
export class ConfigurationAuthComponent {
export class ConfigurationAuthComponent implements OnChanges {
changeSub: Subscription;
@Input("ldapConfig") currentConfig: Configuration = new Configuration();
@ViewChild("authConfigFrom") authForm: NgForm;
ngOnChanges(): void {
if ( this.currentConfig &&
this.currentConfig.auth_mode &&
this.currentConfig.auth_mode.value === 'uaa_auth') {
this.currentConfig.auth_mode.editable = false;
}
}
get checkboxenable(){
return this.currentConfig &&
this.currentConfig.self_registration &&
@ -46,7 +54,7 @@ export class ConfigurationAuthComponent {
if (!this.currentConfig || !this.currentConfig.auth_mode) {
return true;
} else {
return this.currentConfig.auth_mode.value != 'ldap_auth';
return this.currentConfig.auth_mode.value !== 'ldap_auth' && this.currentConfig.auth_mode.value !== 'uaa_auth';
}
}
@ -65,7 +73,7 @@ export class ConfigurationAuthComponent {
handleOnChange($event: any): void {
if ($event && $event.target && $event.target["value"]) {
let authMode = $event.target["value"];
if (authMode === 'ldap_auth') {
if (authMode === 'ldap_auth' || authMode === 'uaa_auth') {
if (this.currentConfig.self_registration.value) {
this.currentConfig.self_registration.value = false;//uncheck
}

View File

@ -97,7 +97,7 @@ export class UserComponent implements OnInit, OnDestroy {
public get canCreateUser(): boolean {
let appConfig = this.appConfigService.getConfig();
if (appConfig) {
return appConfig.auth_mode != 'ldap_auth';
return !(appConfig.auth_mode === 'ldap_auth' || appConfig.auth_mode === 'uaa_auth');
} else {
return true;
}

View File

@ -410,6 +410,7 @@
"SELF_REGISTRATION": "Allow Self-Registration",
"AUTH_MODE_DB": "Database",
"AUTH_MODE_LDAP": "LDAP",
"AUTH_MODE_UAA": "UAA",
"SCOPE_BASE": "Base",
"SCOPE_ONE_LEVEL": "OneLevel",
"SCOPE_SUBTREE": "Subtree",

View File

@ -411,6 +411,7 @@
"SELF_REGISTRATION": "Permitir auto-registro",
"AUTH_MODE_DB": "Base de datos",
"AUTH_MODE_LDAP": "LDAP",
"AUTH_MODE_UAA": "UAA",
"SCOPE_BASE": "Base",
"SCOPE_ONE_LEVEL": "UnNivel",
"SCOPE_SUBTREE": "Subárbol",

View File

@ -410,6 +410,7 @@
"SELF_REGISTRATION": "允许自注册",
"AUTH_MODE_DB": "数据库",
"AUTH_MODE_LDAP": "LDAP",
"AUTH_MODE_UAA": "UAA",
"SCOPE_BASE": "本层",
"SCOPE_ONE_LEVEL": "下一层",
"SCOPE_SUBTREE": "子树",