|
@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.MediaType;
|
|
@@ -56,10 +57,12 @@ public class BaseAuthenticationSuccessEventHandler extends SavedRequestAwareAuth
|
|
|
private ObjectMapper objectMapper;
|
|
|
@Autowired
|
|
|
private ImFeignService imFeignService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ClientDetailsService clientDetailsService;
|
|
|
|
|
|
+ @Value("${message.lesseeOrganId}")
|
|
|
+ private Integer lesseeOrganId;
|
|
|
+
|
|
|
@Autowired
|
|
|
private AuthorizationServerTokenServices defaultAuthorizationServerTokenServices;
|
|
|
|
|
@@ -128,6 +131,17 @@ public class BaseAuthenticationSuccessEventHandler extends SavedRequestAwareAuth
|
|
|
Map<String,Object> map = new HashMap<>(3);
|
|
|
map.put("password", StringUtils.isEmpty(sysUser.getPassword())?false:true);
|
|
|
map.put("authentication",oAuth2AccessToken);
|
|
|
+ map.put("isLessee",false);
|
|
|
+ if("TEACHER".equals(clientId.toUpperCase())){
|
|
|
+ Integer organId = sysUserService.getTeacherOrganId(sysUser.getId());
|
|
|
+ if(organId != null && organId == lesseeOrganId){
|
|
|
+ map.put("isLessee",true);
|
|
|
+ }
|
|
|
+ }else if("STUDENT".equals(clientId.toUpperCase())){
|
|
|
+ if(sysUser.getOrganId() == lesseeOrganId){
|
|
|
+ map.put("isLessee",true);
|
|
|
+ }
|
|
|
+ }
|
|
|
response.setContentType("application/json; charset=utf-8");
|
|
|
HttpResponseResult result = new HttpResponseResult(true, HttpStatus.OK.value(), map, "");
|
|
|
response.getWriter().write(objectMapper.writeValueAsString(result));
|