Skip to content

Commit f978b6f

Browse files
committed
Ajout d'un nouveau paramètre "PARAM_CANDIDAT_IS_COMPTE_EXTERNE_AUT"
permettant de ne pas autoriser la création de comptes aux candidats extérieurs à l'établissement (si non coché, masque les panneaux 'Je ne suis pas étudiant à...')
1 parent 9c4501c commit f978b6f

File tree

6 files changed

+65
-44
lines changed

6 files changed

+65
-44
lines changed

src/main/java/fr/univlorraine/ecandidat/controllers/NomenclatureController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,10 @@ private void nomenclatureParametres(final Locale locale) {
760760
applicationContext.getMessage("parametrage.codParam.isMdpConnectCas", null, locale),
761761
ConstanteUtils.TYP_BOOLEAN_YES, NomenclatureUtils.TYP_PARAM_BOOLEAN, false, true));
762762

763+
majParametre(new Parametre(NomenclatureUtils.COD_PARAM_CANDIDAT_IS_COMPTE_EXTERNE_AUT,
764+
applicationContext.getMessage("parametrage.codParam.isCompteExterneAut", null, locale),
765+
ConstanteUtils.TYP_BOOLEAN_YES, NomenclatureUtils.TYP_PARAM_BOOLEAN, false, true));
766+
763767
majParametre(new Parametre(NomenclatureUtils.COD_PARAM_CANDIDAT_NB_HEURE_LIEN_MDP_VALID,
764768
applicationContext.getMessage("parametrage.codParam.nbHeureLienMdpValid", null, locale),
765769
"2", NomenclatureUtils.TYP_PARAM_INTEGER, false, true));

src/main/java/fr/univlorraine/ecandidat/controllers/ParametreController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,4 +669,10 @@ public Boolean getIsUtiliseRegStu() {
669669
public Integer getNbHeureLienMdpValid() {
670670
return getIntegerValue(NomenclatureUtils.COD_PARAM_CANDIDAT_NB_HEURE_LIEN_MDP_VALID);
671671
}
672+
673+
/** @return si l'établissement autorise la création de comptes aux candidats extérieurs à l'établissement */
674+
public Boolean getIsCompteExterneAut() {
675+
return getBooleanValue(NomenclatureUtils.COD_PARAM_CANDIDAT_IS_COMPTE_EXTERNE_AUT);
676+
}
677+
672678
}

