Disallow to change roles and profiles in admin panel for LDAP users when roles are imported from LDAP

FEA: ItEr76S12LdapAuhentication
This commit is contained in:
Ignacio Diaz Teijido 2012-02-17 16:03:36 +01:00 committed by Manuel Rego Casasnovas
parent ecbe1351f5
commit ad379e4ec7
4 changed files with 21 additions and 2 deletions

View file

@ -127,4 +127,6 @@ public interface IUserModel {
boolean isLDAPBeingUsed();
boolean isLDAPRolesBeingUsed();
}

View file

@ -228,4 +228,8 @@ public class UserCRUDController extends BaseCRUDController<User> implements
return (isLdapUser() && userModel.isLDAPBeingUsed());
}
public boolean getLdapUserRolesLdapConfiguration() {
return (isLdapUser() && userModel.isLDAPRolesBeingUsed());
}
}

View file

@ -248,4 +248,11 @@ public class UserModel implements IUserModel {
.getLdapAuthEnabled();
}
@Transactional(readOnly = true)
@Override
public boolean isLDAPRolesBeingUsed() {
return configurationDAO.getConfiguration().getLdapConfiguration()
.getLdapSaveRolesDB();
}
}

View file

@ -93,10 +93,13 @@
<!-- Associated UserRoles -->
<groupbox closable="false">
<caption label="${i18n:_('Association with roles')}" />
<vbox>
<label value="${i18n:_('Roles of LDAP users cannot be managed because LDAP roles are being used.')}" visible="@{controller.ldapUserRolesLdapConfiguration}" />
</vbox>
<hbox align="center">
<combobox id="userRolesCombo" autodrop="true" />
<button label="${i18n:_('Add role')}"
onClick="controller.addSelectedRole()"/>
onClick="controller.addSelectedRole()" disabled="@{controller.ldapUserRolesLdapConfiguration}"/>
</hbox>
<grid id="listing" model="@{controller.roles}">
<columns sizable="true">
@ -121,12 +124,15 @@
<!-- Associated Profiles -->
<groupbox closable="false">
<caption label="${i18n:_('Association with profiles')}" />
<vbox>
<label value="${i18n:_('Profiles of LDAP users cannot be managed because LDAP roles are being used.')}" visible="@{controller.ldapUserRolesLdapConfiguration}" />
</vbox>
<hbox align="center">
<autocomplete id="profileAutocomplete"
autodrop="true" constraint=""
finder="ProfileFinder" />
<button label="${i18n:_('Add profile')}"
onClick="controller.addSelectedProfile()" />
onClick="controller.addSelectedProfile()" disabled="@{controller.ldapUserRolesLdapConfiguration}"/>
</hbox>
<grid id="profilesListing" model="@{controller.profiles}">
<columns sizable="true">