上传文件至 src/main/java/co/jp/mamol/myapp/controller
This commit is contained in:
@ -0,0 +1,30 @@
|
|||||||
|
package co.jp.mamol.myapp.controller;
|
||||||
|
|
||||||
|
import co.jp.mamol.myapp.common.ApiResponse;
|
||||||
|
import co.jp.mamol.myapp.form.StoreForm;
|
||||||
|
import co.jp.mamol.myapp.model.UserModel;
|
||||||
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class SystemAdminController {
|
||||||
|
|
||||||
|
private UserModel getLoginUser(HttpSession session) {
|
||||||
|
|
||||||
|
return (UserModel) session.getAttribute("loginInfo");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/systemAdmin/init")
|
||||||
|
public ResponseEntity<ApiResponse<String>> administrator(HttpSession session) {
|
||||||
|
UserModel user = getLoginUser(session);
|
||||||
|
if (user == null || !"5".equals(user.getRole_class())) {
|
||||||
|
return ResponseEntity.badRequest().body(ApiResponse.fail("ログイン情報が無効です。再度ログインしてください。"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseEntity.ok(ApiResponse.success("systemAdmin"));
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user