2024-04-21 13:15:18 +02:00
|
|
|
package stirling.software.SPDF.config;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Scope;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import stirling.software.SPDF.model.ApplicationProperties;
|
|
|
|
|
|
|
|
@Service
|
|
|
|
class AppUpdateService {
|
|
|
|
|
|
|
|
@Autowired private ApplicationProperties applicationProperties;
|
|
|
|
|
|
|
|
@Autowired(required = false)
|
|
|
|
ShowAdminInterface showAdmin;
|
|
|
|
|
|
|
|
@Bean(name = "shouldShow")
|
|
|
|
@Scope("request")
|
|
|
|
public boolean shouldShow() {
|
2024-09-13 17:42:38 +02:00
|
|
|
boolean showUpdate = applicationProperties.getSystem().isShowUpdate();
|
2024-04-21 13:15:18 +02:00
|
|
|
boolean showAdminResult = (showAdmin != null) ? showAdmin.getShowUpdateOnlyAdmins() : true;
|
|
|
|
return showUpdate && showAdminResult;
|
|
|
|
}
|
|
|
|
}
|