http://localhost:8080/app/rest/v2/entities/sec$User?login=“caona” canna是当前登陆用户,但是这样用是不可以的,还会查出系统当中的全部用户
/v2/userInfo
获取当前用户信息可以直接使用内置 API :
package com.haulmont.restapi.controllers;
import com.haulmont.restapi.data.UserInfo;
import com.haulmont.restapi.service.UserInfoControllerManager;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.inject.Inject;
/**
* REST controller that is used for getting an information about the current user
*/
@RestController("cuba_UserInfoController")
@RequestMapping(value = "/v2/userInfo", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class UserInfoController {
@Inject
protected UserInfoControllerManager userInfoControllerManager;
@GetMapping
public UserInfo getUserInfo() {
return userInfoControllerManager.getUserInfo();
}
}