Skip to content

Commit

Permalink
SAK-27757 Add Roster ID lookup for Delegated Access search results page
Browse files Browse the repository at this point in the history
git-svn-id: https://source.sakaiproject.org/svn/delegatedaccess/trunk@311498 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
Bryan Holladay committed Aug 1, 2014
1 parent 820f608 commit b793a31
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,4 +449,18 @@ public void copyNewRole(String siteRef, String copyRealm, String copyRole,
* @return
*/
public Placement getCurrentPlacement();

/**
* if this is set to true, then a "provider id lookup" column will be added to DA search results
* delegatedaccess.enableProviderIdLookup
* @return
*/
public boolean isProviderIdLookupEnabled();

/**
* returns the provider id for a realm
* @param siteRef
* @return
*/
public String getProviderId(String siteRef);
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class SiteSearchResult implements Serializable {
private String modifiedBy;
private String modifiedBySortName;
private boolean hasInstructor = true;
private String providers = "";

public SiteSearchResult(Site site, List<User> instructors, String termProp){
this.site = new SiteSerialized(site, termProp);
Expand Down Expand Up @@ -264,4 +265,12 @@ public void setHasInstructor(boolean hasInstructor) {
public boolean isHasInstructor() {
return hasInstructor;
}

public String getProviders() {
return providers;
}

public void setProviders(String providers) {
this.providers = providers;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class DelegatedAccessConstants {
public static final int SEARCH_COMPARE_ACCESS_MODIFIED_BY = 11;
public static final int SEARCH_COMPARE_LEVEL = 12;
public static final int SEARCH_COMPARE_PUBLISHED = 13;
public static final int SEARCH_COMPARE_PROVIDERS = 14;
public static final String SCHOOL_PROPERTY = "School";
public static final String DEPEARTMENT_PROPERTY = "Department";
public static final String SUBJECT_PROPERTY = "Subject";
Expand Down Expand Up @@ -120,6 +121,7 @@ public class DelegatedAccessConstants {
public static final String PROPERTIES_SHOPPING_INSTRUCTOR_EDITABLE = "delegatedaccess.shopping.instructorEditable";
public static final String PROPERTIES_HIDE_ROLES_FOR_VIEW_ACCESS = "delegatedaccess.siteaccess.instructorViewable.hiddenRoles";
public static final String PROPERTIES_ACCESS_ADMIN_ALLOW_SET_ALLOW_BECOME_USER = "delegatedaccess.allow.accessadmin.set.allowBecomeUser";
public static final String PROPERTIES_ACCESS_ENABLE_PROVIDER_ID_LOOKUP= "delegatedaccess.enableProviderIdLookup";
public static final String NODE_PERM_SITE_HIERARCHY_JOB_LAST_RUN_DATE = "siteHierarchyJobLastRunDate:";
public static final String SITE_HIERARCHY_USER = "777dv0f43bd90sdf012uf";
public static final int MAX_SITES_PER_PAGE = 10000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public int compare(SiteSearchResult arg0, SiteSearchResult arg1) {
}else if(arg0.isSitePublished()){
return 1;
}
case DelegatedAccessConstants.SEARCH_COMPARE_PROVIDERS:
return arg0.getProviders().compareToIgnoreCase(arg1.getProviders());
case DelegatedAccessConstants.SEARCH_COMPARE_SITE_TITLE:
default:
return arg0.getSiteTitle().compareToIgnoreCase(arg1.getSiteTitle());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,4 +687,17 @@ public String siteReference(String context){
public Placement getCurrentPlacement(){
return toolManager.getCurrentPlacement();
}

@Override
public boolean isProviderIdLookupEnabled() {
return serverConfigurationService.getBoolean(DelegatedAccessConstants.PROPERTIES_ACCESS_ENABLE_PROVIDER_ID_LOOKUP, false);
}

public String getProviderId(String siteRef){
try {
return authzGroupService.getAuthzGroup(siteRef).getProviderGroupId();
} catch (GroupNotDefinedException e) {
return "";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,6 @@ permaLink=Save Search
permaLinkMessage=Copy link for pasting into email
published=Published
yes=Yes
no=No
no=No
providers=Roster
lookupProviders=Lookup Roster
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ <h3><wicket:message key="searchSites"/></h3>
<th><a wicket:id="instructorSortLink"><span wicket:id="instructorSortLinkLabel"/></a></th>
<th><a wicket:id="termSortLink"><wicket:message key="termHeader"/></a></th>
<th><a wicket:id="siteIdSortLink"><wicket:message key="siteIdHeader"/></a></th>
<wicket:enclosure child="providersSortLink">
<th><a wicket:id="providersSortLink"><wicket:message key="providers"/></a></th>
</wicket:enclosure>
<wicket:enclosure child="publishedSortLink">
<th><a wicket:id="publishedSortLink"><wicket:message key="published"/></a></th>
</wicket:enclosure>
Expand All @@ -153,6 +156,12 @@ <h3><wicket:message key="searchSites"/></h3>
</wicket:enclosure>
<td><span wicket:id="term">term</span></td>
<td><span wicket:id="siteId">site id</span></td>
<wicket:enclosure child="providers">
<td>
<span wicket:id="providers">providers</span>
<a wicket:id="providersLookupLink"><wicket:message key="lookupProviders"/></a>
</td>
</wicket:enclosure>
<wicket:enclosure child="published">
<td><span wicket:id="published">Yes</span></td>
</wicket:enclosure>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,19 @@ public String getObject() {
instructorSort.add(new Label("instructorSortLinkLabel", instructorSortLabel));
add(instructorSort);

Link<Void> providersSort = new Link<Void>("providersSortLink"){
private static final long serialVersionUID = 1L;
public void onClick() {
changeOrder(DelegatedAccessConstants.SEARCH_COMPARE_PROVIDERS);
}
@Override
public boolean isVisible() {
//this helps hide all the extra columns with the wicket:enclosure in the html
return !isShoppingPeriodTool() && sakaiProxy.isProviderIdLookupEnabled();
}
};
add(providersSort);

Link<Void> publishedSort = new Link<Void>("publishedSortLink"){
private static final long serialVersionUID = 1L;
public void onClick() {
Expand All @@ -396,7 +409,6 @@ public boolean isVisible() {
}
};
add(publishedSort);


Link<Void> accessSort = new Link<Void>("accessSortLink"){
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -465,6 +477,7 @@ public void onClick(AjaxRequestTarget target) {
};
siteTitleLink.add(new Label("siteTitle", siteSearchResult.getSiteTitle()));
item.add(siteTitleLink);
final String siteRef = siteSearchResult.getSiteReference();
final String siteId = siteSearchResult.getSiteId();
item.add(new Label("siteId", siteId));
item.add(new Label("term", siteSearchResult.getSiteTerm()));
Expand Down Expand Up @@ -494,6 +507,29 @@ public boolean isVisible() {
&& siteSearchResult.isHasInstructor() && siteSearchResult.getInstructors().size() == 0;
}
});
item.add(new Label("providers", new AbstractReadOnlyModel<String>(){
@Override
public String getObject(){
return siteSearchResult.getProviders();
}
}){
@Override
public boolean isVisible() {
return !isShoppingPeriodTool() && sakaiProxy.isProviderIdLookupEnabled();
}
});
item.add(new Link<Void>("providersLookupLink"){
private static final long serialVersionUID = 1L;
public void onClick() {
siteSearchResult.setProviders(sakaiProxy.getProviderId(siteRef));
}

@Override
public boolean isVisible() {
return !isShoppingPeriodTool() && sakaiProxy.isProviderIdLookupEnabled() && "".equals(siteSearchResult.getProviders());
}
});

StringResourceModel publishedModel = siteSearchResult.isSitePublished() ? new StringResourceModel("yes", null) : new StringResourceModel("no", null);
item.add(new Label("published", publishedModel){
@Override
Expand Down

0 comments on commit b793a31

Please sign in to comment.