Browse Source

REPORT-23115 远程设计权限配置-版本不匹配时用户角色列表都为空

feature/big-screen
Lucian 5 years ago
parent
commit
ac0c319ae4
  1. 9
      designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java
  2. 26
      designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java

9
designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java

@ -13,6 +13,7 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.AuthorityOperator; import com.fr.workspace.server.authority.AuthorityOperator;
import com.fr.workspace.server.authority.decision.DecisionOperator; import com.fr.workspace.server.authority.decision.DecisionOperator;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.ArrayList; import java.util.ArrayList;
public class NodeAuthProcessor { public class NodeAuthProcessor {
@ -41,9 +42,15 @@ public class NodeAuthProcessor {
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
try { try {
String userName = WorkContext.getCurrent().getConnection().getUserName(); String userName = WorkContext.getCurrent().getConnection().getUserName();
DesignAuthority[] authorities = null;
try {
String userId = WorkContext.getCurrent().get(DecisionOperator.class).getUserIdByName(userName); String userId = WorkContext.getCurrent().get(DecisionOperator.class).getUserIdByName(userName);
authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(userId);
} catch(UndeclaredThrowableException e) {
// 兼容旧版本的服务器
authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities();
}
// 远程设计获取设计成员的权限列表 // 远程设计获取设计成员的权限列表
DesignAuthority[] authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(userId);
DesignAuthority authority = null; DesignAuthority authority = null;
if (authorities != null) { if (authorities != null) {

26
designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java

@ -9,11 +9,14 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.remote.ui.AuthorityManagerPane; import com.fr.design.remote.ui.AuthorityManagerPane;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.DesignAuthority; import com.fr.report.DesignAuthority;
import com.fr.report.constant.RoleType;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.AuthorityOperator; import com.fr.workspace.server.authority.AuthorityOperator;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author yaohwu * @author yaohwu
@ -38,13 +41,24 @@ public class RemoteDesignAuthManagerAction extends UpdateAction {
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
try { try {
// 远程设计获取全部设计成员的权限列表 // 远程设计获取全部设计成员的权限列表
DesignAuthority[] userAuthorities = WorkContext.getCurrent().get(AuthorityOperator.class).getUserAuthorities(); DesignAuthority[] authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities();
DesignAuthority[] customAuthorities = WorkContext.getCurrent().get(AuthorityOperator.class).getCustomRoleAuthorities(); List<DesignAuthority> userAuthorities = new ArrayList<DesignAuthority>();
if (userAuthorities != null && userAuthorities.length != 0) { List<DesignAuthority> customAuthorities = new ArrayList<DesignAuthority>();
managerPane.populateByUser(userAuthorities); if (authorities != null) {
for (DesignAuthority authority : authorities) {
if (authority.getRoleType() == RoleType.CUSTOM) {
customAuthorities.add(authority);
}
else {
userAuthorities.add(authority);
}
}
if (userAuthorities.size() != 0) {
managerPane.populateByUser(userAuthorities.toArray(new DesignAuthority[userAuthorities.size()]));
}
if (customAuthorities.size() != 0) {
managerPane.populateByCustom(customAuthorities.toArray(new DesignAuthority[customAuthorities.size()]));
} }
if (customAuthorities != null && customAuthorities.length != 0) {
managerPane.populateByCustom(customAuthorities);
} }
} catch (Exception exception) { } catch (Exception exception) {
FineLoggerFactory.getLogger().error(exception.getMessage(), exception); FineLoggerFactory.getLogger().error(exception.getMessage(), exception);

Loading…
Cancel
Save