src/main/java/fr/univlorraine/ecandidat/utils/NomenclatureUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class NomenclatureUtils {
2727

2828
/* Version */
2929
public static final String VERSION_NOMENCLATURE_COD = "VERSION_NOMENCLATURE";
30-
public static final String VERSION_NOMENCLATURE_VAL = "2.4.7.0";
30+
public static final String VERSION_NOMENCLATURE_VAL = "2.4.7.1";
3131
public static final String VERSION_NO_VERSION_VAL = "-";
3232
public static final String VERSION_APPLICATION_COD = "VERSION_APPLICATION";
3333
public static final String VERSION_DB = "VERSION_DB";
@@ -271,6 +271,7 @@ public class NomenclatureUtils {
271271
public static final String COD_PARAM_CANDIDAT_IS_GET_SISCOL_PJ = "CANDIDAT_IS_GET_SISCOL_PJ";
272272
public static final String COD_PARAM_CANDIDAT_IS_MDP_CONNECT_CAS = "CANDIDAT_IS_MDP_CONNECT_CAS";
273273
public static final String COD_PARAM_CANDIDAT_NB_HEURE_LIEN_MDP_VALID = "CANDIDAT_NB_HEURE_LIEN_MDP_VALID";
274+
public static final String COD_PARAM_CANDIDAT_IS_COMPTE_EXTERNE_AUT = "CANDIDAT_IS_COMPTE_EXTERNE_AUT";
274275

275276
/* Paramètres Candidature */
276277
public static final String COD_PARAM_CANDIDATURE_NB_VOEUX_MAX = "CANDIDATURE_NB_VOEUX_MAX";

src/main/java/fr/univlorraine/ecandidat/vaadin/components/ConnexionLayout.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,20 @@
3737
import com.vaadin.ui.themes.ValoTheme;
3838

3939
import fr.univlorraine.ecandidat.StyleConstants;
40+
import fr.univlorraine.ecandidat.controllers.ParametreController;
4041

4142
/**
4243
* Layout de connexion pour un anonymous
4344
* @author Kevin Hergalant
4445
*/
46+
@SuppressWarnings("serial")
4547
@Configurable(preConstruction = true)
4648
public class ConnexionLayout extends VerticalLayout {
4749

48-
/** serialVersionUID */
49-
private static final long serialVersionUID = -3178844375518329434L;
50-
5150
@Resource
5251
private transient ApplicationContext applicationContext;
52+
@Resource
53+
private transient ParametreController parametreController;
5354

5455
/** Listeners */
5556
private CasListener casListener;
@@ -138,6 +139,9 @@ public void init() {
138139
this.addComponent(panelStudent);
139140
this.addComponent(panelNotStudent);
140141

142+
/* Si l'établissement autorise la création de compte aux candidats extérieurs à l'établissement on masque le panel notStudent */
143+
panelNotStudent.setVisible(parametreController.getIsCompteExterneAut());
144+
141145
final HorizontalLayout hlConnect = new HorizontalLayout();
142146
hlConnect.setSpacing(true);
143147
hlConnect.addComponent(labelConnect);

src/main/java/fr/univlorraine/ecandidat/views/CandidatCreerCompteView.java

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@
4242
import fr.univlorraine.ecandidat.controllers.CampagneController;
4343
import fr.univlorraine.ecandidat.controllers.CandidatController;
4444
import fr.univlorraine.ecandidat.controllers.I18nController;
45+
import fr.univlorraine.ecandidat.controllers.ParametreController;
4546
import fr.univlorraine.ecandidat.controllers.UserController;
4647
import fr.univlorraine.ecandidat.entities.ecandidat.Langue;
4748
import fr.univlorraine.ecandidat.vaadin.components.OneClickButton;
4849

49-
/** Page de creation de compte du candidat
50-
*
51-
* @author Kevin Hergalant */
50+
/**
51+
* Page de creation de compte du candidat
52+
* @author Kevin Hergalant
53+
*/
54+
@SuppressWarnings("serial")
5255
@SpringView(name = CandidatCreerCompteView.NAME)
5356
public class CandidatCreerCompteView extends VerticalLayout implements View {
5457

55-
/** serialVersionUID **/
56-
private static final long serialVersionUID = -1892026915407604201L;
57-
5858
public static final String NAME = "candidatCreerCompteView";
5959

6060
/* Injections */
@@ -70,16 +70,18 @@ public class CandidatCreerCompteView extends VerticalLayout implements View {
7070
private transient CampagneController campagneController;
7171
@Resource
7272
private transient I18nController i18nController;
73-
74-
private Label labelTitle = new Label();
75-
private Label labelAccueil = new Label();
76-
private HorizontalLayout hlConnectedCreateCompte = new HorizontalLayout();
77-
private Panel panelIsStudent = new Panel();
78-
private Panel panelNotStudent = new Panel();
79-
private Panel panelCreateCompte = new Panel();
80-
private VerticalLayout vlConnexionIsStudent = new VerticalLayout();
81-
private VerticalLayout vlConnexionNotStudent = new VerticalLayout();
82-
private OneClickButton logBtnNoCompte = new OneClickButton(FontAwesome.SIGN_OUT);
73+
@Resource
74+
private transient ParametreController parametreController;
75+
76+
private final Label labelTitle = new Label();
77+
private final Label labelAccueil = new Label();
78+
private final HorizontalLayout hlConnectedCreateCompte = new HorizontalLayout();
79+
private final Panel panelIsStudent = new Panel();
80+
private final Panel panelNotStudent = new Panel();
81+
private final Panel panelCreateCompte = new Panel();
82+
private final VerticalLayout vlConnexionIsStudent = new VerticalLayout();
83+
private final VerticalLayout vlConnexionNotStudent = new VerticalLayout();
84+
private final OneClickButton logBtnNoCompte = new OneClickButton(FontAwesome.SIGN_OUT);
8385

8486
/** Initialise la vue */
8587
@PostConstruct
@@ -90,7 +92,7 @@ public void init() {
9092
setSizeFull();
9193

9294
/* Titre */
93-
HorizontalLayout hlLangue = new HorizontalLayout();
95+
final HorizontalLayout hlLangue = new HorizontalLayout();
9496
hlLangue.setWidth(100, Unit.PERCENTAGE);
9597
hlLangue.setSpacing(true);
9698

@@ -102,14 +104,14 @@ public void init() {
102104
hlLangue.setComponentAlignment(labelTitle, Alignment.MIDDLE_LEFT);
103105

104106
if (cacheController.getLangueEnServiceWithoutDefault().size() > 0) {
105-
Langue langueDef = cacheController.getLangueDefault();
106-
Image flagDef = new Image(null, new ThemeResource("images/flags/" + langueDef.getCodLangue() + ".png"));
107+
final Langue langueDef = cacheController.getLangueDefault();
108+
final Image flagDef = new Image(null, new ThemeResource("images/flags/" + langueDef.getCodLangue() + ".png"));
107109
flagDef.addClickListener(e -> changeLangue(langueDef));
108110
flagDef.addStyleName(StyleConstants.CLICKABLE);
109111
hlLangue.addComponent(flagDef);
110112
hlLangue.setComponentAlignment(flagDef, Alignment.MIDDLE_CENTER);
111113
cacheController.getLangueEnServiceWithoutDefault().forEach(langue -> {
112-
Image flag = new Image(null, new ThemeResource("images/flags/" + langue.getCodLangue() + ".png"));
114+
final Image flag = new Image(null, new ThemeResource("images/flags/" + langue.getCodLangue() + ".png"));
113115
flag.addClickListener(e -> changeLangue(langue));
114116
flag.addStyleName(StyleConstants.CLICKABLE);
115117
hlLangue.addComponent(flag);
@@ -121,13 +123,13 @@ public void init() {
121123
addComponent(hlLangue);
122124

123125
/* Panel scrollable de contenu */
124-
Panel panelContent = new Panel();
126+
final Panel panelContent = new Panel();
125127
panelContent.setSizeFull();
126128
panelContent.addStyleName(ValoTheme.PANEL_BORDERLESS);
127129
addComponent(panelContent);
128130
setExpandRatio(panelContent, 1);
129131

130-
VerticalLayout vlContent = new VerticalLayout();
132+
final VerticalLayout vlContent = new VerticalLayout();
131133
vlContent.setSpacing(true);
132134
panelContent.setContent(vlContent);
133135

@@ -144,7 +146,7 @@ public void init() {
144146

145147
/* Connexion CAS */
146148
panelIsStudent.setCaption(applicationContext.getMessage("accueilView.title.etu", new Object[] {
147-
applicationContext.getMessage("universite.title", null, UI.getCurrent().getLocale())}, UI.getCurrent().getLocale()));
149+
applicationContext.getMessage("universite.title", null, UI.getCurrent().getLocale()) }, UI.getCurrent().getLocale()));
148150
panelIsStudent.addStyleName(StyleConstants.ACCUEIL_COMPTE_PANEL);
149151
panelIsStudent.addStyleName(StyleConstants.PANEL_COLORED);
150152
vlConnexionIsStudent.setSpacing(true);
@@ -154,7 +156,7 @@ public void init() {
154156

155157
/* Creation sans compte cas */
156158
panelNotStudent.setCaption(applicationContext.getMessage("accueilView.title.nonetu", new Object[] {
157-
applicationContext.getMessage("universite.title", null, UI.getCurrent().getLocale())}, UI.getCurrent().getLocale()));
159+
applicationContext.getMessage("universite.title", null, UI.getCurrent().getLocale()) }, UI.getCurrent().getLocale()));
158160
panelNotStudent.addStyleName(StyleConstants.ACCUEIL_COMPTE_PANEL);
159161
panelNotStudent.addStyleName(StyleConstants.PANEL_COLORED);
160162
vlConnexionNotStudent.setSpacing(true);
@@ -168,7 +170,7 @@ public void init() {
168170

169171
panelCreateCompte.setCaption(applicationContext.getMessage("accueilView.title.nocompte", null, UI.getCurrent().getLocale()));
170172
panelCreateCompte.addStyleName(StyleConstants.PANEL_COLORED);
171-
VerticalLayout vlCreateCompte = new VerticalLayout();
173+
final VerticalLayout vlCreateCompte = new VerticalLayout();
172174
vlCreateCompte.setSpacing(true);
173175
vlCreateCompte.setMargin(true);
174176
panelCreateCompte.setContent(vlCreateCompte);
@@ -181,22 +183,22 @@ public void init() {
181183
vlCreateCompte.addComponent(logBtnNoCompte);
182184
}
183185

184-
/** Change la langue de l'utilisateur et rafraichi les infos
185-
*
186+
/**
187+
* Change la langue de l'utilisateur et rafraichi les infos
186188
* @param langue
187189
*/
188190
private void changeLangue(final Langue langue) {
189191
i18nController.changeLangue(langue);
190192
labelTitle.setValue(applicationContext.getMessage(NAME + ".title", null, UI.getCurrent().getLocale()));
191193
panelCreateCompte.setCaption(applicationContext.getMessage("accueilView.title.nocompte", null, UI.getCurrent().getLocale()));
192194
logBtnNoCompte.setCaption(applicationContext.getMessage("accueilView.createaccount", null, UI.getCurrent().getLocale()));
193-
Authentication auth = userController.getCurrentAuthentication();
195+
final Authentication auth = userController.getCurrentAuthentication();
194196
setTxtMessageAccueil(auth);
195197
refreshLayoutConnexion(auth);
196198
}
197199

198-
/** Rafrachi le layout de connexion
199-
*
200+
/**
201+
* Rafrachi le layout de connexion
200202
* @param auth
201203
*/
202204
private void refreshLayoutConnexion(final Authentication auth) {
@@ -211,7 +213,8 @@ private void refreshLayoutConnexion(final Authentication auth) {
211213
return;
212214
} else {
213215
hlConnectedCreateCompte.setVisible(false);
214-
panelNotStudent.setVisible(true);
216+
/* Si l'établissement autorise la création de compte aux candidats extérieurs à l'établissement on masque le panel notStudent */
217+
panelNotStudent.setVisible(parametreController.getIsCompteExterneAut());
215218
panelIsStudent.setVisible(true);
216219
}
217220
refreshConnexionPanelStudent();
@@ -222,14 +225,14 @@ private void refreshLayoutConnexion(final Authentication auth) {
222225
private void refreshConnexionPanelStudent() {
223226
vlConnexionIsStudent.removeAllComponents();
224227

225-
OneClickButton logBtn = new OneClickButton(applicationContext.getMessage("btnConnect.candidat", null, UI.getCurrent().getLocale()), FontAwesome.SIGN_OUT);
228+
final OneClickButton logBtn = new OneClickButton(applicationContext.getMessage("btnConnect.candidat", null, UI.getCurrent().getLocale()), FontAwesome.SIGN_OUT);
226229
logBtn.addClickListener(e -> {
227230
userController.connectCAS();
228231
});
229232

230-
HorizontalLayout hlConnect = new HorizontalLayout();
233+
final HorizontalLayout hlConnect = new HorizontalLayout();
231234
hlConnect.setSpacing(true);
232-
Label labelConnect = new Label(applicationContext.getMessage("accueilView.connect.cas", null, UI.getCurrent().getLocale()));
235+
final Label labelConnect = new Label(applicationContext.getMessage("accueilView.connect.cas", null, UI.getCurrent().getLocale()));
233236
hlConnect.addComponent(labelConnect);
234237
hlConnect.setComponentAlignment(labelConnect, Alignment.MIDDLE_LEFT);
235238
hlConnect.addComponent(logBtn);
@@ -242,22 +245,24 @@ private void refreshConnexionPanelStudent() {
242245
private void refreshConnexionPanelNotStudent() {
243246
vlConnexionNotStudent.removeAllComponents();
244247

245-
OneClickButton logBtnNoCompte = new OneClickButton(applicationContext.getMessage("accueilView.createaccount", null, UI.getCurrent().getLocale()), FontAwesome.SIGN_OUT);
248+
final OneClickButton logBtnNoCompte = new OneClickButton(applicationContext.getMessage("accueilView.createaccount", null, UI.getCurrent().getLocale()), FontAwesome.SIGN_OUT);
246249
logBtnNoCompte.addClickListener(e -> {
247250
candidatController.createCompteMinima(false);
248251
});
249252
vlConnexionNotStudent.addComponent(logBtnNoCompte);
250253
}
251254

252-
/** @param auth
253-
* @return le texte de message d'accueil */
255+
/**
256+
* @param auth
257+
* @return le texte de message d'accueil
258+
*/
254259
private String setTxtMessageAccueil(final Authentication auth) {
255260
String txt = "";
256261
if (!userController.isAnonymous(auth)) {
257262
txt += applicationContext.getMessage("accueilView.welcome", null, UI.getCurrent().getLocale());
258-
txt += applicationContext.getMessage("accueilView.connected", new Object[] {userController.getCurrentUserName(auth)}, UI.getCurrent().getLocale());
263+
txt += applicationContext.getMessage("accueilView.connected", new Object[] { userController.getCurrentUserName(auth) }, UI.getCurrent().getLocale());
259264
if (userController.isPersonnel(auth)) {
260-
txt += applicationContext.getMessage("accueilView.role", new Object[] {auth.getAuthorities()}, UI.getCurrent().getLocale());
265+
txt += applicationContext.getMessage("accueilView.role", new Object[] { auth.getAuthorities() }, UI.getCurrent().getLocale());
261266
} else if (userController.isCandidat(auth)) {
262267
txt += applicationContext.getMessage("accueilView.cand.connected", null, UI.getCurrent().getLocale());
263268
}
@@ -275,7 +280,7 @@ private String setTxtMessageAccueil(final Authentication auth) {
275280
/** @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) */
276281
@Override
277282
public void enter(final ViewChangeEvent event) {
278-
Authentication auth = userController.getCurrentAuthentication();
283+
final Authentication auth = userController.getCurrentAuthentication();
279284
setTxtMessageAccueil(auth);
280285
refreshLayoutConnexion(auth);
281286
}

src/main/resources/i18n/backoffice/nomenclature-messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ parametrage.codParam.isAddSiScolPjDossier = Si les pi\u00E8ces Apog\u00E9e so
249249
parametrage.codParam.isBlocLettre = Si l'\u00E9tablissement bloque le t\u00E9l\u00E9chargement ou l'envoi par mail des lettres d'admission et de refus
250250
parametrage.codParam.isBlocTransForm = Si le candidat ne peut pas transmettre sa candidature si les formulaires obligatoires ne sont pas renseign\u00E9s
251251
parametrage.codParam.isCalculRangReelLc = Si le rang r\u00E9el d'un avis "liste compl\u00E9mentaire" est calcul\u00E9 au fil de l'eau
252+
parametrage.codParam.isCompteExterneAut = Si l'\u00E9tablissement autorise la cr\u00E9ation de comptes aux candidats ext\u00E9rieurs \u00E0 l'\u00E9tablissement (si non coch\u00E9, masque les panneaux 'Je ne suis pas \u00E9tudiant \u00E0...')
252253
parametrage.codParam.isDematMaintenance = Si le service de d\u00E9mat\u00E9rialisation (GED ou FileSystem) est en maintenance
253254
parametrage.codParam.isDownloadMultipleAddPj = Si les pi\u00E8ces sont ajout\u00E9es dans le dossier lors d'un t\u00E9l\u00E9chargement multiple
254255
parametrage.codParam.isExportBlocNote = Si le bloc note est disponible dans l'export de candidatures

0 commit comments

Comments
 (0)