提交 bb904658 编写于 作者: Z Zhou Rui

角色解析不包含群组

上级 74dba392
......@@ -23,6 +23,10 @@ import jdk.nashorn.api.scripting.ScriptObjectMirror;
public class ScriptFactory {
private ScriptFactory(){
}
public static final ScriptEngine scriptEngine = (new ScriptEngineManager())
.getEngineByName(Config.SCRIPTING_ENGINE_NAME);
......@@ -253,7 +257,6 @@ public class ScriptFactory {
}
}
return list;
}
}
\ No newline at end of file
package com.x.organization.assemble.authentication.jaxrs.authentication;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.NameValuePair;
......@@ -21,18 +30,10 @@ import com.x.organization.assemble.authentication.Business;
import com.x.organization.assemble.authentication.wrapout.WrapOutAuthentication;
import com.x.organization.core.entity.Identity;
import com.x.organization.core.entity.Person;
import com.x.organization.core.entity.Role;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
abstract class BaseAction extends StandardJaxrsAction {
private static Logger logger = LoggerFactory.getLogger(BaseAction.class);
......@@ -76,7 +77,7 @@ abstract class BaseAction extends StandardJaxrsAction {
t.setToken(effectivePerson.getToken());
t.setTokenType(tokenType);
/** 添加角色 */
t.setRoleList(listRole(business, person.getId()));
t.setRoleList(business.organization().role().listWithPerson(effectivePerson.getDistinguishedName()));
/** 添加身份 */
t.setIdentityList(listIdentity(business, person.getId()));
/** 判断密码是否过期需要修改密码 */
......@@ -157,14 +158,14 @@ abstract class BaseAction extends StandardJaxrsAction {
}
}
private List<String> listRole(Business business, String personId) throws Exception {
List<String> roles = new ArrayList<>();
for (Role o : business.entityManagerContainer().fetch(business.role().listWithPerson(personId), Role.class,
ListTools.toList(Role.DISTINGUISHEDNAME))) {
roles.add(o.getDistinguishedName());
}
return roles;
}
// private List<String> listRole(Business business, String personId) throws Exception {
// List<String> roles = new ArrayList<>();
// for (Role o : business.entityManagerContainer().fetch(business.role().listWithPerson(personId), Role.class,
// ListTools.toList(Role.DISTINGUISHEDNAME))) {
// roles.add(o.getDistinguishedName());
// }
// return roles;
// }
private List<WoIdentity> listIdentity(Business business, String personId) throws Exception {
List<String> ids = business.identity().listWithPerson(personId);
......
......@@ -32,6 +32,8 @@ import com.x.base.core.entity.dataitem.ItemStringValueType;
import com.x.base.core.entity.tools.JpaObjectTools;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.organization.OrganizationDefinition;
import com.x.base.core.project.script.ScriptFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.query.core.entity.Item;
import com.x.query.core.entity.Item_;
......@@ -50,8 +52,6 @@ public abstract class Plan extends GsonPropertyObject {
public static final String CALCULATE_AVERAGE = "average";
public static final String CALCULATE_COUNT = "count";
protected static Pattern DISTINGUISHEDNAME_PATTERN = Pattern.compile("^(\\S+)\\@(\\S+)\\@(P|PA|G|R|I|U|UA|UD)$");
protected static final int SQL_STATEMENT_IN_BATCH = 3000;
public Runtime runtime;
......@@ -196,12 +196,12 @@ public abstract class Plan extends GsonPropertyObject {
} else {
bundles = this.listBundle(emc);
}
// if ((null != this.count) && (this.count > 0)) {
// /* 默认限制了数量 */
// if (this.count < bundles.size()) {
// bundles = bundles.subList(0, this.count);
// }
// }
// if ((null != this.count) && (this.count > 0)) {
// /* 默认限制了数量 */
// if (this.count < bundles.size()) {
// bundles = bundles.subList(0, this.count);
// }
// }
if ((null != this.runtime.count) && (this.runtime.count > 0)) {
/* runtime限制了数量 */
if (this.runtime.count < bundles.size()) {
......@@ -382,7 +382,7 @@ public abstract class Plan extends GsonPropertyObject {
}
private String name(String str) {
Matcher m = DISTINGUISHEDNAME_PATTERN.matcher(str);
Matcher m = OrganizationDefinition.distinguishedName_pattern.matcher(str);
if (m.find()) {
return m.group(1);
}
......@@ -489,57 +489,58 @@ public abstract class Plan extends GsonPropertyObject {
for (Tuple o : list) {
row = table.get(Objects.toString(o.get(0)));
switch (ItemPrimitiveType.valueOf(Objects.toString(o.get(1)))) {
case s:
switch (ItemStringValueType.valueOf(Objects.toString(o.get(2)))) {
case s:
if (null != o.get(3)) {
if ((null != o.get(4)) && StringUtils.isNotEmpty(Objects.toString(o.get(4)))) {
row.put(selectEntry.getColumn(), Objects.toString(o.get(4)));
} else {
row.put(selectEntry.getColumn(), Objects.toString(o.get(3)));
}
}
break;
case d:
if (null != o.get(5)) {
row.put(selectEntry.getColumn(), JpaObjectTools.confirm((Date) o.get(5)));
switch (ItemStringValueType.valueOf(Objects.toString(o.get(2)))) {
case s:
if (null != o.get(3)) {
if ((null != o.get(4)) && StringUtils.isNotEmpty(Objects.toString(o.get(4)))) {
row.put(selectEntry.getColumn(), Objects.toString(o.get(4)));
} else {
row.put(selectEntry.getColumn(), Objects.toString(o.get(3)));
}
}
break;
case d:
if (null != o.get(5)) {
row.put(selectEntry.getColumn(), JpaObjectTools.confirm((Date) o.get(5)));
}
break;
case t:
if (null != o.get(6)) {
row.put(selectEntry.getColumn(), JpaObjectTools.confirm((Date) o.get(6)));
}
break;
case dt:
if (null != o.get(7)) {
row.put(selectEntry.getColumn(), JpaObjectTools.confirm((Date) o.get(7)));
}
break;
default:
break;
}
break;
case t:
if (null != o.get(6)) {
row.put(selectEntry.getColumn(), JpaObjectTools.confirm((Date) o.get(6)));
case b:
if (null != o.get(8)) {
row.put(selectEntry.getColumn(), (Boolean) o.get(8));
}
break;
case dt:
if (null != o.get(7)) {
row.put(selectEntry.getColumn(), JpaObjectTools.confirm((Date) o.get(7)));
case n:
if (null != o.get(9)) {
row.put(selectEntry.getColumn(), (Number) o.get(9));
}
break;
default:
break;
}
break;
case b:
if (null != o.get(8)) {
row.put(selectEntry.getColumn(), (Boolean) o.get(8));
}
break;
case n:
if (null != o.get(9)) {
row.put(selectEntry.getColumn(), (Number) o.get(9));
}
break;
default:
break;
}
}
}
/* 有两个地方用到了 */
private ScriptEngine getScriptEngine() {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
return scriptEngine;
// ScriptEngineManager manager = new ScriptEngineManager();
// ScriptEngine scriptEngine = manager.getEngineByName("JavaScript");
// return scriptEngine;
return ScriptFactory.scriptEngine;
}
public static class ExtractObject {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册