Skip to content

Commit

Permalink
SAK-32532 - Add a property so auto-favorite default can be changed (s…
Browse files Browse the repository at this point in the history
  • Loading branch information
jonespm authored May 16, 2017
1 parent e472a54 commit 3a872c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,14 @@
# DEFAULT: false
# portal.forceOverviewToTop=true

# SAK-32296 - Set default tabs to show
# DEFAULT:
# portal.default.tabs=15

# SAK-32532 - Change the default for auto favorite feature true/false
# DEFAULT: true
# portal.autofavorite=false

# ########################################################################
# SECURITY
# ########################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.apache.commons.lang.StringUtils;
import org.sakaiproject.entity.api.ResourcePropertiesEdit;
import org.sakaiproject.entity.api.EntityPropertyTypeException;
import org.sakaiproject.component.api.ServerConfigurationService;
import org.sakaiproject.component.cover.ComponentManager;
import org.sakaiproject.entity.api.EntityPropertyNotDefinedException;
import org.sakaiproject.user.api.PreferencesEdit;
import org.sakaiproject.exception.PermissionException;
Expand All @@ -41,11 +43,13 @@ public class FavoritesHandler extends BasePortalHandler
private static final String FAVORITES_PROPERTY = "order";
private static final String AUTO_FAVORITE_ENABLED_PROPERTY = "autoFavoriteEnabled";
private static final String SEEN_SITES_PROPERTY = "autoFavoritesSeenSites";

private ServerConfigurationService serverConfigurationService;

public FavoritesHandler()
{
setUrlFragment(URL_FRAGMENT);
serverConfigurationService = (ServerConfigurationService)
ComponentManager.get(ServerConfigurationService.class);
}


Expand Down Expand Up @@ -102,7 +106,7 @@ public UserFavorites userFavorites(String userId)
ResourceProperties props = prefs.getProperties(org.sakaiproject.user.api.PreferencesService.SITENAV_PREFS_KEY);

// Find any sites that this user was added to since we last looked
boolean autoFavorite = true;
boolean autoFavorite = serverConfigurationService.getBoolean("portal.autofavorite", true);

try {
autoFavorite = props.getBooleanProperty(AUTO_FAVORITE_ENABLED_PROPERTY);
Expand Down

0 comments on commit 3a872c9

Please sign in to comment.