Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
HejdaJakub committed Sep 4, 2023
2 parents 1b5fa99 + 1df1e65 commit 6a6a7ee
Show file tree
Hide file tree
Showing 74 changed files with 2,539 additions and 655 deletions.
12 changes: 4 additions & 8 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "New features and notable changes",
"hidden": false
},
{ "type": "fix", "hidden": true },
{ "type": "perf", "hidden": true },
{ "type": "revert", "hidden": true },
{ "type": "feat", "hidden": false },
{ "type": "fix", "hidden": false },
{ "type": "perf", "hidden": false },
{ "type": "revert", "hidden": false },
{ "type": "docs", "hidden": true },
{ "type": "style", "hidden": true },
{ "type": "chore", "hidden": true },
Expand Down
57 changes: 57 additions & 0 deletions apps/admin-gui-e2e/src/e2e/admin/perun-admin.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ describe('Perun admin management with role Perun admin', () => {
const dbExtSourceName = 'test_ext_source_db';
const dbConsentHubName = 'test-e2e-facility-from-db-3';
const dbOwnerName = 'DbOwnerTest';
const loginToBlock = "testLoginToBlock"
const dbBlockedLogin = "test_blocking_login"
const dbBlockedLoginListOnly = "test_blocking_login_list"

const dbSearcherAttrDisplayName = 'login-namespace:einfra';
const dbSearcherAttrValue = 'e2etestlogin';
Expand Down Expand Up @@ -199,6 +202,60 @@ describe('Perun admin management with role Perun admin', () => {
});
});

context('Blocked logins management', () => {
beforeEach(() => {
cy.get('[data-cy=blocked-logins]')
.click();
});

it("test get blocked login", () => {
cy.get('[data-cy=filter-input]')
.type(dbBlockedLoginListOnly, {force: true})
.get(`[data-cy=${dbBlockedLoginListOnly}-checkbox]`)
.should('exist');
})

it('test block login', () => {
cy.intercept('**/usersManager/blockLogins**')
.as('blockLogin')
.intercept('**/usersManager/getBlockedLoginsPage**')
.as('getBlockedLogins')
.get('[data-cy=block-logins-button]')
.click({force: true})
.get('[data-cy=logins-input]')
.type(loginToBlock, {force: true})
.get('[data-cy=submit-blocked-logins-button]')
.click()
.wait('@blockLogin')
.wait('@getBlockedLogins')
// assert that the login is listed as blocked
.get('[data-cy=filter-input]')
.type(loginToBlock, {force: true})
.get(`[data-cy=${loginToBlock}-checkbox]`)
.should('exist');
});

it('test unblock login', () => {
cy.intercept('**/usersManager/unblockLoginsById**')
.as('unblockLogins')
.intercept('**/usersManager/getBlockedLoginsPage**')
.as('getBlockedLogins')
.get('[data-cy=filter-input]')
.type(dbBlockedLogin, {force: true})
.get(`[data-cy=${dbBlockedLogin}-checkbox]`)
.click()
.get('[data-cy=unblock-logins-button]')
.click({force: true})
.get('[data-cy=unblock-button-dialog]')
.click()
.wait('@unblockLogins')
.wait('@getBlockedLogins')
// assert that the login is no longer listed as blocked
.get(`[data-cy=${dbBlockedLogin}-checkbox]`)
.should('not.exist');
});
});

