Skip to content

Commit

Permalink
Merge pull request sakaiproject#701 from master-bob/SAK-29549
Browse files Browse the repository at this point in the history
SAK-29549 Now able to hide connections in roster
  • Loading branch information
jonespm committed Nov 3, 2015
2 parents 26675e3 + bdc3cec commit 76ada77
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2620,6 +2620,10 @@
# DEFAULT: true
# roster_view_email=false

# Hide connection information from picture view (default=false), Profile2 >=1.4
# NOTE: If Profile2.connections.enabled is false, set accordingly.
# roster_view_connections=true

# Whether to allow site visit data to be displayed with each member
# DEFAULT: false
# roster.showVisits=true
Expand Down
9 changes: 9 additions & 0 deletions roster2/src/java/org/sakaiproject/roster/api/SakaiProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public interface SakaiProxy {
public final static Boolean DEFAULT_FIRST_NAME_LAST_NAME = false;
public final static Boolean DEFAULT_HIDE_SINGLE_GROUP_FILTER = false;
public final static Boolean DEFAULT_VIEW_EMAIL = true;
public final static Boolean DEFAULT_VIEW_CONNECTIONS = true;
public final static Boolean DEFAULT_VIEW_USER_DISPLAY_ID = true;
public final static Integer DEFAULT_ROSTER_STATE = 0;

Expand Down Expand Up @@ -128,6 +129,14 @@ public interface SakaiProxy {
* @return the value of the <code>roster_view_email</code> Sakai property.
*/
public Boolean getViewEmail(String siteId);

/**
* Returns the value of the <code>roster_view_connections</code> Sakai property.
* Note: if Profile2 connections (profile2.connections.enabled) is false, this
* will also be automatically false.
* @return the value of the <code>roster_view_connections</code> Sakai property.
*/
public Boolean getViewConnections();

/**
* Returns the value of the <code>roster.display.userDisplayId</code> Sakai property.
Expand Down
21 changes: 21 additions & 0 deletions roster2/src/java/org/sakaiproject/roster/impl/SakaiProxyImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.sakaiproject.memory.api.MemoryService;
import org.sakaiproject.memory.api.SimpleConfiguration;
import org.sakaiproject.profile2.logic.ProfileConnectionsLogic;
import org.sakaiproject.profile2.util.ProfileConstants;
import org.sakaiproject.roster.api.RosterEnrollment;
import org.sakaiproject.roster.api.RosterFunctions;
import org.sakaiproject.roster.api.RosterGroup;
Expand Down Expand Up @@ -261,6 +262,26 @@ public Boolean getViewEmail(String siteId) {
}
return false;
}

/**
* {@inheritDoc}
*/
public Boolean getViewConnections() {

Boolean view_connections = serverConfigurationService.getBoolean("roster_view_connections",
DEFAULT_VIEW_CONNECTIONS);

Boolean profile2_connections_enabled = serverConfigurationService.getBoolean("profile2.connections.enabled",
ProfileConstants.SAKAI_PROP_PROFILE2_CONNECTIONS_ENABLED);
Boolean profile2_menu_enabled = serverConfigurationService.getBoolean("profile2.menu.enabled",
ProfileConstants.SAKAI_PROP_PROFILE2_MENU_ENABLED);

if(!profile2_menu_enabled || !profile2_connections_enabled) {
view_connections = false;
}

return view_connections;
}

/**
* {@inheritDoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ protected void doGet(HttpServletRequest request,
request.setAttribute("viewEmail", sakaiProxy.getViewEmail());
request.setAttribute("superUser", sakaiProxy.isSuperUser());
request.setAttribute("siteMaintainer", sakaiProxy.isSiteMaintainer(sakaiProxy.getCurrentSiteId()));
request.setAttribute("viewConnections", sakaiProxy.getViewConnections());

response.setContentType("text/html");
request.getRequestDispatcher("/WEB-INF/bootstrap.jsp").include(request, response);
Expand Down
1 change: 1 addition & 0 deletions roster2/src/webapp/WEB-INF/bootstrap.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
viewUserDisplayId: ${viewUserDisplayId},
officialPicturesByDefault: ${officialPicturesByDefault},
viewEmail: ${viewEmail},
viewConnections: ${viewConnections},
superUser: ${superUser},
siteMaintainer: ${siteMaintainer},
i18n: {}
Expand Down
2 changes: 1 addition & 1 deletion roster2/src/webapp/js/roster.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@
'currentUserId': roster.userId,
'viewOfficialPhoto': roster.currentUserPermissions.viewOfficialPhoto,
'viewSiteVisits': roster.currentUserPermissions.viewSiteVisits,
'viewConnections': (undefined != window.friendStatus)
'viewConnections': ((undefined != window.friendStatus) && roster.viewConnections)
};

var templateName = (enrollmentsMode) ? 'enrollments' : 'members';
Expand Down

0 comments on commit 76ada77

Please sign in to comment.