Changes on LDAP configuration screen

FEA: ItEr74S09LdapAuhentication
This commit is contained in:
Ignacio Diaz Teijido 2011-11-16 17:46:05 +01:00 committed by Manuel Rego Casasnovas
parent 5c074529f3
commit 232ecd220d
5 changed files with 56 additions and 10 deletions

View file

@ -71,6 +71,8 @@ public class LDAPConfiguration extends BaseEntity {
// LDAP roles will be used or not
private Boolean ldapSaveRolesDB = false;
private Boolean ldapGroupStrategy = true;
/**
* A list which stores the matching between LDAP roles and LibrePlan roles.
* {@link ConfigurationRolesLDAP} is a component.
@ -244,4 +246,12 @@ public class LDAPConfiguration extends BaseEntity {
public void setLdapSearchQuery(String ldapSearchQuery) {
this.ldapSearchQuery = ldapSearchQuery;
}
public Boolean getLdapGroupStrategy() {
return ldapGroupStrategy;
}
public void setLdapGroupStrategy(Boolean ldapGroupStrategy) {
this.ldapGroupStrategy = ldapGroupStrategy;
}
}

View file

@ -323,4 +323,10 @@
newColumnName="libreplan_user" columnDataType="BOOLEAN" />
</changeSet>
<changeSet id="add-new-column-ldap-role-strategy" author="idiazt">
<comment>Add new column to store ldap role strategy</comment>
<addColumn tableName="configuration">
<column name="ldap_group_strategy" type="BOOLEAN" />
</addColumn>
</changeSet>
</databaseChangeLog>

View file

@ -75,6 +75,7 @@
<property name="ldapAuthEnabled" column="ldap_auth_enabled" not-null="true"/>
<property name="ldapSaveRolesDB" column="ldap_save_roles_db" not-null="true"/>
<property name="ldapSearchQuery" column="ldap_search_query"/>
<property name="ldapGroupStrategy" column="ldap_group_strategy"/>
<set name="configurationRolesLdap" table="configuration_roles_ldap" lazy="false">
<key column="id_configuration" />

View file

@ -68,6 +68,7 @@ import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Radio;
import org.zkoss.zul.Radiogroup;
import org.zkoss.zul.Row;
import org.zkoss.zul.RowRenderer;
import org.zkoss.zul.Rows;
@ -116,6 +117,14 @@ public class ConfigurationController extends GenericForwardComposer {
private UserRole roles;
private Textbox ldapGroupPath;
private Textbox ldapRoleProperty;
private Textbox ldapSearchQuery;
private Radiogroup strategy;
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
@ -141,7 +150,27 @@ public class ConfigurationController extends GenericForwardComposer {
scenariosVisible
.setTooltiptext(_("Scenarios must be enabled as more elements than master exist"));
}
showLdapRoles();
loadRoleStrategyRows();
}
public void changeRoleStrategy() {
this.getLdapConfiguration().setLdapGroupStrategy(
strategy.getSelectedItem().getValue().equals("group"));
loadRoleStrategyRows();
}
private void loadRoleStrategyRows() {
if (getLdapConfiguration().getLdapGroupStrategy()) {
strategy.setSelectedIndex(0);
ldapGroupPath.setDisabled(false);
ldapSearchQuery.setDisabled(true);
ldapRoleProperty.setDisabled(true);
} else {
strategy.setSelectedIndex(1);
ldapGroupPath.setDisabled(true);
ldapSearchQuery.setDisabled(false);
ldapRoleProperty.setDisabled(false);
}
}
private void initializeProgressTypeList() {
@ -765,11 +794,6 @@ public class ConfigurationController extends GenericForwardComposer {
configurationModel.setLdapConfiguration(ldapConfiguration);
}
public void showLdapRoles() {
ldapRoles.setVisible(configurationModel.getLdapConfiguration()
.getLdapSaveRolesDB());
}
public RowRenderer getAllUserRolesRenderer() {
return new RowRenderer() {
@Override

View file

@ -239,8 +239,10 @@
<!-- Activation -->
<groupbox style="margin-top: 5px" closable="false">
<caption label="${i18n:_('Activation')}" />
<label value="${i18n:_('LDAP Authentication enabled')}" />
<label value="${i18n:_('Enable LDAP authentication')}" />
<checkbox id="ldapAuthEnabled" checked="@{configurationController.ldapConfiguration.ldapAuthEnabled}" />
<label value="${i18n:_('Use LDAP roles')}" />
<checkbox id="ldapSaveRolesDB" checked="@{configurationController.ldapConfiguration.ldapSaveRolesDB}" />
</groupbox>
<!-- Configuration -->
@ -329,8 +331,11 @@
</columns>
<rows>
<row>
<label value="${i18n:_('Import LDAP roles')}" />
<checkbox id="ldapSaveRolesDB" checked="@{configurationController.ldapConfiguration.ldapSaveRolesDB}" onCheck="configurationController.showLdapRoles()"/>
<label value="${i18n:_('Role search strategy')}" />
<radiogroup id="strategy" onCheck="configurationController.changeRoleStrategy()">
<radio label="Group strategy" value="group" />
<radio label="Property strategy" value="property" />
</radiogroup>
</row>
<row>
<label value="${i18n:_('Group path')}" />
@ -357,7 +362,7 @@
</grid>
<separator />
<separator />
<vbox id="ldapRoles" visible="false">
<vbox id="ldapRoles">
<grid id="configurationRoles"
model="@{configurationController.roles}"
rowRenderer="@{configurationController.allUserRolesRenderer}"