it('test list ext sources', () => {
cy.get('[data-cy=external-sources]')
.click()
Expand Down
10 changes: 10 additions & 0 deletions apps/admin-gui-e2e/src/e2e/admin/perun-observer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('Perun admin management with role Perun observer', () => {
const dbSearcherAttrValue = 'e2etestlogin';
const dbSearcherUserFirstName = 'Test6';
const dbOwnerName = 'DbOwnerTest';
const dbBlockedLoginListOnly = "test_blocking_login_list"

before(() => {
cy.login('PERUN_OBSERVER', 'perunObserver');
Expand Down Expand Up @@ -114,4 +115,13 @@ describe('Perun admin management with role Perun observer', () => {
.get(`[data-cy=${dbSearcherUserFirstName.toLowerCase()}-firstName-td]`)
.should('exist');
});

it("test get blocked login", () => {
cy.get('[data-cy=blocked-logins]')
.click()
.get('[data-cy=filter-input]')
.type(dbBlockedLoginListOnly, {force: true})
.get(`[data-cy=${dbBlockedLoginListOnly}-checkbox]`)
.should('exist');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ <h1 class="page-subtitle">{{'ADMIN.BLOCKED_LOGINS.TITLE' | translate}}</h1>
(click)="block()"
color="accent"
class="me-2 action-button"
data-cy="block-logins-button"
mat-flat-button
*ngIf="isAdmin">
{{'ADMIN.BLOCKED_LOGINS.BLOCK' | translate}}
Expand All @@ -16,6 +17,7 @@ <h1 class="page-subtitle">{{'ADMIN.BLOCKED_LOGINS.TITLE' | translate}}</h1>
(click)="unblock()"
class="me-2"
color="warn"
data-cy="unblock-logins-button"
mat-flat-button
[disabled]="selection.selected.length === 0">
{{'ADMIN.BLOCKED_LOGINS.UNBLOCK' | translate}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ <h1 mat-dialog-title>{{'DIALOGS.BLOCK_LOGINS.TITLE' | translate}}</h1>
<textarea
cols="50"
class="md-textarea form-control"
data-cy="logins-input"
[formControl]="blockLogins"
required
matInput
Expand All @@ -53,6 +54,7 @@ <h1 mat-dialog-title>{{'DIALOGS.BLOCK_LOGINS.TITLE' | translate}}</h1>
(click)="onSubmit()"
class="ms-2"
color="accent"
data-cy="submit-blocked-logins-button"
[disabled]="loading || blockLogins.invalid || (!isGlobal && selectedNamespace === null)"
mat-flat-button>
{{'DIALOGS.BLOCK_LOGINS.BLOCK' | translate}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ <h1 class="page-subtitle">{{'DIALOGS.CREATE_ATTRIBUTE.SET_NEW' | translate}}</h1
[emptyListText]="'SHARED_LIB.PERUN.COMPONENTS.ATTRIBUTES_LIST.EMPTY_ATTRIBUTES'"
[attributes]="attributes"
[filterValue]="filterValue"
[inDialog]="true"
[selection]="selected"
[tableId]="tableId">
</perun-web-apps-attributes-list>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ <h1 mat-dialog-title>{{"DIALOGS.CREATE_RELATION.TITLE" | translate}}</h1>
[vo]="thisVo.vo"
[vos]="vosToSelect"
(voSelected)="getGroupsToInclude($event.id)"></perun-web-apps-vo-search-select>
<perun-web-apps-debounce-filter
(filter)="applyFilter($event)"
[placeholder]="'GROUP_DETAIL.SETTINGS.RELATIONS.FILTER'"></perun-web-apps-debounce-filter>
<div class="dialog-container" mat-dialog-content>
<perun-web-apps-debounce-filter
(filter)="applyFilter($event)"
[placeholder]="'GROUP_DETAIL.SETTINGS.RELATIONS.FILTER'"></perun-web-apps-debounce-filter>
<ng-template #spinner>
<perun-web-apps-loading-table></perun-web-apps-loading-table>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
<h1 mat-dialog-title>{{'DIALOGS.DELETE_APPLICATION_FORM_ITEM.TITLE' | translate}}</h1>
<div class="dialog-container" mat-dialog-content>
<div class="pb-2 fw-bold">
{{'DIALOGS.DELETE_APPLICATION_FORM_ITEM.INFO_1' | translate}}
<div *ngIf="!deletionDisabled">
<div class="pb-2 fw-bold">
{{'DIALOGS.DELETE_APPLICATION_FORM_ITEM.INFO_1' | translate}}
</div>
<div>{{'DIALOGS.DELETE_APPLICATION_FORM_ITEM.INFO_2' | translate}}</div>
<div class="pb-4 pt-2">{{'DIALOGS.DELETE_APPLICATION_FORM_ITEM.INFO_3' | translate}}</div>
</div>
<div>{{'DIALOGS.DELETE_APPLICATION_FORM_ITEM.INFO_2' | translate}}</div>
<div class="pb-4 pt-2">{{'DIALOGS.DELETE_APPLICATION_FORM_ITEM.INFO_3' | translate}}</div>
<perun-web-apps-alert *ngIf="deletionDisabled" alert_type="error">
{{data.errorMessage}}
</perun-web-apps-alert>
</div>
<div mat-dialog-actions>
<button (click)="onCancel()" class="ms-auto" mat-stroked-button>
{{'DIALOGS.DELETE_APPLICATION_FORM_ITEM.CANCEL_BUTTON' | translate}}
</button>
<button
(click)="submit()"
[disabled]="deletionDisabled"
class="ms-2"
color="warn"
data-cy="delete-application-form-item-dialog"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import { Component } from '@angular/core';
import { MatDialogRef } from '@angular/material/dialog';
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

export interface DeleteApplicationFormItemDialogData {
errorMessage: string;
}

@Component({
selector: 'app-delete-application-form-item-dialog',
templateUrl: './delete-application-form-item-dialog.component.html',
styleUrls: ['./delete-application-form-item-dialog.component.scss'],
})
export class DeleteApplicationFormItemDialogComponent {
constructor(private dialogRef: MatDialogRef<DeleteApplicationFormItemDialogComponent>) {}
deletionDisabled: boolean;

constructor(
private dialogRef: MatDialogRef<DeleteApplicationFormItemDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: DeleteApplicationFormItemDialogData
) {
this.deletionDisabled = this.data.errorMessage?.length !== 0;
}

onCancel(): void {
this.dialogRef.close(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ <h1 mat-dialog-title>
<perun-web-apps-selection-item-search-select
[attributes]="sourceAttributes"
[selectedAttribute]="applicationFormItem.perunSourceAttribute"
(itemSelected)="applicationFormItem.perunSourceAttribute = $event.value"
(itemSelected)="applicationFormItem.perunSourceAttribute = $event.value; loadWarning(itemType.SOURCE)"
[warning]="displayWarningForSourceAttr ? warningMessage : ''"
[asGroup]="!!data.group"
[type]="itemType.SOURCE">
</perun-web-apps-selection-item-search-select>
Expand All @@ -81,7 +82,8 @@ <h1 mat-dialog-title>
<perun-web-apps-selection-item-search-select
[attributes]="destinationAttributes"
[selectedAttribute]="applicationFormItem.perunDestinationAttribute"
(itemSelected)="applicationFormItem.perunDestinationAttribute = $event.value"
(itemSelected)="applicationFormItem.perunDestinationAttribute = $event.value; loadWarning(itemType.DESTINATION)"
[warning]="displayWarningForDestinationAttr ? warningMessage : ''"
[asGroup]="!!data.group"
[type]="itemType.DESTINATION">
</perun-web-apps-selection-item-search-select>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { TranslateService } from '@ngx-translate/core';
import {
ApplicationFormItem,
AppType,
Expand All @@ -13,7 +12,11 @@ import { createNewApplicationFormItem } from '@perun-web-apps/perun/utils';
import DisabledEnum = ApplicationFormItem.DisabledEnum;
import HiddenEnum = ApplicationFormItem.HiddenEnum;
import { ItemType, NO_FORM_ITEM, SelectionItem } from '@perun-web-apps/perun/components';
import { HtmlEscapeService, StoreService } from '@perun-web-apps/perun/services';
import {
HtmlEscapeService,
PerunTranslateService,
StoreService,
} from '@perun-web-apps/perun/services';
import { FormControl, FormGroup } from '@angular/forms';

export interface EditApplicationFormItemDialogComponentData {
Expand Down Expand Up @@ -69,6 +72,9 @@ export class EditApplicationFormItemDialogComponent implements OnInit {

hiddenDependencyItem: ApplicationFormItem = null;
disabledDependencyItem: ApplicationFormItem = null;
warningMessage = '';
displayWarningForSourceAttr = false;
displayWarningForDestinationAttr = false;
languages = ['en'];
private dependencyTypes: Type[] = [
'PASSWORD',
Expand All @@ -86,7 +92,7 @@ export class EditApplicationFormItemDialogComponent implements OnInit {
private dialogRef: MatDialogRef<EditApplicationFormItemDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: EditApplicationFormItemDialogComponentData,
private attributesManager: AttributesManagerService,
private translateService: TranslateService,
private translate: PerunTranslateService,
private store: StoreService,
private cd: ChangeDetectorRef,
private escapeService: HtmlEscapeService
Expand Down Expand Up @@ -145,6 +151,36 @@ export class EditApplicationFormItemDialogComponent implements OnInit {
this.getOptions();
}

loadWarning(itemType: ItemType): void {
this.warningMessage = '';
const hiddenDependencyForItem = this.data.allItems.find(
(item) => item.hiddenDependencyItemId === this.data.applicationFormItem.id
);
const disabledDependencyForItem = this.data.allItems.find(
(item) => item.disabledDependencyItemId === this.data.applicationFormItem.id
);
if (hiddenDependencyForItem || disabledDependencyForItem) {
if (itemType === ItemType.SOURCE) {
this.displayWarningForSourceAttr = true;
} else {
this.displayWarningForDestinationAttr = true;
}
this.warningMessage = this.translate.instant(
'DIALOGS.APPLICATION_FORM_EDIT_ITEM.DEPENDENCY_WARNING_MESSAGE',
hiddenDependencyForItem
? {
dependency: 'hidden',
shortname: hiddenDependencyForItem.shortname,
}
: {
dependency: 'disabled',
shortname: disabledDependencyForItem.shortname,
}
);
this.cd.detectChanges();
}
}

cancel(): void {
this.dialogRef.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ <h1 mat-dialog-title>{{'DIALOGS.UNBLOCK_LOGINS.TITLE' | translate}}</h1>
<button (click)="onCancel()" class="ms-auto" mat-stroked-button>
{{'DIALOGS.UNBLOCK_LOGINS.CANCEL' | translate}}
</button>
<button (click)="onSubmit()" class="ms-2" color="warn" mat-flat-button>
<button
(click)="onSubmit()"
class="ms-2"
color="warn"
mat-flat-button
data-cy="unblock-button-dialog">
{{'DIALOGS.UNBLOCK_LOGINS.UNBLOCK' | translate}}
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,44 @@
color="accent"
data-cy="add-attributes"
mat-flat-button>
{{'USER_DETAIL.SETTINGS.ATTRIBUTES.CREATE' | translate}}
{{'ATTRIBUTE_PAGE.CREATE' | translate}}
</button>

<button
(click)="onSave()"
class="me-2"
color="accent"
[disabled]="selection.selected.length === 0"
mat-flat-button>
{{'USER_DETAIL.SETTINGS.ATTRIBUTES.SAVE' | translate}}
{{'ATTRIBUTE_PAGE.SAVE' | translate}}
</button>

<button
(click)="onDelete()"
[disabled]="selection.selected.length === 0"
class="me-2"
color="warn"
data-cy="remove-attributes"
mat-flat-button>
{{'USER_DETAIL.SETTINGS.ATTRIBUTES.DELETE' | translate}}
{{'ATTRIBUTE_PAGE.DELETE' | translate}}
</button>
<perun-web-apps-debounce-filter
(filter)="applyFilter($event)"
[placeholder]="'SHARED_LIB.PERUN.COMPONENTS.ATTRIBUTES_LIST.FILTER'"></perun-web-apps-debounce-filter>
[placeholder]="'ATTRIBUTE_PAGE.FILTER'"
class="me-2">
</perun-web-apps-debounce-filter>
<mat-slide-toggle [(ngModel)]="filterEmpty" labelPosition="before">
{{'ATTRIBUTE_PAGE.FILTER_EMPTY' | translate}}
</mat-slide-toggle>

<ng-template #spinner>
<perun-web-apps-loading-table></perun-web-apps-loading-table>
</ng-template>
<div class="position-relative">
<perun-web-apps-attributes-list
#list
*perunWebAppsLoader="loading; indicator: spinner"
[attributes]="attributes"
#list
[filterValue]="filterValue"
[filterEmpty]="filterEmpty"
[selection]="selection"
[tableId]="tableId">
</perun-web-apps-attributes-list>
Expand Down
Loading

0 comments on commit 6a6a7ee

Please sign in to comment.