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

ibiz4j 部署微服务接口

上级 606c7270
...@@ -31,5 +31,9 @@ zuul: ...@@ -31,5 +31,9 @@ zuul:
path: /v7/login path: /v7/login
serviceId: ibzuaa-api serviceId: ibzuaa-api
stripPrefix: false stripPrefix: false
oucore:
path: /ibzorganizations/**
serviceId: ibzou-api
stripPrefix: false
sensitive-headers: sensitive-headers:
- Cookie,Set-Cookie,Authorization - Cookie,Set-Cookie,Authorization
...@@ -8,5 +8,9 @@ zuul: ...@@ -8,5 +8,9 @@ zuul:
path: /v7/login path: /v7/login
serviceId: ibzuaa-api serviceId: ibzuaa-api
stripPrefix: false stripPrefix: false
oucore:
path: /ibzorganizations/**
serviceId: ibzou-api
stripPrefix: false
sensitive-headers: sensitive-headers:
- Cookie,Set-Cookie,Authorization - Cookie,Set-Cookie,Authorization
...@@ -52,6 +52,7 @@ public interface IWFGroupService extends IService<WFGroup>{ ...@@ -52,6 +52,7 @@ public interface IWFGroupService extends IService<WFGroup>{
*/ */
boolean execute(String sql, Map param); boolean execute(String sql, Map param);
} }
...@@ -57,6 +57,7 @@ public interface IWFMemberService extends IService<WFMember>{ ...@@ -57,6 +57,7 @@ public interface IWFMemberService extends IService<WFMember>{
*/ */
boolean execute(String sql, Map param); boolean execute(String sql, Map param);
} }
...@@ -52,6 +52,7 @@ public interface IWFProcessDefinitionService extends IService<WFProcessDefinitio ...@@ -52,6 +52,7 @@ public interface IWFProcessDefinitionService extends IService<WFProcessDefinitio
*/ */
boolean execute(String sql, Map param); boolean execute(String sql, Map param);
} }
...@@ -52,6 +52,7 @@ public interface IWFSystemService extends IService<WFSystem>{ ...@@ -52,6 +52,7 @@ public interface IWFSystemService extends IService<WFSystem>{
*/ */
boolean execute(String sql, Map param); boolean execute(String sql, Map param);
} }
...@@ -52,6 +52,7 @@ public interface IWFUserService extends IService<WFUser>{ ...@@ -52,6 +52,7 @@ public interface IWFUserService extends IService<WFUser>{
*/ */
boolean execute(String sql, Map param); boolean execute(String sql, Map param);
} }
...@@ -186,6 +186,7 @@ public class WFGroupServiceImpl extends ServiceImpl<WFGroupMapper, WFGroup> impl ...@@ -186,6 +186,7 @@ public class WFGroupServiceImpl extends ServiceImpl<WFGroupMapper, WFGroup> impl
return true; return true;
} }
} }
...@@ -267,6 +267,7 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i ...@@ -267,6 +267,7 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i
return true; return true;
} }
} }
...@@ -179,6 +179,7 @@ public class WFProcessDefinitionServiceImpl extends ServiceImpl<WFProcessDefinit ...@@ -179,6 +179,7 @@ public class WFProcessDefinitionServiceImpl extends ServiceImpl<WFProcessDefinit
return true; return true;
} }
} }
...@@ -179,6 +179,7 @@ public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> i ...@@ -179,6 +179,7 @@ public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> i
return true; return true;
} }
} }
...@@ -182,6 +182,7 @@ public class WFUserServiceImpl extends ServiceImpl<WFUserMapper, WFUser> impleme ...@@ -182,6 +182,7 @@ public class WFUserServiceImpl extends ServiceImpl<WFUserMapper, WFUser> impleme
return true; return true;
} }
} }
{ {
"systemid":"ibzwf",
"unires":[ "unires":[
], ],
"entities":[ "entities":[
......
...@@ -22,6 +22,7 @@ import org.springframework.data.domain.Pageable; ...@@ -22,6 +22,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
...@@ -39,14 +40,12 @@ import cn.ibizlab.core.workflow.filter.WFGroupSearchContext; ...@@ -39,14 +40,12 @@ import cn.ibizlab.core.workflow.filter.WFGroupSearchContext;
public class WFGroupResource { public class WFGroupResource {
@Autowired @Autowired
private IWFGroupService wfgroupService; public IWFGroupService wfgroupService;
@Autowired @Autowired
@Lazy @Lazy
public WFGroupMapping wfgroupMapping; public WFGroupMapping wfgroupMapping;
public WFGroupDTO permissionDTO=new WFGroupDTO();
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Save-all')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Save-all')")
@ApiOperation(value = "Save", tags = {"WFGroup" }, notes = "Save") @ApiOperation(value = "Save", tags = {"WFGroup" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/save") @RequestMapping(method = RequestMethod.POST, value = "/wfgroups/save")
...@@ -54,7 +53,7 @@ public class WFGroupResource { ...@@ -54,7 +53,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(wfgroupService.save(wfgroupMapping.toDomain(wfgroupdto))); return ResponseEntity.status(HttpStatus.OK).body(wfgroupService.save(wfgroupMapping.toDomain(wfgroupdto)));
} }
@PreAuthorize("hasPermission('Save',{'Sql',this.wfgroupMapping,#wfgroupdtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Save-all')")
@ApiOperation(value = "SaveBatch", tags = {"WFGroup" }, notes = "SaveBatch") @ApiOperation(value = "SaveBatch", tags = {"WFGroup" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/savebatch") @RequestMapping(method = RequestMethod.POST, value = "/wfgroups/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) { public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) {
...@@ -68,13 +67,13 @@ public class WFGroupResource { ...@@ -68,13 +67,13 @@ public class WFGroupResource {
@Transactional @Transactional
public ResponseEntity<WFGroupDTO> update(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody WFGroupDTO wfgroupdto) { public ResponseEntity<WFGroupDTO> update(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody WFGroupDTO wfgroupdto) {
WFGroup domain = wfgroupMapping.toDomain(wfgroupdto); WFGroup domain = wfgroupMapping.toDomain(wfgroupdto);
domain.setId(wfgroup_id); domain .setId(wfgroup_id);
wfgroupService.update(domain); wfgroupService.update(domain );
WFGroupDTO dto = wfgroupMapping.toDto(domain); WFGroupDTO dto = wfgroupMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasPermission('Update',{'Sql',this.wfgroupMapping,#wfgroupdtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Update-all')")
@ApiOperation(value = "UpdateBatch", tags = {"WFGroup" }, notes = "UpdateBatch") @ApiOperation(value = "UpdateBatch", tags = {"WFGroup" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfgroups/batch") @RequestMapping(method = RequestMethod.PUT, value = "/wfgroups/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) { public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) {
...@@ -82,14 +81,12 @@ public class WFGroupResource { ...@@ -82,14 +81,12 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"WFGroup" }, notes = "GetDraft") @ApiOperation(value = "GetDraft", tags = {"WFGroup" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfgroups/getdraft") @RequestMapping(method = RequestMethod.GET, value = "/wfgroups/getdraft")
public ResponseEntity<WFGroupDTO> getDraft() { public ResponseEntity<WFGroupDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(wfgroupMapping.toDto(wfgroupService.getDraft(new WFGroup()))); return ResponseEntity.status(HttpStatus.OK).body(wfgroupMapping.toDto(wfgroupService.getDraft(new WFGroup())));
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"WFGroup" }, notes = "CheckKey") @ApiOperation(value = "CheckKey", tags = {"WFGroup" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/checkkey") @RequestMapping(method = RequestMethod.POST, value = "/wfgroups/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFGroupDTO wfgroupdto) { public ResponseEntity<Boolean> checkKey(@RequestBody WFGroupDTO wfgroupdto) {
...@@ -107,7 +104,7 @@ public class WFGroupResource { ...@@ -107,7 +104,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasPermission('Create',{'Sql',this.wfgroupMapping,#wfgroupdtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Create-all')")
@ApiOperation(value = "createBatch", tags = {"WFGroup" }, notes = "createBatch") @ApiOperation(value = "createBatch", tags = {"WFGroup" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/batch") @RequestMapping(method = RequestMethod.POST, value = "/wfgroups/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) { public ResponseEntity<Boolean> createBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) {
...@@ -123,7 +120,7 @@ public class WFGroupResource { ...@@ -123,7 +120,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(wfgroupService.remove(wfgroup_id)); return ResponseEntity.status(HttpStatus.OK).body(wfgroupService.remove(wfgroup_id));
} }
@PreAuthorize("hasPermission('Remove',{'Sql',this.wfgroupMapping,this.permissionDTO,#ids})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Remove-all')")
@ApiOperation(value = "RemoveBatch", tags = {"WFGroup" }, notes = "RemoveBatch") @ApiOperation(value = "RemoveBatch", tags = {"WFGroup" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfgroups/batch") @RequestMapping(method = RequestMethod.DELETE, value = "/wfgroups/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) { public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
...@@ -162,3 +159,4 @@ public class WFGroupResource { ...@@ -162,3 +159,4 @@ public class WFGroupResource {
.body(new PageImpl(wfgroupMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements())); .body(new PageImpl(wfgroupMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
} }
} }
...@@ -22,6 +22,7 @@ import org.springframework.data.domain.Pageable; ...@@ -22,6 +22,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
...@@ -39,14 +40,12 @@ import cn.ibizlab.core.workflow.filter.WFProcessDefinitionSearchContext; ...@@ -39,14 +40,12 @@ import cn.ibizlab.core.workflow.filter.WFProcessDefinitionSearchContext;
public class WFProcessDefinitionResource { public class WFProcessDefinitionResource {
@Autowired @Autowired
private IWFProcessDefinitionService wfprocessdefinitionService; public IWFProcessDefinitionService wfprocessdefinitionService;
@Autowired @Autowired
@Lazy @Lazy
public WFProcessDefinitionMapping wfprocessdefinitionMapping; public WFProcessDefinitionMapping wfprocessdefinitionMapping;
public WFProcessDefinitionDTO permissionDTO=new WFProcessDefinitionDTO();
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Save-all')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Save-all')")
@ApiOperation(value = "Save", tags = {"WFProcessDefinition" }, notes = "Save") @ApiOperation(value = "Save", tags = {"WFProcessDefinition" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/save") @RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/save")
...@@ -54,7 +53,7 @@ public class WFProcessDefinitionResource { ...@@ -54,7 +53,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionService.save(wfprocessdefinitionMapping.toDomain(wfprocessdefinitiondto))); return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionService.save(wfprocessdefinitionMapping.toDomain(wfprocessdefinitiondto)));
} }
@PreAuthorize("hasPermission('Save',{'Sql',this.wfprocessdefinitionMapping,#wfprocessdefinitiondtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Save-all')")
@ApiOperation(value = "SaveBatch", tags = {"WFProcessDefinition" }, notes = "SaveBatch") @ApiOperation(value = "SaveBatch", tags = {"WFProcessDefinition" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/savebatch") @RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) { public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) {
...@@ -68,13 +67,13 @@ public class WFProcessDefinitionResource { ...@@ -68,13 +67,13 @@ public class WFProcessDefinitionResource {
@Transactional @Transactional
public ResponseEntity<WFProcessDefinitionDTO> update(@PathVariable("wfprocessdefinition_id") String wfprocessdefinition_id, @RequestBody WFProcessDefinitionDTO wfprocessdefinitiondto) { public ResponseEntity<WFProcessDefinitionDTO> update(@PathVariable("wfprocessdefinition_id") String wfprocessdefinition_id, @RequestBody WFProcessDefinitionDTO wfprocessdefinitiondto) {
WFProcessDefinition domain = wfprocessdefinitionMapping.toDomain(wfprocessdefinitiondto); WFProcessDefinition domain = wfprocessdefinitionMapping.toDomain(wfprocessdefinitiondto);
domain.setDefinitionkey(wfprocessdefinition_id); domain .setDefinitionkey(wfprocessdefinition_id);
wfprocessdefinitionService.update(domain); wfprocessdefinitionService.update(domain );
WFProcessDefinitionDTO dto = wfprocessdefinitionMapping.toDto(domain); WFProcessDefinitionDTO dto = wfprocessdefinitionMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasPermission('Update',{'Sql',this.wfprocessdefinitionMapping,#wfprocessdefinitiondtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Update-all')")
@ApiOperation(value = "UpdateBatch", tags = {"WFProcessDefinition" }, notes = "UpdateBatch") @ApiOperation(value = "UpdateBatch", tags = {"WFProcessDefinition" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfprocessdefinitions/batch") @RequestMapping(method = RequestMethod.PUT, value = "/wfprocessdefinitions/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) { public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) {
...@@ -91,14 +90,12 @@ public class WFProcessDefinitionResource { ...@@ -91,14 +90,12 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"WFProcessDefinition" }, notes = "CheckKey") @ApiOperation(value = "CheckKey", tags = {"WFProcessDefinition" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/checkkey") @RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFProcessDefinitionDTO wfprocessdefinitiondto) { public ResponseEntity<Boolean> checkKey(@RequestBody WFProcessDefinitionDTO wfprocessdefinitiondto) {
return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionService.checkKey(wfprocessdefinitionMapping.toDomain(wfprocessdefinitiondto))); return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionService.checkKey(wfprocessdefinitionMapping.toDomain(wfprocessdefinitiondto)));
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"WFProcessDefinition" }, notes = "GetDraft") @ApiOperation(value = "GetDraft", tags = {"WFProcessDefinition" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfprocessdefinitions/getdraft") @RequestMapping(method = RequestMethod.GET, value = "/wfprocessdefinitions/getdraft")
public ResponseEntity<WFProcessDefinitionDTO> getDraft() { public ResponseEntity<WFProcessDefinitionDTO> getDraft() {
...@@ -116,7 +113,7 @@ public class WFProcessDefinitionResource { ...@@ -116,7 +113,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasPermission('Create',{'Sql',this.wfprocessdefinitionMapping,#wfprocessdefinitiondtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Create-all')")
@ApiOperation(value = "createBatch", tags = {"WFProcessDefinition" }, notes = "createBatch") @ApiOperation(value = "createBatch", tags = {"WFProcessDefinition" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/batch") @RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) { public ResponseEntity<Boolean> createBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) {
...@@ -132,7 +129,7 @@ public class WFProcessDefinitionResource { ...@@ -132,7 +129,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionService.remove(wfprocessdefinition_id)); return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionService.remove(wfprocessdefinition_id));
} }
@PreAuthorize("hasPermission('Remove',{'Sql',this.wfprocessdefinitionMapping,this.permissionDTO,#ids})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Remove-all')")
@ApiOperation(value = "RemoveBatch", tags = {"WFProcessDefinition" }, notes = "RemoveBatch") @ApiOperation(value = "RemoveBatch", tags = {"WFProcessDefinition" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfprocessdefinitions/batch") @RequestMapping(method = RequestMethod.DELETE, value = "/wfprocessdefinitions/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) { public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
...@@ -162,3 +159,4 @@ public class WFProcessDefinitionResource { ...@@ -162,3 +159,4 @@ public class WFProcessDefinitionResource {
.body(new PageImpl(wfprocessdefinitionMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements())); .body(new PageImpl(wfprocessdefinitionMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
} }
} }
...@@ -22,6 +22,7 @@ import org.springframework.data.domain.Pageable; ...@@ -22,6 +22,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
...@@ -39,27 +40,23 @@ import cn.ibizlab.core.workflow.filter.WFREModelSearchContext; ...@@ -39,27 +40,23 @@ import cn.ibizlab.core.workflow.filter.WFREModelSearchContext;
public class WFREModelResource { public class WFREModelResource {
@Autowired @Autowired
private IWFREModelService wfremodelService; public IWFREModelService wfremodelService;
@Autowired @Autowired
@Lazy @Lazy
public WFREModelMapping wfremodelMapping; public WFREModelMapping wfremodelMapping;
public WFREModelDTO permissionDTO=new WFREModelDTO();
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Update-all')")
@ApiOperation(value = "Update", tags = {"WFREModel" }, notes = "Update") @ApiOperation(value = "Update", tags = {"WFREModel" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/wfremodels/{wfremodel_id}") @RequestMapping(method = RequestMethod.PUT, value = "/wfremodels/{wfremodel_id}")
@Transactional @Transactional
public ResponseEntity<WFREModelDTO> update(@PathVariable("wfremodel_id") String wfremodel_id, @RequestBody WFREModelDTO wfremodeldto) { public ResponseEntity<WFREModelDTO> update(@PathVariable("wfremodel_id") String wfremodel_id, @RequestBody WFREModelDTO wfremodeldto) {
WFREModel domain = wfremodelMapping.toDomain(wfremodeldto); WFREModel domain = wfremodelMapping.toDomain(wfremodeldto);
domain.setId(wfremodel_id); domain .setId(wfremodel_id);
wfremodelService.update(domain); wfremodelService.update(domain );
WFREModelDTO dto = wfremodelMapping.toDto(domain); WFREModelDTO dto = wfremodelMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasPermission('Update',{'None',this.wfremodelMapping,#wfremodeldtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFREModel" }, notes = "UpdateBatch") @ApiOperation(value = "UpdateBatch", tags = {"WFREModel" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfremodels/batch") @RequestMapping(method = RequestMethod.PUT, value = "/wfremodels/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) { public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
...@@ -67,14 +64,12 @@ public class WFREModelResource { ...@@ -67,14 +64,12 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Save-all')")
@ApiOperation(value = "Save", tags = {"WFREModel" }, notes = "Save") @ApiOperation(value = "Save", tags = {"WFREModel" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/save") @RequestMapping(method = RequestMethod.POST, value = "/wfremodels/save")
public ResponseEntity<Boolean> save(@RequestBody WFREModelDTO wfremodeldto) { public ResponseEntity<Boolean> save(@RequestBody WFREModelDTO wfremodeldto) {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.save(wfremodelMapping.toDomain(wfremodeldto))); return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.save(wfremodelMapping.toDomain(wfremodeldto)));
} }
@PreAuthorize("hasPermission('Save',{'None',this.wfremodelMapping,#wfremodeldtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFREModel" }, notes = "SaveBatch") @ApiOperation(value = "SaveBatch", tags = {"WFREModel" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/savebatch") @RequestMapping(method = RequestMethod.POST, value = "/wfremodels/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) { public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
...@@ -82,7 +77,6 @@ public class WFREModelResource { ...@@ -82,7 +77,6 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Get-all')")
@ApiOperation(value = "Get", tags = {"WFREModel" }, notes = "Get") @ApiOperation(value = "Get", tags = {"WFREModel" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/wfremodels/{wfremodel_id}") @RequestMapping(method = RequestMethod.GET, value = "/wfremodels/{wfremodel_id}")
public ResponseEntity<WFREModelDTO> get(@PathVariable("wfremodel_id") String wfremodel_id) { public ResponseEntity<WFREModelDTO> get(@PathVariable("wfremodel_id") String wfremodel_id) {
...@@ -91,7 +85,6 @@ public class WFREModelResource { ...@@ -91,7 +85,6 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Create-all')")
@ApiOperation(value = "Create", tags = {"WFREModel" }, notes = "Create") @ApiOperation(value = "Create", tags = {"WFREModel" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels") @RequestMapping(method = RequestMethod.POST, value = "/wfremodels")
@Transactional @Transactional
...@@ -102,7 +95,6 @@ public class WFREModelResource { ...@@ -102,7 +95,6 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasPermission('Create',{'None',this.wfremodelMapping,#wfremodeldtos})")
@ApiOperation(value = "createBatch", tags = {"WFREModel" }, notes = "createBatch") @ApiOperation(value = "createBatch", tags = {"WFREModel" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/batch") @RequestMapping(method = RequestMethod.POST, value = "/wfremodels/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) { public ResponseEntity<Boolean> createBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
...@@ -110,14 +102,12 @@ public class WFREModelResource { ...@@ -110,14 +102,12 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"WFREModel" }, notes = "CheckKey") @ApiOperation(value = "CheckKey", tags = {"WFREModel" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/checkkey") @RequestMapping(method = RequestMethod.POST, value = "/wfremodels/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFREModelDTO wfremodeldto) { public ResponseEntity<Boolean> checkKey(@RequestBody WFREModelDTO wfremodeldto) {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.checkKey(wfremodelMapping.toDomain(wfremodeldto))); return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.checkKey(wfremodelMapping.toDomain(wfremodeldto)));
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Remove-all')")
@ApiOperation(value = "Remove", tags = {"WFREModel" }, notes = "Remove") @ApiOperation(value = "Remove", tags = {"WFREModel" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfremodels/{wfremodel_id}") @RequestMapping(method = RequestMethod.DELETE, value = "/wfremodels/{wfremodel_id}")
@Transactional @Transactional
...@@ -125,7 +115,6 @@ public class WFREModelResource { ...@@ -125,7 +115,6 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.remove(wfremodel_id)); return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.remove(wfremodel_id));
} }
@PreAuthorize("hasPermission('Remove',{'None',this.wfremodelMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFREModel" }, notes = "RemoveBatch") @ApiOperation(value = "RemoveBatch", tags = {"WFREModel" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfremodels/batch") @RequestMapping(method = RequestMethod.DELETE, value = "/wfremodels/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) { public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
...@@ -133,14 +122,12 @@ public class WFREModelResource { ...@@ -133,14 +122,12 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"WFREModel" }, notes = "GetDraft") @ApiOperation(value = "GetDraft", tags = {"WFREModel" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfremodels/getdraft") @RequestMapping(method = RequestMethod.GET, value = "/wfremodels/getdraft")
public ResponseEntity<WFREModelDTO> getDraft() { public ResponseEntity<WFREModelDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelMapping.toDto(wfremodelService.getDraft(new WFREModel()))); return ResponseEntity.status(HttpStatus.OK).body(wfremodelMapping.toDto(wfremodelService.getDraft(new WFREModel())));
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Default-all')")
@ApiOperation(value = "fetchDEFAULT", tags = {"WFREModel" } ,notes = "fetchDEFAULT") @ApiOperation(value = "fetchDEFAULT", tags = {"WFREModel" } ,notes = "fetchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfremodels/fetchdefault") @RequestMapping(method= RequestMethod.GET , value="/wfremodels/fetchdefault")
public ResponseEntity<List<WFREModelDTO>> fetchDefault(WFREModelSearchContext context) { public ResponseEntity<List<WFREModelDTO>> fetchDefault(WFREModelSearchContext context) {
...@@ -153,7 +140,6 @@ public class WFREModelResource { ...@@ -153,7 +140,6 @@ public class WFREModelResource {
.body(list); .body(list);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Default-all')")
@ApiOperation(value = "searchDEFAULT", tags = {"WFREModel" } ,notes = "searchDEFAULT") @ApiOperation(value = "searchDEFAULT", tags = {"WFREModel" } ,notes = "searchDEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wfremodels/searchdefault") @RequestMapping(method= RequestMethod.POST , value="/wfremodels/searchdefault")
public ResponseEntity<Page<WFREModelDTO>> searchDefault(@RequestBody WFREModelSearchContext context) { public ResponseEntity<Page<WFREModelDTO>> searchDefault(@RequestBody WFREModelSearchContext context) {
...@@ -162,3 +148,4 @@ public class WFREModelResource { ...@@ -162,3 +148,4 @@ public class WFREModelResource {
.body(new PageImpl(wfremodelMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements())); .body(new PageImpl(wfremodelMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
} }
} }
...@@ -22,6 +22,7 @@ import org.springframework.data.domain.Pageable; ...@@ -22,6 +22,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
...@@ -39,14 +40,12 @@ import cn.ibizlab.core.workflow.filter.WFSystemSearchContext; ...@@ -39,14 +40,12 @@ import cn.ibizlab.core.workflow.filter.WFSystemSearchContext;
public class WFSystemResource { public class WFSystemResource {
@Autowired @Autowired
private IWFSystemService wfsystemService; public IWFSystemService wfsystemService;
@Autowired @Autowired
@Lazy @Lazy
public WFSystemMapping wfsystemMapping; public WFSystemMapping wfsystemMapping;
public WFSystemDTO permissionDTO=new WFSystemDTO();
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Remove-all')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Remove-all')")
@ApiOperation(value = "Remove", tags = {"WFSystem" }, notes = "Remove") @ApiOperation(value = "Remove", tags = {"WFSystem" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfsystems/{wfsystem_id}") @RequestMapping(method = RequestMethod.DELETE, value = "/wfsystems/{wfsystem_id}")
...@@ -55,7 +54,7 @@ public class WFSystemResource { ...@@ -55,7 +54,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(wfsystemService.remove(wfsystem_id)); return ResponseEntity.status(HttpStatus.OK).body(wfsystemService.remove(wfsystem_id));
} }
@PreAuthorize("hasPermission('Remove',{'Sql',this.wfsystemMapping,this.permissionDTO,#ids})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Remove-all')")
@ApiOperation(value = "RemoveBatch", tags = {"WFSystem" }, notes = "RemoveBatch") @ApiOperation(value = "RemoveBatch", tags = {"WFSystem" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfsystems/batch") @RequestMapping(method = RequestMethod.DELETE, value = "/wfsystems/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) { public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
...@@ -69,13 +68,13 @@ public class WFSystemResource { ...@@ -69,13 +68,13 @@ public class WFSystemResource {
@Transactional @Transactional
public ResponseEntity<WFSystemDTO> update(@PathVariable("wfsystem_id") String wfsystem_id, @RequestBody WFSystemDTO wfsystemdto) { public ResponseEntity<WFSystemDTO> update(@PathVariable("wfsystem_id") String wfsystem_id, @RequestBody WFSystemDTO wfsystemdto) {
WFSystem domain = wfsystemMapping.toDomain(wfsystemdto); WFSystem domain = wfsystemMapping.toDomain(wfsystemdto);
domain.setPssystemid(wfsystem_id); domain .setPssystemid(wfsystem_id);
wfsystemService.update(domain); wfsystemService.update(domain );
WFSystemDTO dto = wfsystemMapping.toDto(domain); WFSystemDTO dto = wfsystemMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasPermission('Update',{'Sql',this.wfsystemMapping,#wfsystemdtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Update-all')")
@ApiOperation(value = "UpdateBatch", tags = {"WFSystem" }, notes = "UpdateBatch") @ApiOperation(value = "UpdateBatch", tags = {"WFSystem" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfsystems/batch") @RequestMapping(method = RequestMethod.PUT, value = "/wfsystems/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) { public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) {
...@@ -83,7 +82,6 @@ public class WFSystemResource { ...@@ -83,7 +82,6 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"WFSystem" }, notes = "GetDraft") @ApiOperation(value = "GetDraft", tags = {"WFSystem" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfsystems/getdraft") @RequestMapping(method = RequestMethod.GET, value = "/wfsystems/getdraft")
public ResponseEntity<WFSystemDTO> getDraft() { public ResponseEntity<WFSystemDTO> getDraft() {
...@@ -97,7 +95,7 @@ public class WFSystemResource { ...@@ -97,7 +95,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(wfsystemService.save(wfsystemMapping.toDomain(wfsystemdto))); return ResponseEntity.status(HttpStatus.OK).body(wfsystemService.save(wfsystemMapping.toDomain(wfsystemdto)));
} }
@PreAuthorize("hasPermission('Save',{'Sql',this.wfsystemMapping,#wfsystemdtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Save-all')")
@ApiOperation(value = "SaveBatch", tags = {"WFSystem" }, notes = "SaveBatch") @ApiOperation(value = "SaveBatch", tags = {"WFSystem" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfsystems/savebatch") @RequestMapping(method = RequestMethod.POST, value = "/wfsystems/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) { public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) {
...@@ -116,7 +114,7 @@ public class WFSystemResource { ...@@ -116,7 +114,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasPermission('Create',{'Sql',this.wfsystemMapping,#wfsystemdtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Create-all')")
@ApiOperation(value = "createBatch", tags = {"WFSystem" }, notes = "createBatch") @ApiOperation(value = "createBatch", tags = {"WFSystem" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfsystems/batch") @RequestMapping(method = RequestMethod.POST, value = "/wfsystems/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) { public ResponseEntity<Boolean> createBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) {
...@@ -124,7 +122,6 @@ public class WFSystemResource { ...@@ -124,7 +122,6 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"WFSystem" }, notes = "CheckKey") @ApiOperation(value = "CheckKey", tags = {"WFSystem" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfsystems/checkkey") @RequestMapping(method = RequestMethod.POST, value = "/wfsystems/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFSystemDTO wfsystemdto) { public ResponseEntity<Boolean> checkKey(@RequestBody WFSystemDTO wfsystemdto) {
...@@ -162,3 +159,4 @@ public class WFSystemResource { ...@@ -162,3 +159,4 @@ public class WFSystemResource {
.body(new PageImpl(wfsystemMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements())); .body(new PageImpl(wfsystemMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
} }
} }
...@@ -22,6 +22,7 @@ import org.springframework.data.domain.Pageable; ...@@ -22,6 +22,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
...@@ -39,14 +40,12 @@ import cn.ibizlab.core.workflow.filter.WFUserSearchContext; ...@@ -39,14 +40,12 @@ import cn.ibizlab.core.workflow.filter.WFUserSearchContext;
public class WFUserResource { public class WFUserResource {
@Autowired @Autowired
private IWFUserService wfuserService; public IWFUserService wfuserService;
@Autowired @Autowired
@Lazy @Lazy
public WFUserMapping wfuserMapping; public WFUserMapping wfuserMapping;
public WFUserDTO permissionDTO=new WFUserDTO();
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Remove-all')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Remove-all')")
@ApiOperation(value = "Remove", tags = {"WFUser" }, notes = "Remove") @ApiOperation(value = "Remove", tags = {"WFUser" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfusers/{wfuser_id}") @RequestMapping(method = RequestMethod.DELETE, value = "/wfusers/{wfuser_id}")
...@@ -55,7 +54,7 @@ public class WFUserResource { ...@@ -55,7 +54,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(wfuserService.remove(wfuser_id)); return ResponseEntity.status(HttpStatus.OK).body(wfuserService.remove(wfuser_id));
} }
@PreAuthorize("hasPermission('Remove',{'Sql',this.wfuserMapping,this.permissionDTO,#ids})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Remove-all')")
@ApiOperation(value = "RemoveBatch", tags = {"WFUser" }, notes = "RemoveBatch") @ApiOperation(value = "RemoveBatch", tags = {"WFUser" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfusers/batch") @RequestMapping(method = RequestMethod.DELETE, value = "/wfusers/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) { public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
...@@ -63,7 +62,6 @@ public class WFUserResource { ...@@ -63,7 +62,6 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"WFUser" }, notes = "GetDraft") @ApiOperation(value = "GetDraft", tags = {"WFUser" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfusers/getdraft") @RequestMapping(method = RequestMethod.GET, value = "/wfusers/getdraft")
public ResponseEntity<WFUserDTO> getDraft() { public ResponseEntity<WFUserDTO> getDraft() {
...@@ -77,7 +75,7 @@ public class WFUserResource { ...@@ -77,7 +75,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(wfuserService.save(wfuserMapping.toDomain(wfuserdto))); return ResponseEntity.status(HttpStatus.OK).body(wfuserService.save(wfuserMapping.toDomain(wfuserdto)));
} }
@PreAuthorize("hasPermission('Save',{'Sql',this.wfuserMapping,#wfuserdtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Save-all')")
@ApiOperation(value = "SaveBatch", tags = {"WFUser" }, notes = "SaveBatch") @ApiOperation(value = "SaveBatch", tags = {"WFUser" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/savebatch") @RequestMapping(method = RequestMethod.POST, value = "/wfusers/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFUserDTO> wfuserdtos) { public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFUserDTO> wfuserdtos) {
...@@ -91,13 +89,13 @@ public class WFUserResource { ...@@ -91,13 +89,13 @@ public class WFUserResource {
@Transactional @Transactional
public ResponseEntity<WFUserDTO> update(@PathVariable("wfuser_id") String wfuser_id, @RequestBody WFUserDTO wfuserdto) { public ResponseEntity<WFUserDTO> update(@PathVariable("wfuser_id") String wfuser_id, @RequestBody WFUserDTO wfuserdto) {
WFUser domain = wfuserMapping.toDomain(wfuserdto); WFUser domain = wfuserMapping.toDomain(wfuserdto);
domain.setId(wfuser_id); domain .setId(wfuser_id);
wfuserService.update(domain); wfuserService.update(domain );
WFUserDTO dto = wfuserMapping.toDto(domain); WFUserDTO dto = wfuserMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasPermission('Update',{'Sql',this.wfuserMapping,#wfuserdtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Update-all')")
@ApiOperation(value = "UpdateBatch", tags = {"WFUser" }, notes = "UpdateBatch") @ApiOperation(value = "UpdateBatch", tags = {"WFUser" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfusers/batch") @RequestMapping(method = RequestMethod.PUT, value = "/wfusers/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFUserDTO> wfuserdtos) { public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFUserDTO> wfuserdtos) {
...@@ -125,7 +123,7 @@ public class WFUserResource { ...@@ -125,7 +123,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@PreAuthorize("hasPermission('Create',{'Sql',this.wfuserMapping,#wfuserdtos})") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Create-all')")
@ApiOperation(value = "createBatch", tags = {"WFUser" }, notes = "createBatch") @ApiOperation(value = "createBatch", tags = {"WFUser" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/batch") @RequestMapping(method = RequestMethod.POST, value = "/wfusers/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFUserDTO> wfuserdtos) { public ResponseEntity<Boolean> createBatch(@RequestBody List<WFUserDTO> wfuserdtos) {
...@@ -133,7 +131,6 @@ public class WFUserResource { ...@@ -133,7 +131,6 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"WFUser" }, notes = "CheckKey") @ApiOperation(value = "CheckKey", tags = {"WFUser" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/checkkey") @RequestMapping(method = RequestMethod.POST, value = "/wfusers/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFUserDTO wfuserdto) { public ResponseEntity<Boolean> checkKey(@RequestBody WFUserDTO wfuserdto) {
...@@ -162,3 +159,4 @@ public class WFUserResource { ...@@ -162,3 +159,4 @@ public class WFUserResource {
.body(new PageImpl(wfuserMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements())); .body(new PageImpl(wfuserMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
} }
} }
...@@ -9,8 +9,8 @@ import com.alibaba.fastjson.JSONObject; ...@@ -9,8 +9,8 @@ import com.alibaba.fastjson.JSONObject;
public class IBZUAAFallback implements IBZUAAFeignClient { public class IBZUAAFallback implements IBZUAAFeignClient {
@Override @Override
public boolean pushSystemPermissionData(String systemid,JSONObject systemPermissionData) { public Boolean syncSysAuthority(JSONObject system) {
return false; return null;
} }
@Override @Override
......
...@@ -10,13 +10,12 @@ import com.alibaba.fastjson.JSONObject; ...@@ -10,13 +10,12 @@ import com.alibaba.fastjson.JSONObject;
public interface IBZUAAFeignClient public interface IBZUAAFeignClient
{ {
/** /**
* 推送系统权限数据到uaa * 同步系统资源到uaa
* @param systemid * @param system 系统资源信息
* @param systemPermissionData
* @return * @return
*/ */
@PostMapping("/syspssystems/{systemid}/permissiondata") @PostMapping("/syspssystems/save")
boolean pushSystemPermissionData(@PathVariable("systemid") String systemid,@RequestBody JSONObject systemPermissionData); Boolean syncSysAuthority(@RequestBody JSONObject system);
/** /**
* 用户登录 * 用户登录
......
...@@ -36,10 +36,14 @@ public class PermissionSyncJob implements ApplicationRunner { ...@@ -36,10 +36,14 @@ public class PermissionSyncJob implements ApplicationRunner {
Thread.sleep(10000); Thread.sleep(10000);
InputStream permission= this.getClass().getResourceAsStream("/permission/systemResource.json"); //获取当前系统所有实体资源能力 InputStream permission= this.getClass().getResourceAsStream("/permission/systemResource.json"); //获取当前系统所有实体资源能力
String permissionResult = IOUtils.toString(permission,"UTF-8"); String permissionResult = IOUtils.toString(permission,"UTF-8");
if(client.pushSystemPermissionData(systemId,JSONObject.parseObject(permissionResult))){ JSONObject system= new JSONObject();
system.put("pssystemid",systemId);
system.put("pssystemname",systemId);
system.put("sysstructure",JSONObject.parseObject(permissionResult));
if(client.syncSysAuthority(system)){
log.info("向[UAA]同步系统资源成功"); log.info("向[UAA]同步系统资源成功");
}else{ }else{
log.info(String.format("向[UAA]同步系统资源失败")); log.error("向[UAA]同步系统资源失败");
} }
} }
catch (Exception ex) { catch (Exception ex) {
......
package cn.ibizlab.util.rest; package cn.ibizlab.util.rest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import cn.ibizlab.util.security.AuthenticationUser;
import cn.ibizlab.util.service.AuthenticationUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.util.ObjectUtils; import org.springframework.security.core.GrantedAuthority;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Value; import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired; import java.util.HashSet;
import cn.ibizlab.util.security.AuthenticationUser; import java.util.Iterator;
import cn.ibizlab.util.service.AuthenticationUserService; import java.util.Set;
@RestController @RestController
@RequestMapping(value = "") @RequestMapping(value = "")
...@@ -27,13 +30,19 @@ public class AppController { ...@@ -27,13 +30,19 @@ public class AppController {
public ResponseEntity<JSONObject> getAppData() { public ResponseEntity<JSONObject> getAppData() {
JSONObject appData = new JSONObject() ; JSONObject appData = new JSONObject() ;
JSONArray uniRes=new JSONArray(); Set<String> appMenu = new HashSet();
JSONArray appMenu=new JSONArray(); Set<String> uniRes = new HashSet();
if(enablePermissionValid){ if(enablePermissionValid){
JSONObject userPermission=AuthenticationUser.getAuthenticationUser().getPermissionList(); Collection<GrantedAuthority> authorities=AuthenticationUser.getAuthenticationUser().getAuthorities();
if(!ObjectUtils.isEmpty(userPermission)){ Iterator it = authorities.iterator();
uniRes = userPermission.getJSONArray("unires"); while(it.hasNext()) {
appMenu = userPermission.getJSONArray("appmenu"); GrantedAuthority authority = (GrantedAuthority)it.next();
String strAuthority=authority.getAuthority();
if(strAuthority.startsWith("UNIRES"))
uniRes.add(strAuthority);
else if(strAuthority.startsWith("APPMENU"))
appMenu.add(strAuthority);
} }
} }
appData.put("unires",uniRes); appData.put("unires",uniRes);
......
...@@ -14,6 +14,7 @@ import cn.ibizlab.util.domain.IBZUSER; ...@@ -14,6 +14,7 @@ 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; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.security.core.authority.AuthorityUtils;
/** /**
* 实体[IBZUSER] 服务对象接口实现 * 实体[IBZUSER] 服务对象接口实现
...@@ -72,6 +73,9 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl ...@@ -72,6 +73,9 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
public AuthenticationUser createUserDetails(IBZUSER user) { public AuthenticationUser createUserDetails(IBZUSER user) {
AuthenticationUser userdatail = new AuthenticationUser(); AuthenticationUser userdatail = new AuthenticationUser();
CachedBeanCopier.copy(user,userdatail); CachedBeanCopier.copy(user,userdatail);
if(userdatail.getSuperuser()==1){
userdatail.setAuthorities(AuthorityUtils.createAuthorityList("ROLE_SUPERADMIN"));
}
return userdatail; return userdatail;
} }
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册