Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions admin/src/main/resources/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,17 @@
"management.structure.informations.attach.parent.error.title": "Erreur d'ajout",
"management.structure.informations.attach.parent.success.content": "Cette structure a bien été attachée à une structure parente",
"management.structure.informations.attach.parent.success.title": "Structure parente attachée",
"management.structure.informations.communications.title": "Droits de communications",
"management.structure.informations.communications.description": "Ré-initialisation des droits de communications de l'établissement",
"management.structure.informations.communications.reset.action": "Ré-initialiser",
"management.structure.informations.communications.warning.title": "Réinitialisation",
"management.structure.informations.communications.warning.content": "La réinitialisation des droits de communication est une action irréversible. Elle supprimera les modifications apportées aux règles de communication entre les différents groupe (sauf groupes manuels) de votre établissement pour remettre la configuration par défaut.",
"management.structure.informations.communications.warning.continue": "Continuer",
"management.structure.informations.communications.confirm.content": "Êtes-vous sur de vouloir réinitialiser les règles de communications",
"management.structure.informations.communications.notify.success.content" : "Les règles de communications ont bien été réinitialisées",
"management.structure.informations.communications.notify.success.title": "Réinitialisation",
"management.structure.informations.communications.notify.error.content" : "Les règles de communications n'ont pas pu être réinitialisées",
"management.structure.informations.communications.notify.error.title": "Erreur de réinitialisation",
"management.structure.informations.detach.parent.error.content": "Cette structure n'a pas pu être détachée de son parent",
"management.structure.informations.detach.parent.error.title": "Erreur lors de la suppression",
"management.structure.informations.detach.parent.success.content": "Cette structure a bien été détachée de son parent",
Expand Down
8 changes: 4 additions & 4 deletions admin/src/main/ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"font-awesome": "4.7.0",
"jquery": "^3.4.1",
"ngx-infinite-scroll": "14.0.1",
"ngx-ode-core": "dev",
"ngx-ode-sijil": "dev",
"ngx-ode-ui": "dev",
"ngx-ode-core": "develop-b2school",
"ngx-ode-sijil": "develop-b2school",
"ngx-ode-ui": "develop-b2school",
"ngx-trumbowyg": "^6.0.7",
"noty": "2.4.1",
"reflect-metadata": "0.1.10",
Expand Down Expand Up @@ -72,4 +72,4 @@
"typescript": "~4.6.4",
"webpack": "^5.70.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ export class CommunicationRulesService {
.filter(group => !!group)
.filter(group => group.id === groupId);
}

public resetCommunication(structureId: string): Observable<any> {
return this.http.post(`/communication/rules/${structureId}/reset`, null);
}
}

export interface BidirectionalCommunicationRules {
Expand Down
4 changes: 3 additions & 1 deletion admin/src/main/ts/src/app/management/management.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { StructureUserPositionComponent } from './structure-user-positions/struc
import { MatDialogModule } from '@angular/material/dialog';
import { StructureUserPositionsComponent } from './structure-user-positions/structure-user-positions.component';
import { SharedModule } from '../_shared/shared.module';
import {CommunicationRulesService} from "../communication/communication-rules.service";

@NgModule({
imports: [
Expand Down Expand Up @@ -115,7 +116,8 @@ import { SharedModule } from '../_shared/shared.module';
SubjectsService,
CalendarService,
ImportEDTReportsService,
SubjectsGuardService
SubjectsGuardService,
CommunicationRulesService
]
})
export class ManagementModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,38 @@ <h3>
</p>
</ode-lightbox-confirm>
</div>


<div class="container has-shadow settings" *ngIf="isADMC == true">
<h2>
<s5l>management.structure.informations.communications.title</s5l>
</h2>
<s5l>management.structure.informations.communications.description</s5l>
<form #settingsForm="ngForm" (ngSubmit)="showResetCommunicationWarningLightBox = true;">
<div class="action-communication">
<button class="is-danger">
<s5l>management.structure.informations.communications.reset.action</s5l>
</button>
</div>
</form>
<ode-lightbox-confirm
[show]="showResetCommunicationWarningLightBox"
lightboxTitle="management.structure.informations.communications.warning.title"
(onCancel)="closeLightbox()"
(onConfirm)="openConfirmResetConfirmation()"
confirmText="management.structure.informations.communications.warning.continue">
<p>
<s5l>management.structure.informations.communications.warning.content</s5l>
</p>
</ode-lightbox-confirm>
<ode-lightbox-confirm
[show]="showResetCommunicationConfirmLightBox"
lightboxTitle="management.structure.informations.communications.warning.title"
(onCancel)="closeLightbox()"
(onConfirm)="resetCommunicationRules()">
<p>
<s5l>management.structure.informations.communications.confirm.content</s5l>
</p>
</ode-lightbox-confirm>
</div>

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
justify-content: flex-end;
}

.action-communication {
display: flex;
margin-top: 1em;
}

