use of com.rebuild.core.privileges.bizz.CustomEntityPrivileges in project rebuild by getrebuild.
the class RoleBaseQueryFilter method buildCustomFilter.
/**
* 自定义权限
*
* @param ep
* @param dtmField
* @return
* @see PrivilegesManager#andPassCustomFilter(ID, ID, Permission, Privileges)
*/
private String buildCustomFilter(Privileges ep, Field dtmField) {
if (user == null || useAction == null || !(ep instanceof CustomEntityPrivileges))
return null;
JSONObject hasFilter = ((CustomEntityPrivileges) ep).getCustomFilter(useAction);
if (hasFilter == null)
return null;
// 兼容转换(明细实体)
if (dtmField != null) {
final JSONArray items = hasFilter.getJSONArray("items");
JSONArray items2 = new JSONArray();
for (Object item : items) {
JSONObject c = (JSONObject) JSONUtils.clone((JSON) item);
c.put("field", String.format("%s.%s", dtmField.getName(), c.getString("field")));
items2.add(c);
}
hasFilter = JSONUtils.toJSONObject(new String[] { "entity", "items" }, new Object[] { dtmField.getOwnEntity().getName(), items2 });
}
AdvFilterParser advFilterParser = new AdvFilterParser(hasFilter);
advFilterParser.setUser(user.getId());
return advFilterParser.toSqlWhere();
}
use of com.rebuild.core.privileges.bizz.CustomEntityPrivileges in project rebuild by getrebuild.
the class RoleBaseQueryFilter method buildCustomFilter.
/**
* 自定义权限
*
* @param ep
* @return
* @see PrivilegesManager#andPassCustomFilter(ID, ID, Permission, Privileges)
*/
private String buildCustomFilter(Privileges ep) {
if (user == null || useAction == null || !ep.getClass().isAssignableFrom(CustomEntityPrivileges.class))
return null;
JSONObject hasFilter = ((CustomEntityPrivileges) ep).getCustomFilter(useAction);
if (hasFilter == null)
return null;
AdvFilterParser advFilterParser = new AdvFilterParser(hasFilter);
advFilterParser.setUser(user.getId());
return advFilterParser.toSqlWhere();
}
Aggregations