Does the users list sortable by user type (LDAP or Database).

* It was also refactored the getUserType() method inside User entity class.
This commit is contained in:
Javier Moran Rua 2012-08-19 14:08:53 +02:00
parent f87ae59560
commit f5d99cdb82
3 changed files with 10 additions and 17 deletions

View file

@ -21,6 +21,8 @@
package org.libreplan.business.users.entities;
import static org.libreplan.business.i18n.I18nHelper._;
import java.util.HashSet;
import java.util.Set;
@ -43,6 +45,7 @@ import org.libreplan.business.users.daos.IUserDAO;
* @author Cristina Alvarino Perez <cristina.alvarino@comtecsf.es>
* @author Ignacio Diaz Teijido <ignacio.diaz@comtecsf.es>
* @author Manuel Rego Casasnovas <rego@igalia.com>
* @author Javier Moran Rua <jmoran@igalia.com>
*/
public class User extends BaseEntity implements IHumanIdentifiable{
@ -336,4 +339,8 @@ public class User extends BaseEntity implements IHumanIdentifiable{
return worker != null;
}
public String getUserType() {
return isLibrePlanUser().equals(Boolean.TRUE) ? _("Database")
: _("LDAP");
}
}

View file

@ -100,7 +100,7 @@ public class UserCRUDController extends BaseCRUDController<User> implements
Util.appendLabel(row, user.getLoginName());
Util.appendLabel(row, user.isDisabled() ? _("Yes") : _("No"));
Util.appendLabel(row, user.isSuperuser() ? _("Yes") : _("No"));
Util.appendLabel(row, getAuthenticationType(user));
Util.appendLabel(row, _(user.getUserType()));
Util.appendLabel(row, user.isBound() ? user.getWorker()
.getShortDescription() : "");
@ -362,21 +362,6 @@ public class UserCRUDController extends BaseCRUDController<User> implements
};
}
public String getAuthenticationType() {
User user = getUser();
if (user != null) {
return getAuthenticationType(user);
}
return "";
}
private String getAuthenticationType(User user) {
if (user.isLibrePlanUser()) {
return _("Database");
}
return _("LDAP");
}
public RowRenderer getUsersRenderer() {
return usersRenderer;
}

View file

@ -28,7 +28,8 @@
sort="auto(lower(loginName))" sortDirection="ascending"/>
<newdatasortablecolumn label="${i18n:_('Disabled')}" />
<newdatasortablecolumn label="${i18n:_('Superuser')}" />
<newdatasortablecolumn label="${i18n:_('Authentication type')}" />
<newdatasortablecolumn label="${i18n:_('Authentication type')}"
sort="auto(userType)"/>
<newdatasortablecolumn label="${i18n:_('Bound resource')}" />
<newdatasortablecolumn label="${i18n:_('Actions')}" />
</columns>