添加方法 getPropertyToArray
This commit is contained in:
@@ -4,6 +4,16 @@
|
||||
*/
|
||||
package com.jeesite.common.io;
|
||||
|
||||
import com.jeesite.common.codec.EncodeUtils;
|
||||
import com.jeesite.common.collect.SetUtils;
|
||||
import com.jeesite.common.lang.ObjectUtils;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -13,17 +23,6 @@ import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import com.jeesite.common.codec.EncodeUtils;
|
||||
import com.jeesite.common.collect.SetUtils;
|
||||
import com.jeesite.common.lang.ObjectUtils;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* Properties工具类, 可载入多个properties、yml文件,
|
||||
* 相同的属性在最后载入的文件中的值将会覆盖之前的值,
|
||||
@@ -207,6 +206,15 @@ public class PropertiesUtils {
|
||||
return value != null ? value : defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置文件中String类型的值,取不到从System.getProperty获取,取不到,返回空。
|
||||
* 对属性值进行 “,“ 逗号进行 split 分割,并返回
|
||||
* @return 获取不到,返回空defValue默认值
|
||||
*/
|
||||
public String[] getPropertyToArray(String key, String defValue) {
|
||||
return StringUtils.split(getProperty(key, defValue), ",");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置文件中Boolean类型的值,取不到从System.getProperty获取,取不到,返回空。
|
||||
* @return 获取不到,返回空defValue默认值,如果结果为非布尔类型,则返回false
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
*/
|
||||
package com.jeesite.common.shiro.filter;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import org.apache.shiro.web.filter.AccessControlFilter;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.web.filter.AccessControlFilter;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* 内部系统访问过滤器
|
||||
* @author ThinkGem
|
||||
@@ -25,8 +24,7 @@ public class InnerFilter extends AccessControlFilter {
|
||||
boolean result = false;
|
||||
String[] prefixes = (String[])mappedValue;
|
||||
if (prefixes == null){
|
||||
prefixes = StringUtils.split(Global.getProperty(
|
||||
"shiro.innerFilterAllowRemoteAddrs", "127.0.0.1"), ",");
|
||||
prefixes = Global.getPropertyToArray("shiro.innerFilterAllowRemoteAddrs", "127.0.0.1");
|
||||
}
|
||||
if (prefixes != null && request instanceof HttpServletRequest){
|
||||
String ip = request.getRemoteAddr();
|
||||
|
||||
@@ -406,8 +406,7 @@ public class AccountController extends BaseController{
|
||||
UserUtils.putCache("regLoginCode", user.getLoginCode());
|
||||
UserUtils.putCache("regUserName", user.getUserName());
|
||||
// 账号注册类型
|
||||
String[] userTypes = StringUtils.split(Global.getConfig(
|
||||
"sys.account.registerUser.userTypes", "-1"), ",");
|
||||
String[] userTypes = Global.getConfigToArray("sys.account.registerUser.userTypes", "-1");
|
||||
if (StringUtils.inString(user.getUserType(), userTypes)){
|
||||
UserUtils.putCache("regUserType", user.getUserType());
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user