Przeglądaj źródła

Add UsuariController and update dependencies

Introduced UsuariController to handle user-related endpoints, including role checks and active roles retrieval. Also commented out Thymeleaf-related dependencies in pom.xml, likely to disable unused view rendering features.
Mario Martínez Hernández 3 miesięcy temu
rodzic
commit
d1813d7f12
2 zmienionych plików z 46 dodań i 2 usunięć
  1. 4 2
      pom.xml
  2. 42 0
      src/main/java/es/uv/saic/web/UsuariController.java

+ 4 - 2
pom.xml

@@ -56,15 +56,16 @@
 	        <artifactId>spring-boot-admin-starter-client</artifactId>
 	        <version>3.3.0</version>
     	</dependency>
-		<dependency>
+		<!--<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-thymeleaf</artifactId>
-		</dependency>
+		</dependency>-->
 		<dependency>
 		    <groupId>org.springframework.boot</groupId>
 		    <artifactId>spring-boot-properties-migrator</artifactId>
 		    <scope>runtime</scope>
 		</dependency>
+		<!--
 		<dependency>
 		    <groupId>nz.net.ultraq.thymeleaf</groupId>
 		    <artifactId>thymeleaf-layout-dialect</artifactId>
@@ -73,6 +74,7 @@
 		    <groupId>org.thymeleaf.extras</groupId>
 		    <artifactId>thymeleaf-extras-springsecurity6</artifactId>
 		</dependency>
+		-->
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-security</artifactId>

+ 42 - 0
src/main/java/es/uv/saic/web/UsuariController.java

@@ -0,0 +1,42 @@
+package es.uv.saic.web;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+
+import es.uv.saic.domain.Usuari;
+import es.uv.saic.domain.UsuarisRol;
+import es.uv.saic.service.UsuariService;
+import es.uv.saic.service.UsuarisRolService;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+
+@RestController
+public class UsuariController {
+    @Autowired
+    UsuariService us;
+    
+    @Autowired
+    UsuarisRolService urs;
+
+    @PostMapping("/grantedUser")
+    public boolean isGrantedUser(@RequestBody Usuari usuari) {
+        return urs.isGrantedUser(usuari);
+    }
+    
+    @PostMapping("/grantedSupervisor")
+    public boolean isGrantedSupervisor(@RequestBody Usuari usuari) {
+        return urs.isGrantedSupervisor(usuari);
+    }
+
+    @PostMapping("/findActiveRols")
+    public List<UsuarisRol> findActiveRols(@RequestBody Usuari usuari) {
+        return urs.findActiveRols(usuari);
+    }
+
+	public boolean exists(String usuari, String tlugar, Integer lugar) {
+		return urs.exists(usuari, tlugar, lugar);
+	}
+}