Skip to content

Commit

Permalink
增加工作流自动同步开关,默认关闭:activiti.isSynActivitiIndetity=false
Browse files Browse the repository at this point in the history
  • Loading branch information
think-gem committed Oct 30, 2014
1 parent 9a3af7e commit a70119d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/main/java/com/thinkgem/jeesite/common/config/Global.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public static Boolean isDemoMode() {
String dm = getConfig("demoMode");
return "true".equals(dm) || "1".equals(dm);
}

/**
* 在修改系统用户和角色时是否同步到Activiti
*/
public static Boolean isSynActivitiIndetity() {
String dm = getConfig("activiti.isSynActivitiIndetity");
return "true".equals(dm) || "1".equals(dm);
}

/**
* 获取CKFinder上传文件的根目录
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.Maps;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.security.Digests;
import com.thinkgem.jeesite.common.service.BaseService;
Expand Down Expand Up @@ -310,6 +311,9 @@ public void synToActiviti() {
}

private void saveActiviti(Role role) {
if (!Global.isSynActivitiIndetity()){
return;
}
try{
if(role!=null) {
List<User> userList = roleDao.get(role.getId()).getUserList();
Expand All @@ -332,9 +336,11 @@ private void saveActiviti(Role role) {
e.printStackTrace();
}
}


private void deleteActiviti(Role role) {
if (!Global.isSynActivitiIndetity()){
return;
}
try{
if(role!=null) {
List<User> userList = roleDao.get(role.getId()).getUserList();
Expand All @@ -351,6 +357,9 @@ private void deleteActiviti(Role role) {
}

private void saveActiviti(User user) {
if (!Global.isSynActivitiIndetity()){
return;
}
try{
if(user!=null) {
String userId = ObjectUtils.toString(user.getId());
Expand All @@ -370,6 +379,9 @@ private void saveActiviti(User user) {
}

private void deleteActiviti(User user) {
if (!Global.isSynActivitiIndetity()){
return;
}
try{
if(user!=null) {
String userId = ObjectUtils.toString(user.getId());
Expand All @@ -381,6 +393,9 @@ private void deleteActiviti(User user) {
}

private void saveActiviti(Menu menu) {
if (!Global.isSynActivitiIndetity()){
return;
}
try{
if(menu!=null){
Group group = identityService.createGroupQuery().groupId(menu.getActivitiGroupId()).singleResult();
Expand Down Expand Up @@ -408,7 +423,11 @@ private void saveActiviti(Menu menu) {
e.printStackTrace();
}
}

private void deleteActiviti(String id) {
if (!Global.isSynActivitiIndetity()){
return;
}
try{
if(id!=null) {
Menu menu = menuDao.get(id);
Expand All @@ -431,6 +450,9 @@ private void deleteActiviti(String id) {

@SuppressWarnings("unchecked")
private void merge(User user,List<Menu> menuList) {
if (!Global.isSynActivitiIndetity()){
return;
}
try{
String userId = ObjectUtils.toString(user.getId());
List<Group> activitiGroupList = identityService.createGroupQuery().groupMember(userId).list();
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/jeesite.properties
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ web.view.suffix=.jsp
#max upload size. 10M=10*1024*1024(B)=10485760 bytes
web.maxUploadSize=10485760

#\u4fee\u6539\u7528\u6237\u673a\u6784\u65f6\u662f\u5426\u540c\u6b65activiti
activiti.isSynActivitiIndetity=false

#============================#
#====== Global sttings ======#
#============================#
Expand Down

0 comments on commit a70119d

Please sign in to comment.