Skip to content

Commit

Permalink
Ajout d'un nouveau paramètre "PARAM_CANDIDAT_IS_COMPTE_EXTERNE_AUT"
Browse files Browse the repository at this point in the history
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 à...')
  • Loading branch information
khergalant committed Dec 3, 2024
1 parent 9c4501c commit f978b6f
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,10 @@ private void nomenclatureParametres(final Locale locale) {
applicationContext.getMessage("parametrage.codParam.isMdpConnectCas", null, locale),
ConstanteUtils.TYP_BOOLEAN_YES, NomenclatureUtils.TYP_PARAM_BOOLEAN, false, true));

majParametre(new Parametre(NomenclatureUtils.COD_PARAM_CANDIDAT_IS_COMPTE_EXTERNE_AUT,
applicationContext.getMessage("parametrage.codParam.isCompteExterneAut", null, locale),
ConstanteUtils.TYP_BOOLEAN_YES, NomenclatureUtils.TYP_PARAM_BOOLEAN, false, true));

majParametre(new Parametre(NomenclatureUtils.COD_PARAM_CANDIDAT_NB_HEURE_LIEN_MDP_VALID,
applicationContext.getMessage("parametrage.codParam.nbHeureLienMdpValid", null, locale),
"2", NomenclatureUtils.TYP_PARAM_INTEGER, false, true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,4 +669,10 @@ public Boolean getIsUtiliseRegStu() {
public Integer getNbHeureLienMdpValid() {
return getIntegerValue(NomenclatureUtils.COD_PARAM_CANDIDAT_NB_HEURE_LIEN_MDP_VALID);
}

/** @return si l'établissement autorise la création de comptes aux candidats extérieurs à l'établissement */
public Boolean getIsCompteExterneAut() {
return getBooleanValue(NomenclatureUtils.COD_PARAM_CANDIDAT_IS_COMPTE_EXTERNE_AUT);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class NomenclatureUtils {

/* Version */
public static final String VERSION_NOMENCLATURE_COD = "VERSION_NOMENCLATURE";
public static final String VERSION_NOMENCLATURE_VAL = "2.4.7.0";
public static final String VERSION_NOMENCLATURE_VAL = "2.4.7.1";
public static final String VERSION_NO_VERSION_VAL = "-";
public static final String VERSION_APPLICATION_COD = "VERSION_APPLICATION";
public static final String VERSION_DB = "VERSION_DB";
Expand Down Expand Up @@ -271,6 +271,7 @@ public class NomenclatureUtils {
public static final String COD_PARAM_CANDIDAT_IS_GET_SISCOL_PJ = "CANDIDAT_IS_GET_SISCOL_PJ";
public static final String COD_PARAM_CANDIDAT_IS_MDP_CONNECT_CAS = "CANDIDAT_IS_MDP_CONNECT_CAS";
public static final String COD_PARAM_CANDIDAT_NB_HEURE_LIEN_MDP_VALID = "CANDIDAT_NB_HEURE_LIEN_MDP_VALID";
public static final String COD_PARAM_CANDIDAT_IS_COMPTE_EXTERNE_AUT = "CANDIDAT_IS_COMPTE_EXTERNE_AUT";

/* Paramètres Candidature */
public static final String COD_PARAM_CANDIDATURE_NB_VOEUX_MAX = "CANDIDATURE_NB_VOEUX_MAX";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,20 @@
import com.vaadin.ui.themes.ValoTheme;

import fr.univlorraine.ecandidat.StyleConstants;
import fr.univlorraine.ecandidat.controllers.ParametreController;

/**
* Layout de connexion pour un anonymous
* @author Kevin Hergalant
*/
@SuppressWarnings("serial")
@Configurable(preConstruction = true)
public class ConnexionLayout extends VerticalLayout {

/** serialVersionUID */
private static final long serialVersionUID = -3178844375518329434L;

@Resource
private transient ApplicationContext applicationContext;
@Resource
private transient ParametreController parametreController;

/** Listeners */
private CasListener casListener;
Expand Down Expand Up @@ -138,6 +139,9 @@ public void init() {
this.addComponent(panelStudent);
this.addComponent(panelNotStudent);

/* Si l'établissement autorise la création de compte aux candidats extérieurs à l'établissement on masque le panel notStudent */
panelNotStudent.setVisible(parametreController.getIsCompteExterneAut());

final HorizontalLayout hlConnect = new HorizontalLayout();
hlConnect.setSpacing(true);
hlConnect.addComponent(labelConnect);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@
import fr.univlorraine.ecandidat.controllers.CampagneController;
import fr.univlorraine.ecandidat.controllers.CandidatController;
import fr.univlorraine.ecandidat.controllers.I18nController;
import fr.univlorraine.ecandidat.controllers.ParametreController;
import fr.univlorraine.ecandidat.controllers.UserController;
import fr.univlorraine.ecandidat.entities.ecandidat.Langue;
import fr.univlorraine.ecandidat.vaadin.components.OneClickButton;

/** Page de creation de compte du candidat
*
* @author Kevin Hergalant */
/**
* Page de creation de compte du candidat
* @author Kevin Hergalant
*/
@SuppressWarnings("serial")
@SpringView(name = CandidatCreerCompteView.NAME)
public class CandidatCreerCompteView extends VerticalLayout implements View {

/** serialVersionUID **/
private static final long serialVersionUID = -1892026915407604201L;

public static final String NAME = "candidatCreerCompteView";

/* Injections */
Expand All @@ -70,16 +70,18 @@ public class CandidatCreerCompteView extends VerticalLayout implements View {
private transient CampagneController campagneController;
@Resource
private transient I18nController i18nController;

private Label labelTitle = new Label();
private Label labelAccueil = new Label();
private HorizontalLayout hlConnectedCreateCompte = new HorizontalLayout();
private Panel panelIsStudent = new Panel();
private Panel panelNotStudent = new Panel();
private Panel panelCreateCompte = new Panel();
private VerticalLayout vlConnexionIsStudent = new VerticalLayout();
private VerticalLayout vlConnexionNotStudent = new VerticalLayout();
private OneClickButton logBtnNoCompte = new OneClickButton(FontAwesome.SIGN_OUT);
@Resource
private transient ParametreController parametreController;

private final Label labelTitle = new Label();
private final Label labelAccueil = new Label();
private final HorizontalLayout hlConnectedCreateCompte = new HorizontalLayout();
private final Panel panelIsStudent = new Panel();
private final Panel panelNotStudent = new Panel();
private final Panel panelCreateCompte = new Panel();
private final VerticalLayout vlConnexionIsStudent = new VerticalLayout();
private final VerticalLayout vlConnexionNotStudent = new VerticalLayout();
private final OneClickButton logBtnNoCompte = new OneClickButton(FontAwesome.SIGN_OUT);

/** Initialise la vue */
@PostConstruct
Expand All @@ -90,7 +92,7 @@ public void init() {
setSizeFull();

/* Titre */
HorizontalLayout hlLangue = new HorizontalLayout();
final HorizontalLayout hlLangue = new HorizontalLayout();
hlLangue.setWidth(100, Unit.PERCENTAGE);
hlLangue.setSpacing(true);

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

if (cacheController.getLangueEnServiceWithoutDefault().size() > 0) {
Langue langueDef = cacheController.getLangueDefault();
Image flagDef = new Image(null, new ThemeResource("images/flags/" + langueDef.getCodLangue() + ".png"));
final Langue langueDef = cacheController.getLangueDefault();
final Image flagDef = new Image(null, new ThemeResource("images/flags/" + langueDef.getCodLangue() + ".png"));
flagDef.addClickListener(e -> changeLangue(langueDef));
flagDef.addStyleName(StyleConstants.CLICKABLE);
hlLangue.addComponent(flagDef);
hlLangue.setComponentAlignment(flagDef, Alignment.MIDDLE_CENTER);
cacheController.getLangueEnServiceWithoutDefault().forEach(langue -> {
Image flag = new Image(null, new ThemeResource("images/flags/" + langue.getCodLangue() + ".png"));
final Image flag = new Image(null, new ThemeResource("images/flags/" + langue.getCodLangue() + ".png"));
flag.addClickListener(e -> changeLangue(langue));
flag.addStyleName(StyleConstants.CLICKABLE);
hlLangue.addComponent(flag);
Expand All @@ -121,13 +123,13 @@ public void init() {
addComponent(hlLangue);

/* Panel scrollable de contenu */
Panel panelContent = new Panel();
final Panel panelContent = new Panel();
panelContent.setSizeFull();
panelContent.addStyleName(ValoTheme.PANEL_BORDERLESS);
addComponent(panelContent);
setExpandRatio(panelContent, 1);

VerticalLayout vlContent = new VerticalLayout();
final VerticalLayout vlContent = new VerticalLayout();
vlContent.setSpacing(true);
panelContent.setContent(vlContent);

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

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

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

panelCreateCompte.setCaption(applicationContext.getMessage("accueilView.title.nocompte", null, UI.getCurrent().getLocale()));
panelCreateCompte.addStyleName(StyleConstants.PANEL_COLORED);
VerticalLayout vlCreateCompte = new VerticalLayout();
final VerticalLayout vlCreateCompte = new VerticalLayout();
vlCreateCompte.setSpacing(true);
vlCreateCompte.setMargin(true);
panelCreateCompte.setContent(vlCreateCompte);
Expand All @@ -181,22 +183,22 @@ public void init() {
vlCreateCompte.addComponent(logBtnNoCompte);
}

/** Change la langue de l'utilisateur et rafraichi les infos
*
/**
* Change la langue de l'utilisateur et rafraichi les infos
* @param langue
*/
private void changeLangue(final Langue langue) {
i18nController.changeLangue(langue);
labelTitle.setValue(applicationContext.getMessage(NAME + ".title", null, UI.getCurrent().getLocale()));
panelCreateCompte.setCaption(applicationContext.getMessage("accueilView.title.nocompte", null, UI.getCurrent().getLocale()));
logBtnNoCompte.setCaption(applicationContext.getMessage("accueilView.createaccount", null, UI.getCurrent().getLocale()));
Authentication auth = userController.getCurrentAuthentication();
final Authentication auth = userController.getCurrentAuthentication();
setTxtMessageAccueil(auth);
refreshLayoutConnexion(auth);
}

/** Rafrachi le layout de connexion
*
/**
* Rafrachi le layout de connexion
* @param auth
*/
private void refreshLayoutConnexion(final Authentication auth) {
Expand All @@ -211,7 +213,8 @@ private void refreshLayoutConnexion(final Authentication auth) {
return;
} else {
hlConnectedCreateCompte.setVisible(false);
panelNotStudent.setVisible(true);
/* Si l'établissement autorise la création de compte aux candidats extérieurs à l'établissement on masque le panel notStudent */
panelNotStudent.setVisible(parametreController.getIsCompteExterneAut());
panelIsStudent.setVisible(true);
}
refreshConnexionPanelStudent();
Expand All @@ -222,14 +225,14 @@ private void refreshLayoutConnexion(final Authentication auth) {
private void refreshConnexionPanelStudent() {
vlConnexionIsStudent.removeAllComponents();

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

HorizontalLayout hlConnect = new HorizontalLayout();
final HorizontalLayout hlConnect = new HorizontalLayout();
hlConnect.setSpacing(true);
Label labelConnect = new Label(applicationContext.getMessage("accueilView.connect.cas", null, UI.getCurrent().getLocale()));
final Label labelConnect = new Label(applicationContext.getMessage("accueilView.connect.cas", null, UI.getCurrent().getLocale()));
hlConnect.addComponent(labelConnect);
hlConnect.setComponentAlignment(labelConnect, Alignment.MIDDLE_LEFT);
hlConnect.addComponent(logBtn);
Expand All @@ -242,22 +245,24 @@ private void refreshConnexionPanelStudent() {
private void refreshConnexionPanelNotStudent() {
vlConnexionNotStudent.removeAllComponents();

OneClickButton logBtnNoCompte = new OneClickButton(applicationContext.getMessage("accueilView.createaccount", null, UI.getCurrent().getLocale()), FontAwesome.SIGN_OUT);
final OneClickButton logBtnNoCompte = new OneClickButton(applicationContext.getMessage("accueilView.createaccount", null, UI.getCurrent().getLocale()), FontAwesome.SIGN_OUT);
logBtnNoCompte.addClickListener(e -> {
candidatController.createCompteMinima(false);
});
vlConnexionNotStudent.addComponent(logBtnNoCompte);
}

/** @param auth
* @return le texte de message d'accueil */
/**
* @param auth
* @return le texte de message d'accueil
*/
private String setTxtMessageAccueil(final Authentication auth) {
String txt = "";
if (!userController.isAnonymous(auth)) {
txt += applicationContext.getMessage("accueilView.welcome", null, UI.getCurrent().getLocale());
txt += applicationContext.getMessage("accueilView.connected", new Object[] {userController.getCurrentUserName(auth)}, UI.getCurrent().getLocale());
txt += applicationContext.getMessage("accueilView.connected", new Object[] { userController.getCurrentUserName(auth) }, UI.getCurrent().getLocale());
if (userController.isPersonnel(auth)) {
txt += applicationContext.getMessage("accueilView.role", new Object[] {auth.getAuthorities()}, UI.getCurrent().getLocale());
txt += applicationContext.getMessage("accueilView.role", new Object[] { auth.getAuthorities() }, UI.getCurrent().getLocale());
} else if (userController.isCandidat(auth)) {
txt += applicationContext.getMessage("accueilView.cand.connected", null, UI.getCurrent().getLocale());
}
Expand All @@ -275,7 +280,7 @@ private String setTxtMessageAccueil(final Authentication auth) {
/** @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) */
@Override
public void enter(final ViewChangeEvent event) {
Authentication auth = userController.getCurrentAuthentication();
final Authentication auth = userController.getCurrentAuthentication();
setTxtMessageAccueil(auth);
refreshLayoutConnexion(auth);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ parametrage.codParam.isAddSiScolPjDossier = Si les pi\u00E8ces Apog\u00E9e so
parametrage.codParam.isBlocLettre = Si l'\u00E9tablissement bloque le t\u00E9l\u00E9chargement ou l'envoi par mail des lettres d'admission et de refus
parametrage.codParam.isBlocTransForm = Si le candidat ne peut pas transmettre sa candidature si les formulaires obligatoires ne sont pas renseign\u00E9s
parametrage.codParam.isCalculRangReelLc = Si le rang r\u00E9el d'un avis "liste compl\u00E9mentaire" est calcul\u00E9 au fil de l'eau
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...')
parametrage.codParam.isDematMaintenance = Si le service de d\u00E9mat\u00E9rialisation (GED ou FileSystem) est en maintenance
parametrage.codParam.isDownloadMultipleAddPj = Si les pi\u00E8ces sont ajout\u00E9es dans le dossier lors d'un t\u00E9l\u00E9chargement multiple
parametrage.codParam.isExportBlocNote = Si le bloc note est disponible dans l'export de candidatures
Expand Down

0 comments on commit f978b6f

Please sign in to comment.