Skip to content

Commit

Permalink
Merge branch 'main' into proxy-pulltime
Browse files Browse the repository at this point in the history
  • Loading branch information
wy65701436 authored May 26, 2023
2 parents 27ad322 + 135ca37 commit b8feee1
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 74 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ PKGVERSIONTAG=dev
PREPARE_VERSION_NAME=versions

#versions
REGISTRYVERSION=v2.8.0-patch-redis
REGISTRYVERSION=v2.8.2-patch-redis
TRIVYVERSION=v0.39.0
TRIVYADAPTERVERSION=v0.30.10

# version of registry for pulling the source code
REGISTRY_SRC_TAG=v2.8.0
REGISTRY_SRC_TAG=v2.8.2

# dependency binaries
REGISTRYURL=https://storage.googleapis.com/harbor-builds/bin/registry/release-${REGISTRYVERSION}/registry
Expand Down
2 changes: 1 addition & 1 deletion make/photon/prepare/templates/nginx/nginx.https.conf.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ http {
ssl_certificate_key {{ssl_cert_key}};

# Recommendations from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
ssl_protocols TLSv1.2;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers '!aNULL:kECDH+AESGCM:ECDH+AESGCM:RSA+AESGCM:kECDH+AES:ECDH+AES:RSA+AES:';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
Expand Down
2 changes: 1 addition & 1 deletion make/photon/prepare/templates/portal/nginx.conf.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ http {
ssl_certificate_key /etc/harbor/tls/portal.key;

# Recommendations from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
ssl_protocols TLSv1.2;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers '!aNULL:kECDH+AESGCM:ECDH+AESGCM:RSA+AESGCM:kECDH+AES:ECDH+AES:RSA+AES:';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
Expand Down
6 changes: 0 additions & 6 deletions make/photon/registry/builder
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ cur=$PWD
TEMP=`mktemp -d ${TMPDIR-/tmp}/distribution.XXXXXX`
git clone -b $VERSION https://github.com/distribution/distribution.git $TEMP

# add patch 2815
echo 'add patch https://github.com/distribution/distribution/pull/2815 ...'
cd $TEMP
wget https://github.com/distribution/distribution/pull/2815.patch
git apply 2815.patch

# add patch redis
cd $TEMP
git apply $cur/redis.patch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ <h3 class="modal-title">{{ 'PROFILE.TITLE' | translate }}</h3>
type="button"
id="submit-btn"
class="btn btn-primary"
[disabled]="!isValid || showProgress || !isUserDataChange()"
[disabled]="
!isValid || showProgress || !isUserDataChange() || checkProgress
"
(click)="submit()">
{{ 'BUTTON.OK' | translate }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { InlineAlertComponent } from '../../shared/components/inline-alert/inlin
import { ConfirmationDialogService } from '../global-confirmation-dialog/confirmation-dialog.service';
import { ConfirmationMessage } from '../global-confirmation-dialog/confirmation-message';
import { UserService } from '../../../../ng-swagger-gen/services/user.service';
import { AppConfigService } from '../../services/app-config.service';

describe('AccountSettingsModalComponent', () => {
let component: AccountSettingsModalComponent;
Expand Down Expand Up @@ -74,6 +75,12 @@ describe('AccountSettingsModalComponent', () => {
},
};

const MockedAppConfigService = {
getConfig() {
return { self_registration: true };
},
};

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
Expand Down Expand Up @@ -110,6 +117,7 @@ describe('AccountSettingsModalComponent', () => {
provide: ConfirmationDialogService,
useValue: fakeConfirmationDialogService,
},
{ provide: AppConfigService, useValue: MockedAppConfigService },
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
}).compileComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { ConfirmationDialogComponent } from '../../shared/components/confirmatio
import { InlineAlertComponent } from '../../shared/components/inline-alert/inline-alert.component';
import { ConfirmationMessage } from '../global-confirmation-dialog/confirmation-message';
import { UserService } from 'ng-swagger-gen/services/user.service';
import { AppConfigService } from '../../services/app-config.service';

@Component({
selector: 'account-settings-modal',
Expand Down Expand Up @@ -72,7 +73,8 @@ export class AccountSettingsModalComponent implements OnInit, AfterViewChecked {
private msgHandler: MessageHandlerService,
private router: Router,
private searchTrigger: SearchTriggerService,
private userService: UserService
private userService: UserService,
private appConfigService: AppConfigService
) {}

private validationStateMap: any = {
Expand Down Expand Up @@ -136,29 +138,34 @@ export class AccountSettingsModalComponent implements OnInit, AfterViewChecked {
return;
}

// Mail changed
this.checkOnGoing = true;
this.session
.checkUserExisting('email', this.account.email)
.subscribe(
(res: boolean) => {
this.checkOnGoing = false;
this.validationStateMap[key] = !res;
if (res) {
this.emailTooltip =
'TOOLTIP.EMAIL_EXISTING';
// Mail changed, if self-registration disabled, only system admin can check mail-existing status
if (
this.session.getCurrentUser()?.has_admin_role ||
this.appConfigService.getConfig()?.self_registration
) {
this.checkOnGoing = true;
this.session
.checkUserExisting('email', this.account.email)
.subscribe(
(res: boolean) => {
this.checkOnGoing = false;
this.validationStateMap[key] = !res;
if (res) {
this.emailTooltip =
'TOOLTIP.EMAIL_EXISTING';
}
this.mailAlreadyChecked[
this.account.email
] = {
result: res,
}; // Tag it checked
},
error => {
this.checkOnGoing = false;
this.validationStateMap[key] = false; // Not valid @ backend
}
this.mailAlreadyChecked[
this.account.email
] = {
result: res,
}; // Tag it checked
},
error => {
this.checkOnGoing = false;
this.validationStateMap[key] = false; // Not valid @ backend
}
);
);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<clr-alerts>
<clr-alert
*ngIf="showReadOnly && isLogin()"
[clrAlertType]="message?.type"
[clrAlertType]="'warning'"
[clrAlertAppLevel]="true"
[clrAlertClosable]="false">
<clr-alert-item>
<span class="alert-text">{{ message?.message | translate }}</span>
<span class="alert-text">{{ 'REPO_READ_ONLY' | translate }}</span>
</clr-alert-item>
</clr-alert>
<clr-alert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { delay } from 'rxjs/operators';
import { Scanner } from '../../left-side-nav/interrogation-services/scanner/scanner';
import { ScannerService } from 'ng-swagger-gen/services/scanner.service';
import { SessionService } from 'src/app/shared/services/session.service';
import { AppConfigService } from '../../../services/app-config.service';

describe('AppLevelAlertsComponent', () => {
let component: AppLevelAlertsComponent;
Expand Down Expand Up @@ -44,6 +45,11 @@ describe('AppLevelAlertsComponent', () => {
return { has_admin_role: true };
},
};
const MockedAppConfigService = {
getConfig() {
return { read_only: false };
},
};

beforeEach(async () => {
await TestBed.configureTestingModule({
Expand All @@ -55,6 +61,7 @@ describe('AppLevelAlertsComponent', () => {
useValue: fakeScannerService,
},
{ provide: SessionService, useValue: fakeSessionService },
{ provide: AppConfigService, useValue: MockedAppConfigService },
],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { MessageService } from '../../../shared/components/global-message/message.service';
import { Message } from '../../../shared/components/global-message/message';
import { JobServiceDashboardHealthCheckService } from '../../left-side-nav/job-service-dashboard/job-service-dashboard-health-check.service';
import { AppLevelMessage } from '../../../shared/services/message-handler.service';
import { AppConfigService } from '../../../services/app-config.service';
const HAS_SHOWED_SCANNER_INFO: string = 'hasShowScannerInfo';
const YES: string = 'yes';
@Component({
Expand All @@ -29,14 +29,14 @@ export class AppLevelAlertsComponent implements OnInit, OnDestroy {
appLevelMsgSub: Subscription;
clearSub: Subscription;
showLogin: boolean = false;
showReadOnly: boolean = false;
constructor(
private session: SessionService,
private scannerService: ScannerService,
private router: Router,
private messageService: MessageService,
private route: ActivatedRoute,
private jobServiceDashboardHealthCheckService: JobServiceDashboardHealthCheckService
private jobServiceDashboardHealthCheckService: JobServiceDashboardHealthCheckService,
private appConfigService: AppConfigService
) {}
ngOnInit() {
if (
Expand All @@ -53,10 +53,6 @@ export class AppLevelAlertsComponent implements OnInit, OnDestroy {
this.appLevelMsgSub =
this.messageService.appLevelAnnounced$.subscribe(message => {
this.message = message;
this.showReadOnly =
message.statusCode === httpStatusCode.AppLevelWarning &&
message.message === AppLevelMessage.REPO_READ_ONLY;

if (message.statusCode === httpStatusCode.Unauthorized) {
this.showLogin = true;
// User session timed out, then redirect to sign-in page
Expand Down Expand Up @@ -86,7 +82,6 @@ export class AppLevelAlertsComponent implements OnInit, OnDestroy {
if (!this.clearSub) {
this.clearSub = this.messageService.clearChan$.subscribe(clear => {
this.showLogin = false;
this.showReadOnly = false;
});
}
}
Expand All @@ -96,7 +91,9 @@ export class AppLevelAlertsComponent implements OnInit, OnDestroy {
this.appLevelMsgSub = null;
}
}

get showReadOnly(): boolean {
return this.appConfigService.getConfig()?.read_only;
}
shouldShowScannerInfo(): boolean {
return (
this.session.getCurrentUser()?.has_admin_role &&
Expand Down Expand Up @@ -186,6 +183,6 @@ export class AppLevelAlertsComponent implements OnInit, OnDestroy {
}

isLogin(): boolean {
return this.session.getCurrentUser()?.has_admin_role;
return !!this.session.getCurrentUser();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ export class SystemSettingsComponent implements OnInit {
// Unfortunately API does not do that
// So we need to call update function again
this.conf.updateConfig();
// Handle read only
if (changes['read_only']) {
this.errorHandler.handleReadOnly();
} else {
this.errorHandler.clear();
}
// Reload bootstrap option
this.appConfigService.load().subscribe(
() => {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ export class NavigatorComponent implements OnInit {
this.translateClarityComponents();
}
this.selectedDatetimeRendering = getDatetimeRendering();
if (this.appConfigService.getConfig().read_only) {
this.msgHandler.handleReadOnly();
}
}
//Internationalization for Clarity components, refer to https://clarity.design/documentation/internationalization
translateClarityComponents() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ export class AuthCheckGuard {
): Observable<boolean> | boolean {
// When routing change, clear
this.msgHandler.clear();
if (
this.appConfigService.getConfig().read_only &&
this.appConfigService.getConfig().read_only.toString() === 'true'
) {
this.msgHandler.handleReadOnly();
}

this.searchTrigger.closeSearch(true);
return new Observable(observer => {
// if the url has the queryParam `publicAndNotLogged=yes`, then skip auth check
Expand Down
12 changes: 0 additions & 12 deletions src/portal/src/app/shared/services/message-handler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@ export class MessageHandlerService implements ErrorHandler {
}
}

public handleReadOnly(): void {
this.msgService.announceAppLevelMessage(
httpStatusCode.AppLevelWarning,
AppLevelMessage.REPO_READ_ONLY,
AlertType.WARNING
);
}

public showError(message: string, params: any): void {
if (!params) {
params = {};
Expand Down Expand Up @@ -131,7 +123,3 @@ export class MessageHandlerService implements ErrorHandler {
this.showInfo(log);
}
}

export enum AppLevelMessage {
REPO_READ_ONLY = 'REPO_READ_ONLY',
}

0 comments on commit b8feee1

Please sign in to comment.