提交 d5369b34 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 25edf511
...@@ -37,11 +37,11 @@ ...@@ -37,11 +37,11 @@
git clone -b master $para2 ibzou/ git clone -b master $para2 ibzou/
export NODE_OPTIONS=--max-old-space-size=4096 export NODE_OPTIONS=--max-old-space-size=4096
cd ibzou/ cd ibzou/
mvn clean package -Pweb mvn clean package -Papi
cd ibzou-app/ibzou-app-web cd ibzou-provider/ibzou-provider-api
mvn -Pweb docker:build mvn -Papi docker:build
mvn -Pweb docker:push mvn -Papi docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzou-app-web.yaml ibzlab-rt --with-registry-auth docker -H $para1 stack deploy --compose-file=src/main/docker/ibzou-provider-api.yaml ibzlab-rt --with-registry-auth
</command> </command>
</hudson.tasks.Shell> </hudson.tasks.Shell>
</builders> </builders>
......
...@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \ ...@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \
sleep ${IBZ_SLEEP} && \ sleep ${IBZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzou-app-web.jar java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzou-app-web.jar
EXPOSE 30001 EXPOSE 8080
ADD ibzou-app-web.jar /ibzou-app-web.jar ADD ibzou-app-web.jar /ibzou-app-web.jar
...@@ -3,11 +3,9 @@ services: ...@@ -3,11 +3,9 @@ services:
ibzou-app-web: ibzou-app-web:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzou-app-web:latest image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzou-app-web:latest
ports: ports:
- "30001:30001" - "8080:8080"
networks: networks:
- agent_network - agent_network
environment:
SPRING_CLOUD_NACOS_DISCOVERY_IP: 172.16.180.237
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
......
...@@ -31,7 +31,6 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -31,7 +31,6 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
private AuthenticationEntryPoint unauthorizedHandler; private AuthenticationEntryPoint unauthorizedHandler;
@Autowired @Autowired
@Qualifier("IBZUAAUserService")
private AuthenticationUserService userDetailsService; private AuthenticationUserService userDetailsService;
/** /**
......
...@@ -27,6 +27,7 @@ import java.util.List; ...@@ -27,6 +27,7 @@ import java.util.List;
@MapperScan("cn.ibizlab.*.mapper") @MapperScan("cn.ibizlab.*.mapper")
@SpringBootApplication(exclude = { @SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration.class,
}) })
public class webApplication extends WebMvcConfigurerAdapter{ public class webApplication extends WebMvcConfigurerAdapter{
......
server: server:
port: 30001 port: 8080
\ No newline at end of file \ No newline at end of file
server: server:
port: 30001 port: 8080
#zuul网关路由设置 #zuul网关路由设置
zuul: zuul:
...@@ -16,9 +16,9 @@ zuul: ...@@ -16,9 +16,9 @@ zuul:
path: /ibzorganizations/** path: /ibzorganizations/**
serviceId: ibzou-api serviceId: ibzou-api
stripPrefix: false stripPrefix: false
wfcore: loginv7:
path: /wfcore/** path: /v7/login
serviceId: ibzwf-api serviceId: ibzuaa-api
stripPrefix: true stripPrefix: false
sensitive-headers: sensitive-headers:
- Cookie,Set-Cookie,Authorization - Cookie,Set-Cookie,Authorization
...@@ -15,8 +15,10 @@ import java.util.List; ...@@ -15,8 +15,10 @@ import java.util.List;
@EnableDiscoveryClient @EnableDiscoveryClient
@Configuration @Configuration
@EnableTransactionManagement @EnableTransactionManagement
@SpringBootApplication
@EnableFeignClients(basePackages = {"cn.ibizlab" }) @EnableFeignClients(basePackages = {"cn.ibizlab" })
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration.class,
})
public class DevBootApplication extends WebMvcConfigurerAdapter{ public class DevBootApplication extends WebMvcConfigurerAdapter{
public static void main(String[] args) { public static void main(String[] args) {
......
server: server:
port: 8080 port: 40001
#zuul网关路由设置
zuul:
routes:
loginv7:
path: /v7/login
serviceId: ibzuaa-api
stripPrefix: false
sensitive-headers:
- Cookie,Set-Cookie,Authorization
...@@ -3,27 +3,6 @@ ...@@ -3,27 +3,6 @@
], ],
"predefineddatarange":[{"id":"ALL","name":"全部数据"},{"id":"CURORG","name":"当前单位"},{"id":"PORG","name":"上级单位"},{"id":"SORG","name":"下级单位"},{"id":"CURORGDEPT","name":"当前部门"},{"id":"PORGDEPT","name":"上级部门"},{"id":"SORGDEPT","name":"下级部门"}], "predefineddatarange":[{"id":"ALL","name":"全部数据"},{"id":"CURORG","name":"当前单位"},{"id":"PORG","name":"上级单位"},{"id":"SORG","name":"下级单位"},{"id":"CURORGDEPT","name":"当前部门"},{"id":"PORGDEPT","name":"上级部门"},{"id":"SORGDEPT","name":"下级部门"}],
"entities":[ "entities":[
{
"dename":"IBZDepartment",
"delogicname":"部门",
"sysmoudle":{"id":"OU","name":"ou"},
"dedataset":[{"id":"CurDept" , "name":"CurDept"},{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" }]
}
, {
"dename":"IBZEmployee",
"delogicname":"人员",
"sysmoudle":{"id":"OU","name":"ou"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"InitPwd" , "name":"初始化密码" , "type":"USERCUSTOM" },{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" }]
}
, {
"dename":"IBZOrganization",
"delogicname":"单位机构",
"sysmoudle":{"id":"OU","name":"ou"},
"dedataset":[{"id":"SelectSOrg" , "name":"查询下级单位"},{"id":"SelectPOrg" , "name":"查询上级单位"},{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" }]
}
] ]
} }
...@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \ ...@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \
sleep ${IBZ_SLEEP} && \ sleep ${IBZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzou-provider-api.jar java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzou-provider-api.jar
EXPOSE 8081 EXPOSE 40001
ADD ibzou-provider-api.jar /ibzou-provider-api.jar ADD ibzou-provider-api.jar /ibzou-provider-api.jar
...@@ -3,9 +3,11 @@ services: ...@@ -3,9 +3,11 @@ services:
ibzou-provider-api: ibzou-provider-api:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzou-provider-api:latest image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzou-provider-api:latest
ports: ports:
- "8081:8081" - "40001:40001"
networks: networks:
- agent_network - agent_network
environment:
SPRING_CLOUD_NACOS_DISCOVERY_IP: 172.16.180.237
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
......
...@@ -31,7 +31,6 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -31,7 +31,6 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
private AuthenticationEntryPoint unauthorizedHandler; private AuthenticationEntryPoint unauthorizedHandler;
@Autowired @Autowired
@Qualifier("IBZUAAUserService")
private AuthenticationUserService userDetailsService; private AuthenticationUserService userDetailsService;
/** /**
......
...@@ -23,6 +23,7 @@ import java.util.List; ...@@ -23,6 +23,7 @@ import java.util.List;
@MapperScan("cn.ibizlab.*.mapper") @MapperScan("cn.ibizlab.*.mapper")
@SpringBootApplication(exclude = { @SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration.class,
}) })
@EnableFeignClients(basePackages = {"cn.ibizlab" }) @EnableFeignClients(basePackages = {"cn.ibizlab" })
public class ibzouapiApplication extends WebMvcConfigurerAdapter{ public class ibzouapiApplication extends WebMvcConfigurerAdapter{
......
server: server:
port: 8081 port: 40001
\ No newline at end of file \ No newline at end of file
...@@ -32,7 +32,7 @@ public class PermissionSyncJob implements ApplicationRunner { ...@@ -32,7 +32,7 @@ public class PermissionSyncJob implements ApplicationRunner {
@Value("${ibiz.enablePermissionValid:false}") @Value("${ibiz.enablePermissionValid:false}")
boolean enablePermissionValid; //是否开启权限校验 boolean enablePermissionValid; //是否开启权限校验
@Value("${ibiz.systemid:110B1A3E-4944-47C8-B4C4-EC15FB8982F3}") @Value("${ibiz.systemid:ibzou}")
private String systemId; private String systemId;
@Override @Override
......
...@@ -15,9 +15,11 @@ import org.springframework.security.core.userdetails.UserDetails; ...@@ -15,9 +15,11 @@ import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@RestController @RestController
@RequestMapping("/") @RequestMapping("/")
@ConditionalOnProperty( name = "ibiz.enablePermissionValid", havingValue = "false")
public class AuthenticationController public class AuthenticationController
{ {
...@@ -28,7 +30,6 @@ public class AuthenticationController ...@@ -28,7 +30,6 @@ public class AuthenticationController
private AuthTokenUtil jwtTokenUtil; private AuthTokenUtil jwtTokenUtil;
@Autowired @Autowired
@Qualifier("IBZUAAUserService")
private AuthenticationUserService userDetailsService; private AuthenticationUserService userDetailsService;
@PostMapping(value = "${ibiz.auth.path:v7/login}") @PostMapping(value = "${ibiz.auth.path:v7/login}")
......
...@@ -12,6 +12,7 @@ import cn.ibizlab.util.filter.QueryBuildContext; ...@@ -12,6 +12,7 @@ import cn.ibizlab.util.filter.QueryBuildContext;
import cn.ibizlab.util.filter.QueryWrapperContext; import cn.ibizlab.util.filter.QueryWrapperContext;
import cn.ibizlab.util.helper.DEFieldCacheMap; import cn.ibizlab.util.helper.DEFieldCacheMap;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.BasicQuery; import org.springframework.data.mongodb.core.query.BasicQuery;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
...@@ -48,6 +49,7 @@ public class AuthPermissionEvaluator implements PermissionEvaluator { ...@@ -48,6 +49,7 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
private String keyFieldTag="keyfield"; private String keyFieldTag="keyfield";
@Resource @Resource
@Lazy
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
/** /**
...@@ -115,8 +117,6 @@ public class AuthPermissionEvaluator implements PermissionEvaluator { ...@@ -115,8 +117,6 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
if(!validDataSetHasPermission(permissionList,entityName,dataSetName)){ if(!validDataSetHasPermission(permissionList,entityName,dataSetName)){
return false; return false;
} }
//拼接权限条件
deDataSetFillPermissionSQLRouter(deStorageMode, searchContext, entity , dataSetName , permissionList);
} }
return true; return true;
} }
...@@ -344,80 +344,6 @@ public class AuthPermissionEvaluator implements PermissionEvaluator { ...@@ -344,80 +344,6 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
} }
} }
/**
* 根据实体存储类型,拼接权限条件
* @param deStorageMode
* @param searchContext
* @param entity
* @param dataSetName
* @param permissionList
*/
private void deDataSetFillPermissionSQLRouter(String deStorageMode , Object searchContext, EntityBase entity ,String dataSetName ,JSONObject permissionList){
//检查是否有数据权限[单行删除]
if(deStorageMode.equalsIgnoreCase("sql")){
sqlPermissionBuilder(searchContext, entity , dataSetName, permissionList);
}
else if(deStorageMode.equalsIgnoreCase("nosql")){
noSqlPermissionBuilder(searchContext, entity , dataSetName, permissionList);
}
else if(deStorageMode.equalsIgnoreCase("serviceapi")){
}
else {
throw new RuntimeException(String.format("未能识别[%s]实体对应存储模式[%s]",entity.getClass().getSimpleName(),deStorageMode));
}
}
/**
* 为NoSQL存储模式的表格查询填充权限条件
* @param searchContext
* @param entity
* @param dataSetName
* @param permissionList
*/
private void noSqlPermissionBuilder(Object searchContext, EntityBase entity, String dataSetName, JSONObject permissionList) {
if(searchContext instanceof QueryBuildContext){
//获取权限表达式[全部数据、本单位、本部门等]
String entityName=entity.getClass().getSimpleName();
JSONObject entityObj=permissionList.getJSONObject(entityName);
JSONObject permissionType=entityObj.getJSONObject(DataSetTag);
JSONArray dataRange=permissionType.getJSONArray(dataSetName);
if(dataRange.size()==0)
return ;
//根据权限表达式生成查询条件,并将查询条件设置到SearchContext中
fillNoSqlPermissionCond(dataRange,entity,((QueryBuildContext) searchContext).getSelectCond());
}
}
/**
* 为SQL存储模式的表格查询填充权限条件
* @param searchContext
* @param entity
* @param dataSetName
* @param permissionList
*/
private void sqlPermissionBuilder(Object searchContext, EntityBase entity, String dataSetName, JSONObject permissionList){
//获取权限表达式[全部数据、本单位、本部门等]
String entityName=entity.getClass().getSimpleName();
JSONObject entityObj=permissionList.getJSONObject(entityName);//获取实体
JSONObject permissionType=entityObj.getJSONObject(DataSetTag);
JSONArray dataRange=permissionType.getJSONArray(dataSetName);//获取实体数据集
if(dataRange.size()==0)
return ;
//根据权限条件获取SQL
String permissionSQL=getPermissionSQL(entity,dataRange);
//将SQL拼接到SearchContext中
if(searchContext instanceof QueryWrapperContext){
QueryWrapperContext queryWrapperContext = (QueryWrapperContext) searchContext;
QueryWrapper queryWrapper = queryWrapperContext.getSelectCond();
queryWrapper.apply(permissionSQL);
}
}
/** /**
* 为NoSQL存储模式的表格查询填充权限条件 * 为NoSQL存储模式的表格查询填充权限条件
......
...@@ -27,7 +27,7 @@ public class AuthorizationTokenFilter extends OncePerRequestFilter { ...@@ -27,7 +27,7 @@ public class AuthorizationTokenFilter extends OncePerRequestFilter {
private final AuthTokenUtil authTokenUtil; private final AuthTokenUtil authTokenUtil;
private final String tokenHeader; private final String tokenHeader;
public AuthorizationTokenFilter(@Qualifier("IBZUAAUserService") AuthenticationUserService userDetailsService, AuthTokenUtil authTokenUtil, @Value("${ibiz.jwt.header:Authorization}") String tokenHeader) { public AuthorizationTokenFilter(AuthenticationUserService userDetailsService, AuthTokenUtil authTokenUtil, @Value("${ibiz.jwt.header:Authorization}") String tokenHeader) {
this.userDetailsService = userDetailsService; this.userDetailsService = userDetailsService;
this.authTokenUtil = authTokenUtil; this.authTokenUtil = authTokenUtil;
this.tokenHeader = tokenHeader; this.tokenHeader = tokenHeader;
......
...@@ -12,11 +12,13 @@ import org.springframework.context.annotation.Primary; ...@@ -12,11 +12,13 @@ import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
/** /**
* 实体[IBZUSER] 服务对象接口实现 * 实体[IBZUSER] 服务对象接口实现
*/ */
@Service("IBZUAAUserService") @Service("IBZUAAUserService")
@ConditionalOnExpression("${ibiz.enablePermissionValid:false}||'${ibiz.auth.service:SimpleUserService}'.equals('IBZUAAUserService')")
public class IBZUAAUserService implements AuthenticationUserService{ public class IBZUAAUserService implements AuthenticationUserService{
@Autowired @Autowired
......
...@@ -13,11 +13,13 @@ import cn.ibizlab.util.mapper.IBZUSERMapper; ...@@ -13,11 +13,13 @@ import cn.ibizlab.util.mapper.IBZUSERMapper;
import cn.ibizlab.util.domain.IBZUSER; import cn.ibizlab.util.domain.IBZUSER;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
/** /**
* 实体[IBZUSER] 服务对象接口实现 * 实体[IBZUSER] 服务对象接口实现
*/ */
@Service("IBZUSERService") @Service("IBZUSERService")
@ConditionalOnExpression("(!${ibiz.enablePermissionValid:false})&&'${ibiz.auth.service:SimpleUserService}'.equals('IBZUSERService')")
public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> implements IBZUSERService,AuthenticationUserService{ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> implements IBZUSERService,AuthenticationUserService{
@Value("${ibiz.auth.pwencrymode:0}") @Value("${ibiz.auth.pwencrymode:0}")
......
...@@ -11,12 +11,14 @@ import org.springframework.util.StringUtils; ...@@ -11,12 +11,14 @@ import org.springframework.util.StringUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
/** /**
* 实体[IBZUSER] 服务对象接口实现 * 实体[IBZUSER] 服务对象接口实现
*/ */
@Primary @Primary
@Service("SimpleUserService") @Service("SimpleUserService")
@ConditionalOnExpression("(!${ibiz.enablePermissionValid:false})&&'${ibiz.auth.service:SimpleUserService}'.equals('SimpleUserService')")
public class SimpleUserService implements AuthenticationUserService{ public class SimpleUserService implements AuthenticationUserService{
@Override @Override
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册