@Override public PortalPage updatePortalPageUnconditionally(JiraServiceContext serviceCtx, ApplicationUser user, PortalPage portalPage) { Assertions.notNull("serviceCtx", serviceCtx); Assertions.notNull("portalPage", portalPage); Assertions.notNull("user", user); if (permissionManager.hasPermission(Permissions.ADMINISTER, user)) { return portalPageManager.update(portalPage); } else { return null; } }
public PortalPage updatePortalPage(final JiraServiceContext serviceCtx, final PortalPage portalPage, final boolean isFavourite) { Assertions.notNull("serviceCtx", serviceCtx); Assertions.notNull("portalPage", portalPage); if (validateForUpdate(serviceCtx, portalPage)) { //TODO: Need to do a lot of refactoring here to use the DashboardService for updating most properties // except for metadata. The PortalPage needs to be changed such that it only contains metadata, but no // info about portletConfigs. This will be done once the old dashboard has been removed! final PortalPage updatedPortalPage = portalPageManager.update(portalPage); if (isFavourite) { try { favouritesManager.addFavourite(serviceCtx.getLoggedInApplicationUser(), updatedPortalPage); } catch (final PermissionException e) { serviceCtx.getErrorCollection().addErrorMessage(serviceCtx.getI18nBean().getText("common.favourites.not.added")); } } else { favouritesManager.removeFavourite(serviceCtx.getLoggedInApplicationUser(), updatedPortalPage); } return updatedPortalPage; } return null; }