input[type="checkbox"],
button.cancel,
ode-message-sticker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Session } from 'src/app/core/store/mappings/session';
import { SessionModel } from 'src/app/core/store/models/session.model';
import { BundlesService } from 'ngx-ode-sijil';
import { Context } from 'src/app/core/store/mappings/context';
import {CommunicationRulesService} from "../../communication/communication-rules.service";

class UserMetric {
active: number = 0;
Expand Down Expand Up @@ -66,15 +67,17 @@ export class StructureInformationsComponent extends OdeComponent implements OnIn
public showMfaWarningLightbox = false;
public isADMC: boolean = false;
public showSettingsLightbox = false;
public showResetCommunicationWarningLightBox = false;
public showResetCommunicationConfirmLightBox = false;

public metrics: StructureMetrics = new StructureMetrics();
public settings: DuplicationSettings = new DuplicationSettings();

constructor(injector: Injector,
private infoService: StructureInformationsService,
private notify: NotifyService,
private bundles: BundlesService)
{
private bundles: BundlesService,
private communicationService: CommunicationRulesService) {
super(injector);
}

Expand Down Expand Up @@ -259,6 +262,23 @@ export class StructureInformationsComponent extends OdeComponent implements OnIn
closeLightbox(): void
{
this.showSettingsLightbox = false;
this.showResetCommunicationConfirmLightBox = false;
this.showResetCommunicationWarningLightBox = false;
this.changeDetector.markForCheck();
}

openConfirmResetConfirmation(): void {
this.closeLightbox();
this.showResetCommunicationConfirmLightBox = true;
}

resetCommunicationRules(): void {
this.closeLightbox();
this.communicationService.resetCommunication(this.structure._id).subscribe(
{
next: (data) => this.notify.success("management.structure.informations.communications.notify.success.content", "management.structure.informations.communications.notify.success.title"),
error: (error) => this.notify.notify("management.structure.informations.communications.notify.error.content", "management.structure.informations.communications.notify.error.title", error, "error")
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ public void init(Vertx vertx, JsonObject config, RouteMatcher rm,
@ResourceFilter(AdminFilter.class)
@MfaProtected()
public void staticAdmin(final HttpServerRequest request) {
renderView(request);
renderTemplateView(request);
}

@Get("/app-preview")
@SecuredAction(value = "", type = ActionType.RESOURCE)
@ResourceFilter(AdminFilter.class)
@MfaProtected()
public void appPreview(final HttpServerRequest request) {
renderView(request);
renderTemplateView(request);
}

@Get("/applications")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void init(Vertx vertx, JsonObject config, RouteMatcher rm, Map securedAct
@ResourceFilter(AdminFilter.class)
@MfaProtected()
public void widgetPreview(final HttpServerRequest request) {
renderView(request);
renderTemplateView(request);
}

@Get("/widgets")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void handle(Long event)
@Get("")
@SecuredAction("archive.view")
public void view(HttpServerRequest request) {
renderView(request);
renderTemplateView(request);
eventStore.createAndStoreEvent(ArchiveEvent.ACCESS.name(), request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ public void userRequirements(final HttpServerRequest request) {

@Get("/admin-welcome-message")
public void adminWelcomeMessage(final HttpServerRequest request) {
renderView(request);
renderTemplateView(request);
}

private void viewLogin(final HttpServerRequest request, String error, String callBack) {
Expand Down Expand Up @@ -2002,19 +2002,19 @@ public void generateOTP(HttpServerRequest request) {
@Get("/revalidate-terms")
@SecuredAction(value = "", type = ActionType.AUTHENTICATED)
public void revalidateTerms(final HttpServerRequest request) {
renderView(request);
renderTemplateView(request);
}

@Get("/validate-mail")
@SecuredAction(value = "", type = ActionType.AUTHENTICATED)
public void validateMail(HttpServerRequest request) {
renderView(request);
renderTemplateView(request);
}

@Get("/validate-mfa")
@SecuredAction(value = "", type = ActionType.AUTHENTICATED)
public void validateMfa(HttpServerRequest request) {
renderView(request);
renderTemplateView(request);
}

public void setUserAuthAccount(UserAuthAccount userAuthAccount) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import fr.wseduc.webutils.email.Bounce;
import fr.wseduc.webutils.email.EmailSender;
import fr.wseduc.webutils.eventbus.ResultMessage;
import fr.wseduc.webutils.http.ProcessTemplateContext;
import fr.wseduc.webutils.http.Renders;
import io.vertx.core.*;
import io.vertx.core.eventbus.EventBus;
Expand Down Expand Up @@ -247,7 +248,13 @@ public void sendEmail(HttpServerRequest request, List<Object> to, String from, L
};

if (templateParams != null) {
renders.processTemplate(request, templateBody, templateParams, mailHandler);
ProcessTemplateContext.Builder context = new ProcessTemplateContext.Builder()
.params(templateParams)
.request(request)
.templateString(templateBody)
.escapeHtml(true);

renders.processTemplateWithLambdas(context, h -> mailHandler.handle(h != null ? h.toString() : null));
} else {
mailHandler.handle(templateBody);
}
Expand Down
Loading