Repair get_sett module
This commit is contained in:
@ -403,6 +403,7 @@ public class MainController implements ServletContextAware {
|
||||
@ResponseBody
|
||||
public ResponseEntity<Object> get_settings(
|
||||
Authentication authentication,
|
||||
@Nullable @RequestBody SettingNameModel setting_name,
|
||||
@RequestParam(required=false,name="lng",defaultValue = "1") String language_id
|
||||
) {
|
||||
Translation trt = new Translation(language_id,jdbcTemplate);
|
||||
@ -421,16 +422,32 @@ public class MainController implements ServletContextAware {
|
||||
where
|
||||
us.del=false
|
||||
and user_id=:user_id
|
||||
and (:setting_name::text is null or name ilike '%'|| :setting_name::text ||'%')
|
||||
""";
|
||||
MapSqlParameterSource parameters = new MapSqlParameterSource();
|
||||
parameters.addValue("user_id", userDetails.getUserId());
|
||||
List<String> ret = jdbcTemplate.query(sql, parameters, new DBTools.JsonRowMapper());
|
||||
List<String> data = new ArrayList<>();
|
||||
for (String s : ret) {
|
||||
data.add((new JSONObject(s)).getString("name"));
|
||||
if (setting_name == null) {
|
||||
parameters.addValue("setting_name", null);
|
||||
} else {
|
||||
parameters.addValue("setting_name", setting_name.getSetting_name());
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(data, HttpStatus.OK);
|
||||
List<String> ret = jdbcTemplate.query(sql, parameters, new DBTools.JsonRowMapper());
|
||||
List<Map<String,String>> data = new ArrayList<>();
|
||||
for (String s : ret) {
|
||||
JSONObject row = new JSONObject(s);
|
||||
Map<String, String> item = new HashMap<>();
|
||||
item.put("name", row.getString("name"));
|
||||
item.put("value", row.getString("value"));
|
||||
data.add(item);
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("error_code", 0);
|
||||
result.put("data", data);
|
||||
|
||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||
|
||||
} catch (CustomException e) {
|
||||
if(e.isSaveToLog()) {
|
||||
logger.error(MarkerFactory.getMarker(e.getErrorMarker()), e.getMessage());
|
||||
|
||||
@ -51,9 +51,11 @@ public class SecurityConfig {
|
||||
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
|
||||
String path = request.getRequestURI();
|
||||
if(!path.equals("/")) System.out.println(path); // https://127.0.0.1:8082/logout
|
||||
|
||||
//Define paths that do not require authorization
|
||||
return path.equals("/") ||
|
||||
path.equals("/login") ||
|
||||
path.equals("/logout") ||
|
||||
//path.equals("/logout") ||
|
||||
path.equals("/create") ||
|
||||
path.equals("/captcha") ||
|
||||
path.equals("/restore") ||
|
||||
@ -61,8 +63,7 @@ public class SecurityConfig {
|
||||
path.equals("/get_session") ||
|
||||
path.equals("/get_request_token") ||
|
||||
path.equals("/verification") ||
|
||||
path.equals("/update") ||
|
||||
path.equals("/access");
|
||||
path.equals("/update");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
16
src/main/java/org/ccalm/jwt/models/SettingNameModel.java
Normal file
16
src/main/java/org/ccalm/jwt/models/SettingNameModel.java
Normal file
@ -0,0 +1,16 @@
|
||||
package org.ccalm.jwt.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
|
||||
@Schema(description = "Model for getting actions by name")
|
||||
public class SettingNameModel {
|
||||
|
||||
@Schema(description = "Action name", example = "arm_")
|
||||
@JsonProperty("action_name")
|
||||
private String setting_name;
|
||||
}
|
||||
@ -9,9 +9,7 @@
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOGS}/${appName}.log</file>
|
||||
<encoder>
|
||||
<pattern>
|
||||
{"timestamp":"%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}","thread":"[%thread]","level":"%level","logger":"%logger{36}","marker":"%marker","message":"%msg","exception":"%exOneLine"}%n
|
||||
</pattern>
|
||||
<pattern>{"timestamp":"%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}","thread":"[%thread]","level":"%level","logger":"%logger{36}","marker":"%marker","message":"%msg","exception":"%exOneLine"}%n</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOGS}/${appName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
|
||||
Reference in New Issue
Block a user