Fix UserAccounts list page so it encodes the role URIs properly when filtering. Only show non-public roles for selections.
This commit is contained in:
parent
5051c56f7a
commit
c18e14a106
6 changed files with 14 additions and 10 deletions
|
@ -3,7 +3,6 @@
|
||||||
package edu.cornell.mannlib.vitro.webapp.controller.accounts;
|
package edu.cornell.mannlib.vitro.webapp.controller.accounts;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -54,11 +53,16 @@ public abstract class UserAccountsPage extends AbstractPageHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a list of all known PermissionSets.
|
* Create a list of all known non-public PermissionSets.
|
||||||
*/
|
*/
|
||||||
protected List<PermissionSet> buildRolesList() {
|
protected List<PermissionSet> buildListOfSelectableRoles() {
|
||||||
List<PermissionSet> list = new ArrayList<PermissionSet>();
|
List<PermissionSet> list = new ArrayList<PermissionSet>();
|
||||||
list.addAll(userAccountsDao.getAllPermissionSets());
|
for (PermissionSet ps: userAccountsDao.getAllPermissionSets()) {
|
||||||
|
if (!ps.isForPublic()) {
|
||||||
|
list.add(ps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Collections.sort(list, new Comparator<PermissionSet>() {
|
Collections.sort(list, new Comparator<PermissionSet>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(PermissionSet ps1, PermissionSet ps2) {
|
public int compare(PermissionSet ps1, PermissionSet ps2) {
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class UserAccountsAddPage extends UserAccountsPage {
|
||||||
body.put(PARAMETER_FIRST_NAME, firstName);
|
body.put(PARAMETER_FIRST_NAME, firstName);
|
||||||
body.put(PARAMETER_LAST_NAME, lastName);
|
body.put(PARAMETER_LAST_NAME, lastName);
|
||||||
body.put("selectedRole", selectedRoleUri);
|
body.put("selectedRole", selectedRoleUri);
|
||||||
body.put("roles", buildRolesList());
|
body.put("roles", buildListOfSelectableRoles());
|
||||||
body.put("profileTypes", buildProfileTypesList());
|
body.put("profileTypes", buildProfileTypesList());
|
||||||
body.put(PARAMETER_NEW_PROFILE_CLASS_URI, newProfileClassUri);
|
body.put(PARAMETER_NEW_PROFILE_CLASS_URI, newProfileClassUri);
|
||||||
body.put("formUrls", buildUrlsMap());
|
body.put("formUrls", buildUrlsMap());
|
||||||
|
|
|
@ -235,7 +235,7 @@ public class UserAccountsEditPage extends UserAccountsPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isRootUser()) {
|
if (!isRootUser()) {
|
||||||
body.put("roles", buildRolesList());
|
body.put("roles", buildListOfSelectableRoles());
|
||||||
}
|
}
|
||||||
|
|
||||||
body.put("profileTypes", buildProfileTypesList());
|
body.put("profileTypes", buildProfileTypesList());
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class UserAccountsListPage extends UserAccountsPage {
|
||||||
body.put("page", buildPageMap(selection));
|
body.put("page", buildPageMap(selection));
|
||||||
|
|
||||||
body.put("formUrls", buildUrlsMap());
|
body.put("formUrls", buildUrlsMap());
|
||||||
body.put("roles", buildRolesList());
|
body.put("roles", buildListOfSelectableRoles());
|
||||||
|
|
||||||
body.put("messages", buildMessagesMap());
|
body.put("messages", buildMessagesMap());
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<select name="roleFilterUri" id="roleFilterUri">
|
<select name="roleFilterUri" id="roleFilterUri">
|
||||||
<option value="" <#if roleFilterUri = "">selected</#if> >Filter by roles</option>
|
<option value="" <#if roleFilterUri = "">selected</#if> >Filter by roles</option>
|
||||||
<#list roles as role>
|
<#list roles as role>
|
||||||
<option value="${formUrls.list}?roleFilterUri=${role.uri}" <#if roleFilterUri = role.uri>selected</#if> >${role.label}</option>
|
<option value="${formUrls.list}?roleFilterUri=${role.uri?url}" <#if roleFilterUri = role.uri>selected</#if> >${role.label}</option>
|
||||||
</#list>
|
</#list>
|
||||||
<!--
|
<!--
|
||||||
When roleFilterUri or searchTerm changes,
|
When roleFilterUri or searchTerm changes,
|
||||||
|
|
|
@ -41,7 +41,7 @@ ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/showAuth.css" /
|
||||||
(matching property is not defined)
|
(matching property is not defined)
|
||||||
</#if>
|
</#if>
|
||||||
</h4>
|
</h4>
|
||||||
<table summary="Associated Individuals" width="100%">
|
<table summary="Associated Individuals">
|
||||||
<#if associatedIndividuals?has_content>
|
<#if associatedIndividuals?has_content>
|
||||||
<#list associatedIndividuals as associatedIndividual>
|
<#list associatedIndividuals as associatedIndividual>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -59,7 +59,7 @@ ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/showAuth.css" /
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h4>Identifier factories:</h4>
|
<h4>Identifier factories:</h4>
|
||||||
<table summary="Active Identifier Factories" width="100%">
|
<table summary="Active Identifier Factories">
|
||||||
<#list factories as factory>
|
<#list factories as factory>
|
||||||
<tr>
|
<tr>
|
||||||
<td>${factory}</td>
|
<td>${factory}</td>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue