Disallow managing passwords in admin users panel for LDAP users when LDAP is being used for authentication

FEA: ItEr76S12LdapAuhentication
This commit is contained in:
Ignacio Diaz Teijido 2012-02-17 16:03:35 +01:00 committed by Manuel Rego Casasnovas
parent c75fe8ba64
commit 3faf03ee16
4 changed files with 22 additions and 2 deletions

View file

@ -125,4 +125,6 @@ public interface IUserModel {
void confirmRemove(User user) throws InstanceNotFoundException;
boolean isLDAPBeingUsed();
}

View file

@ -224,4 +224,8 @@ public class UserCRUDController extends BaseCRUDController<User> implements
return !user.isLibrePlanUser();
}
public boolean isLdapUserLdapConfiguration() {
return (isLdapUser() && userModel.isLDAPBeingUsed());
}
}

View file

@ -26,6 +26,7 @@ import java.util.List;
import org.apache.commons.lang.Validate;
import org.libreplan.business.common.Configuration;
import org.libreplan.business.common.daos.IConfigurationDAO;
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
import org.libreplan.business.common.exceptions.ValidationException;
import org.libreplan.business.users.daos.IOrderAuthorizationDAO;
@ -55,6 +56,9 @@ public class UserModel implements IUserModel {
@Autowired
private IUserDAO userDAO;
@Autowired
private IConfigurationDAO configurationDAO;
@Autowired
private IOrderAuthorizationDAO orderAuthorizationDAO;
@ -237,4 +241,11 @@ public class UserModel implements IUserModel {
return userDAO.getOrderAuthorizationsByUser(user);
}
@Transactional(readOnly = true)
@Override
public boolean isLDAPBeingUsed() {
return configurationDAO.getConfiguration().getLdapConfiguration()
.getLdapAuthEnabled();
}
}

View file

@ -31,6 +31,9 @@
<vbox>
<!-- User details -->
<vbox>
<label value="${i18n:_('Password cannot be managed for LDAP users because LDAP authentication is being used')}" visible="@{controller.ldapUserLdapConfiguration}" />
</vbox>
<groupbox closable="false">
<caption label="${i18n:_('General user data')}" />
<grid fixedLayout="false" span="true">
@ -60,13 +63,13 @@
<row>
<label value="${i18n:_('Password')}" />
<textbox id="password" type="password"
onChange="controller.setPassword(self.value);" width="300px"/>
onChange="controller.setPassword(self.value);" width="300px" disabled="@{controller.ldapUserLdapConfiguration}"/>
</row>
<row>
<label value="${i18n:_('Password confirmation')}" />
<textbox id="passwordConfirmation" type="password"
constraint="@{controller.validatePasswordConfirmation}"
width="300px"/>
width="300px" disabled="@{controller.ldapUserLdapConfiguration}"/>
</row>
<row>
<label value="${i18n:_('Disabled')}" />