mirror of
				https://github.com/Frooodle/Stirling-PDF.git
				synced 2025-10-25 11:17:28 +02:00 
			
		
		
		
	Check DOCKER_ENABLE_SECURITY for UI (#1103)
				
					
				
			When using `DOCKER_ENABLE_SECURITY=false`, the logout button and `Account Settings` are no longer displayed.
This commit is contained in:
		
							parent
							
								
									5185fd13b8
								
							
						
					
					
						commit
						3189d9dda8
					
				| @ -6,6 +6,7 @@ import java.nio.file.Paths; | ||||
| import java.util.Properties; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass; | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| import org.springframework.core.io.ClassPathResource; | ||||
| @ -85,4 +86,10 @@ public class AppConfig { | ||||
|         } | ||||
|         return "true".equalsIgnoreCase(installOps); | ||||
|     } | ||||
| 
 | ||||
|     @ConditionalOnMissingClass("stirling.software.SPDF.config.security.SecurityConfiguration") | ||||
|     @Bean(name = "activSecurity") | ||||
|     public boolean missingActivSecurity() { | ||||
|         return false; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -166,4 +166,9 @@ public class SecurityConfiguration { | ||||
|     public PersistentTokenRepository persistentTokenRepository() { | ||||
|         return new JPATokenRepositoryImpl(); | ||||
|     } | ||||
| 
 | ||||
|     @Bean | ||||
|     public boolean activSecurity() { | ||||
|         return true; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -218,10 +218,10 @@ | ||||
|                     <input type="checkbox" class="form-check-input" id="cacheInputs" th:title="#{settings.cacheInputs.help}"> | ||||
|                     <label class="form-check-label" for="cacheInputs" th:text="#{settings.cacheInputs.name}"></label> | ||||
|                   </div> | ||||
|                   <a th:if="${@loginEnabled}" href="account" class="btn btn-sm btn-outline-primary" role="button" th:text="#{settings.accountSettings}" target="_blank">Account Settings</a> | ||||
|                   <a th:if="${@loginEnabled and @activSecurity}" href="account" class="btn btn-sm btn-outline-primary" role="button" th:text="#{settings.accountSettings}" target="_blank">Account Settings</a> | ||||
|                 </div> | ||||
|                 <div class="modal-footer"> | ||||
|                   <a th:if="${@loginEnabled}" class="btn btn-danger" role="button" th:text="#{settings.signOut}" href="logout">Sign Out</a> | ||||
|                   <a th:if="${@loginEnabled and @activSecurity}" class="btn btn-danger" role="button" th:text="#{settings.signOut}" href="logout">Sign Out</a> | ||||
|                   <button type="button" class="btn btn-secondary" data-bs-dismiss="modal" th:text="#{close}"></button> | ||||
|                 </div> | ||||
|               </div> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user