forked from p85126437/datagear
重构授权管理前端代码,使其方便支持授权资源类型扩展
This commit is contained in:
parent
b610967fc9
commit
db0203d35b
|
@ -93,6 +93,9 @@ public class Authorization extends AbstractStringIdEntity
|
|||
/** 授权主体名称 */
|
||||
private String principalName;
|
||||
|
||||
/** 权限标签 */
|
||||
private String permissionLabel;
|
||||
|
||||
/** 此记录的数据权限 */
|
||||
private int dataPermission;
|
||||
|
||||
|
@ -205,6 +208,16 @@ public class Authorization extends AbstractStringIdEntity
|
|||
this.principalName = principalName;
|
||||
}
|
||||
|
||||
public String getPermissionLabel()
|
||||
{
|
||||
return permissionLabel;
|
||||
}
|
||||
|
||||
public void setPermissionLabel(String permissionLabel)
|
||||
{
|
||||
this.permissionLabel = permissionLabel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataPermission()
|
||||
{
|
||||
|
|
|
@ -26,6 +26,9 @@ public class AuthorizationQueryContext implements Serializable
|
|||
/** 结果集中的全部匿名用户标签 */
|
||||
private String principalAnonymousLabel = Authorization.PRINCIPAL_ANONYMOUS;
|
||||
|
||||
/** 权限值标签 */
|
||||
private EnumValueLabel<Integer>[] permissionLabels;
|
||||
|
||||
/** 指定查询资源类型 */
|
||||
private String resourceType = null;
|
||||
|
||||
|
@ -54,6 +57,21 @@ public class AuthorizationQueryContext implements Serializable
|
|||
this.principalAnonymousLabel = principalAnonymousLabel;
|
||||
}
|
||||
|
||||
public boolean hasPermissionLabels()
|
||||
{
|
||||
return (this.permissionLabels != null && this.permissionLabels.length > 0);
|
||||
}
|
||||
|
||||
public EnumValueLabel<Integer>[] getPermissionLabels()
|
||||
{
|
||||
return permissionLabels;
|
||||
}
|
||||
|
||||
public void setPermissionLabels(EnumValueLabel<Integer>[] permissionLabels)
|
||||
{
|
||||
this.permissionLabels = permissionLabels;
|
||||
}
|
||||
|
||||
public boolean hasResourceType()
|
||||
{
|
||||
return (this.resourceType != null && !this.resourceType.isEmpty());
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2018 datagear.tech. All Rights Reserved.
|
||||
*/
|
||||
|
||||
package org.datagear.management.service.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 枚举值标签。
|
||||
*
|
||||
* @author datagear@163.com
|
||||
*
|
||||
*/
|
||||
public class EnumValueLabel<T> implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 枚举值 */
|
||||
private T value;
|
||||
|
||||
/** 标签 */
|
||||
private String label;
|
||||
|
||||
public EnumValueLabel()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public EnumValueLabel(T value, String label)
|
||||
{
|
||||
super();
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public T getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(T value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label)
|
||||
{
|
||||
this.label = label;
|
||||
}
|
||||
}
|
|
@ -177,7 +177,20 @@
|
|||
)
|
||||
ELSE A.AUTH_PRINCIPAL
|
||||
END
|
||||
) AS ${_iq_}principalName${_iq_}
|
||||
) AS ${_iq_}principalName${_iq_},
|
||||
<choose><when test="queryContext.permissionLabels != null">
|
||||
(
|
||||
CASE A.AUTH_PERMISSION
|
||||
<foreach collection="queryContext.permissionLabels" item="item">
|
||||
WHEN ${item.value} THEN '${item.label}'
|
||||
</foreach>
|
||||
ELSE ''
|
||||
END
|
||||
)
|
||||
</when><otherwise>
|
||||
A.AUTH_PERMISSION
|
||||
</otherwise></choose>
|
||||
AS ${_iq_}permissionLabel${_iq_}
|
||||
FROM
|
||||
(<include refid="queryViewWithCreateUser" />) A
|
||||
<if test="resourceNameQueryView != null">
|
||||
|
|
|
@ -10,17 +10,20 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.datagear.management.domain.Authorization;
|
||||
import org.datagear.management.domain.Schema;
|
||||
import org.datagear.management.domain.User;
|
||||
import org.datagear.management.service.AuthorizationService;
|
||||
import org.datagear.management.service.impl.AuthorizationQueryContext;
|
||||
import org.datagear.management.service.impl.EnumValueLabel;
|
||||
import org.datagear.persistence.PagingQuery;
|
||||
import org.datagear.util.IDUtil;
|
||||
import org.datagear.web.OperationMessage;
|
||||
import org.datagear.web.controller.AuthorizationResourceMetas.PermissionMeta;
|
||||
import org.datagear.web.controller.AuthorizationResourceMetas.ResourceMeta;
|
||||
import org.datagear.web.util.WebUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
@ -64,11 +67,13 @@ public class AuthorizationController extends AbstractController
|
|||
this.authorizationService = authorizationService;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public String add(HttpServletRequest request, HttpServletResponse response, org.springframework.ui.Model model)
|
||||
@RequestMapping("/{resourceType}/add")
|
||||
public String add(HttpServletRequest request, HttpServletResponse response, org.springframework.ui.Model model,
|
||||
@PathVariable("resourceType") String resourceType)
|
||||
{
|
||||
User user = WebUtils.getUser(request, response);
|
||||
|
||||
setResourceMetaAttribute(model, resourceType);
|
||||
setAppoiontResourceAttributeIf(request, model);
|
||||
model.addAttribute("user", user);
|
||||
model.addAttribute(KEY_TITLE_MESSAGE_KEY, "authorization.addAuthorization");
|
||||
|
@ -77,12 +82,14 @@ public class AuthorizationController extends AbstractController
|
|||
return "/authorization/authorization_form";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/saveAdd", produces = CONTENT_TYPE_JSON)
|
||||
@RequestMapping(value = "/{resourceType}/saveAdd", produces = CONTENT_TYPE_JSON)
|
||||
@ResponseBody
|
||||
public ResponseEntity<OperationMessage> saveAdd(HttpServletRequest request, HttpServletResponse response,
|
||||
org.springframework.ui.Model model, @PathVariable("resourceType") String resourceType,
|
||||
Authorization authorization)
|
||||
{
|
||||
checkInput(authorization);
|
||||
setResourceMetaAttribute(model, resourceType);
|
||||
|
||||
User user = WebUtils.getUser(request, response);
|
||||
|
||||
|
@ -94,13 +101,14 @@ public class AuthorizationController extends AbstractController
|
|||
return buildOperationMessageSaveSuccessResponseEntity(request);
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@RequestMapping("/{resourceType}/edit")
|
||||
public String edit(HttpServletRequest request, HttpServletResponse response, org.springframework.ui.Model model,
|
||||
@RequestParam("id") String id)
|
||||
@PathVariable("resourceType") String resourceType, @RequestParam("id") String id)
|
||||
{
|
||||
User user = WebUtils.getUser(request, response);
|
||||
|
||||
setAuthorizationQueryContext(request);
|
||||
ResourceMeta resourceMeta = setResourceMetaAttribute(model, resourceType);
|
||||
setAuthorizationQueryContext(request, resourceMeta);
|
||||
|
||||
Authorization authorization = this.authorizationService.getByIdForEdit(user, id);
|
||||
|
||||
|
@ -113,15 +121,18 @@ public class AuthorizationController extends AbstractController
|
|||
return "/authorization/authorization_form";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/saveEdit", produces = CONTENT_TYPE_JSON)
|
||||
@RequestMapping(value = "/{resourceType}/saveEdit", produces = CONTENT_TYPE_JSON)
|
||||
@ResponseBody
|
||||
public ResponseEntity<OperationMessage> saveEdit(HttpServletRequest request, HttpServletResponse response,
|
||||
org.springframework.ui.Model model, @PathVariable("resourceType") String resourceType,
|
||||
Authorization authorization)
|
||||
{
|
||||
if (isEmpty(authorization.getId()))
|
||||
throw new IllegalInputException();
|
||||
checkInput(authorization);
|
||||
|
||||
setResourceMetaAttribute(model, resourceType);
|
||||
|
||||
User user = WebUtils.getUser(request, response);
|
||||
|
||||
this.authorizationService.update(user, authorization);
|
||||
|
@ -129,13 +140,14 @@ public class AuthorizationController extends AbstractController
|
|||
return buildOperationMessageSaveSuccessResponseEntity(request);
|
||||
}
|
||||
|
||||
@RequestMapping("/view")
|
||||
@RequestMapping("/{resourceType}/view")
|
||||
public String view(HttpServletRequest request, HttpServletResponse response, org.springframework.ui.Model model,
|
||||
@RequestParam("id") String id)
|
||||
@PathVariable("resourceType") String resourceType, @RequestParam("id") String id)
|
||||
{
|
||||
User user = WebUtils.getUser(request, response);
|
||||
|
||||
setAuthorizationQueryContext(request);
|
||||
ResourceMeta resourceMeta = setResourceMetaAttribute(model, resourceType);
|
||||
setAuthorizationQueryContext(request, resourceMeta);
|
||||
|
||||
Authorization authorization = this.authorizationService.getById(user, id);
|
||||
|
||||
|
@ -150,37 +162,42 @@ public class AuthorizationController extends AbstractController
|
|||
return "/authorization/authorization_form";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete", produces = CONTENT_TYPE_JSON)
|
||||
@RequestMapping(value = "/{resourceType}/delete", produces = CONTENT_TYPE_JSON)
|
||||
@ResponseBody
|
||||
public ResponseEntity<OperationMessage> delete(HttpServletRequest request, HttpServletResponse response,
|
||||
org.springframework.ui.Model model, @PathVariable("resourceType") String resourceType,
|
||||
@RequestParam("id") String[] ids)
|
||||
{
|
||||
setResourceMetaAttribute(model, resourceType);
|
||||
this.authorizationService.deleteByIds(WebUtils.getUser(request, response), ids);
|
||||
|
||||
return buildOperationMessageDeleteSuccessResponseEntity(request);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/query")
|
||||
public String query(HttpServletRequest request, HttpServletResponse response, org.springframework.ui.Model model)
|
||||
@RequestMapping(value = "/{resourceType}/query")
|
||||
public String query(HttpServletRequest request, HttpServletResponse response, org.springframework.ui.Model model,
|
||||
@PathVariable("resourceType") String resourceType)
|
||||
{
|
||||
setResourceMetaAttribute(model, resourceType);
|
||||
setAppoiontResourceAttributeIf(request, model);
|
||||
model.addAttribute(KEY_TITLE_MESSAGE_KEY, "authorization.manageAuthorization");
|
||||
|
||||
return "/authorization/authorization_grid";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/queryData", produces = CONTENT_TYPE_JSON)
|
||||
@RequestMapping(value = "/{resourceType}/queryData", produces = CONTENT_TYPE_JSON)
|
||||
@ResponseBody
|
||||
public List<Authorization> queryData(HttpServletRequest request, HttpServletResponse response) throws Exception
|
||||
public List<Authorization> queryData(HttpServletRequest request, HttpServletResponse response,
|
||||
org.springframework.ui.Model model, @PathVariable("resourceType") String resourceType) throws Exception
|
||||
{
|
||||
User user = WebUtils.getUser(request, response);
|
||||
|
||||
ResourceMeta resourceMeta = setResourceMetaAttribute(model, resourceType);
|
||||
setAuthorizationQueryContext(request, resourceMeta);
|
||||
String appointResource = getAppoiontResource(request);
|
||||
|
||||
PagingQuery pagingQuery = getPagingQuery(request, null);
|
||||
|
||||
setAuthorizationQueryContext(request);
|
||||
|
||||
List<Authorization> authorizations = null;
|
||||
|
||||
if (!isEmpty(appointResource))
|
||||
|
@ -199,17 +216,41 @@ public class AuthorizationController extends AbstractController
|
|||
model.addAttribute("appointResource", ap);
|
||||
}
|
||||
|
||||
protected ResourceMeta setResourceMetaAttribute(org.springframework.ui.Model model, String resourceType)
|
||||
{
|
||||
ResourceMeta resourceMeta = AuthorizationResourceMetas.get(resourceType);
|
||||
|
||||
if (resourceMeta == null)
|
||||
throw new IllegalInputException();
|
||||
|
||||
model.addAttribute("resourceMeta", resourceMeta);
|
||||
|
||||
return resourceMeta;
|
||||
}
|
||||
|
||||
protected String getAppoiontResource(HttpServletRequest request)
|
||||
{
|
||||
return request.getParameter(PARAM_APPOINT_RESOURCE);
|
||||
}
|
||||
|
||||
protected void setAuthorizationQueryContext(HttpServletRequest request)
|
||||
protected void setAuthorizationQueryContext(HttpServletRequest request, ResourceMeta resourceMeta)
|
||||
{
|
||||
AuthorizationQueryContext context = new AuthorizationQueryContext();
|
||||
context.setPrincipalAllLabel(getMessage(request, "authorization.principalType.ALL"));
|
||||
context.setPrincipalAnonymousLabel(getMessage(request, "authorization.principalType.ANONYMOUS"));
|
||||
context.setResourceType(Schema.AUTHORIZATION_RESOURCE_TYPE);
|
||||
context.setResourceType(resourceMeta.getResourceType());
|
||||
|
||||
PermissionMeta[] permissionMetas = resourceMeta.getPermissionMetas();
|
||||
@SuppressWarnings("unchecked")
|
||||
EnumValueLabel<Integer>[] permissionLabels = new EnumValueLabel[permissionMetas.length];
|
||||
for (int i = 0; i < permissionMetas.length; i++)
|
||||
{
|
||||
PermissionMeta permissionMeta = permissionMetas[i];
|
||||
|
||||
permissionLabels[i] = new EnumValueLabel<Integer>(permissionMeta.getPermission(),
|
||||
getMessage(request, permissionMeta.getPermissionLabelKey()));
|
||||
}
|
||||
context.setPermissionLabels(permissionLabels);
|
||||
|
||||
AuthorizationQueryContext.set(context);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,353 @@
|
|||
/*
|
||||
* Copyright (c) 2018 datagear.tech. All Rights Reserved.
|
||||
*/
|
||||
|
||||
package org.datagear.web.controller;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.datagear.management.domain.Authorization;
|
||||
import org.datagear.management.domain.Schema;
|
||||
|
||||
/**
|
||||
* 授权资源元信息。
|
||||
*
|
||||
* @author datagear@163.com
|
||||
*
|
||||
*/
|
||||
public class AuthorizationResourceMetas
|
||||
{
|
||||
public static final String LABEL_KEY_PREFIX = "authorization.resourceMeta.";
|
||||
|
||||
private static final ConcurrentMap<String, ResourceMeta> RESOURCEMETA_MAP = new ConcurrentHashMap<String, ResourceMeta>();
|
||||
|
||||
/**
|
||||
* 注册{@linkplain ResourceMeta}。
|
||||
*
|
||||
* @param resourceMeta
|
||||
*/
|
||||
public static void register(ResourceMeta resourceMeta)
|
||||
{
|
||||
RESOURCEMETA_MAP.put(resourceMeta.getResourceType(), resourceMeta);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取{@linkplain ResourceMeta}。
|
||||
* <p>
|
||||
* 没有,则返回{@code null}。
|
||||
* </p>
|
||||
*
|
||||
* @param resourceType
|
||||
* @return
|
||||
*/
|
||||
public static ResourceMeta get(String resourceType)
|
||||
{
|
||||
return RESOURCEMETA_MAP.get(resourceType);
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
// 数据源授权资源元信息
|
||||
{
|
||||
ResourceMeta resourceMeta = ResourceMeta.valueOf(Schema.AUTHORIZATION_RESOURCE_TYPE, "/schema/select", "id",
|
||||
"title", true,
|
||||
PermissionMeta.valuesOf(Schema.AUTHORIZATION_RESOURCE_TYPE, Schema.PERMISSION_TABLE_DATA_READ,
|
||||
Schema.PERMISSION_TABLE_DATA_EDIT, Schema.PERMISSION_TABLE_DATA_DELETE,
|
||||
Authorization.PERMISSION_NONE_START, true));
|
||||
|
||||
register(resourceMeta);
|
||||
}
|
||||
}
|
||||
|
||||
private AuthorizationResourceMetas()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权资源元信息。
|
||||
*
|
||||
* @author datagear@163.com
|
||||
*
|
||||
*/
|
||||
public static class ResourceMeta implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String resourceType;
|
||||
|
||||
private String resouceTypeLabelKey;
|
||||
|
||||
private String selectResourceURL;
|
||||
|
||||
private String selectResourceIdField;
|
||||
|
||||
private String selectResourceNameField;
|
||||
|
||||
private PermissionMeta[] permissionMetas;
|
||||
|
||||
private boolean supportPattern = false;
|
||||
|
||||
private String selectResourceLabelKey;
|
||||
|
||||
private String selectResourceLabelDescKey;
|
||||
|
||||
private String fillPatternLabelKey;
|
||||
|
||||
private String fillPatternLabelDescKey;
|
||||
|
||||
public ResourceMeta()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public ResourceMeta(String resourceType, String resouceTypeLabelKey, String selectResourceURL,
|
||||
String selectResourceIdField, String selectResourceNameField, PermissionMeta... permissionMetas)
|
||||
{
|
||||
super();
|
||||
this.resourceType = resourceType;
|
||||
this.resouceTypeLabelKey = resouceTypeLabelKey;
|
||||
this.selectResourceURL = selectResourceURL;
|
||||
this.selectResourceIdField = selectResourceIdField;
|
||||
this.selectResourceNameField = selectResourceNameField;
|
||||
this.permissionMetas = permissionMetas;
|
||||
}
|
||||
|
||||
public String getResourceType()
|
||||
{
|
||||
return resourceType;
|
||||
}
|
||||
|
||||
public void setResourceType(String resourceType)
|
||||
{
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
|
||||
public String getResouceTypeLabelKey()
|
||||
{
|
||||
return resouceTypeLabelKey;
|
||||
}
|
||||
|
||||
public void setResouceTypeLabelKey(String resouceTypeLabelKey)
|
||||
{
|
||||
this.resouceTypeLabelKey = resouceTypeLabelKey;
|
||||
}
|
||||
|
||||
public String getSelectResourceURL()
|
||||
{
|
||||
return selectResourceURL;
|
||||
}
|
||||
|
||||
public void setSelectResourceURL(String selectResourceURL)
|
||||
{
|
||||
this.selectResourceURL = selectResourceURL;
|
||||
}
|
||||
|
||||
public String getSelectResourceIdField()
|
||||
{
|
||||
return selectResourceIdField;
|
||||
}
|
||||
|
||||
public void setSelectResourceIdField(String selectResourceIdField)
|
||||
{
|
||||
this.selectResourceIdField = selectResourceIdField;
|
||||
}
|
||||
|
||||
public String getSelectResourceNameField()
|
||||
{
|
||||
return selectResourceNameField;
|
||||
}
|
||||
|
||||
public void setSelectResourceNameField(String selectResourceNameField)
|
||||
{
|
||||
this.selectResourceNameField = selectResourceNameField;
|
||||
}
|
||||
|
||||
public PermissionMeta[] getPermissionMetas()
|
||||
{
|
||||
return permissionMetas;
|
||||
}
|
||||
|
||||
public void setPermissionMetas(PermissionMeta... permissionMetas)
|
||||
{
|
||||
this.permissionMetas = permissionMetas;
|
||||
}
|
||||
|
||||
public boolean isSupportPattern()
|
||||
{
|
||||
return supportPattern;
|
||||
}
|
||||
|
||||
public void setSupportPattern(boolean supportPattern)
|
||||
{
|
||||
this.supportPattern = supportPattern;
|
||||
}
|
||||
|
||||
public String getSelectResourceLabelKey()
|
||||
{
|
||||
return selectResourceLabelKey;
|
||||
}
|
||||
|
||||
public void setSelectResourceLabelKey(String selectResourceLabelKey)
|
||||
{
|
||||
this.selectResourceLabelKey = selectResourceLabelKey;
|
||||
}
|
||||
|
||||
public String getSelectResourceLabelDescKey()
|
||||
{
|
||||
return selectResourceLabelDescKey;
|
||||
}
|
||||
|
||||
public void setSelectResourceLabelDescKey(String selectResourceLabelDescKey)
|
||||
{
|
||||
this.selectResourceLabelDescKey = selectResourceLabelDescKey;
|
||||
}
|
||||
|
||||
public String getFillPatternLabelKey()
|
||||
{
|
||||
return fillPatternLabelKey;
|
||||
}
|
||||
|
||||
public void setFillPatternLabelKey(String fillPatternLabelKey)
|
||||
{
|
||||
this.fillPatternLabelKey = fillPatternLabelKey;
|
||||
}
|
||||
|
||||
public String getFillPatternLabelDescKey()
|
||||
{
|
||||
return fillPatternLabelDescKey;
|
||||
}
|
||||
|
||||
public void setFillPatternLabelDescKey(String fillPatternLabelDescKey)
|
||||
{
|
||||
this.fillPatternLabelDescKey = fillPatternLabelDescKey;
|
||||
}
|
||||
|
||||
public static ResourceMeta valueOf(String resourceType, String selectResourceURL, String selectResourceIdField,
|
||||
String selectResourceNameField, boolean supportPattern, PermissionMeta... permissionMetas)
|
||||
{
|
||||
String resouceTypeLabelKey = LABEL_KEY_PREFIX + resourceType + ".resouceTypeLabel";
|
||||
ResourceMeta meta = new ResourceMeta(resourceType, resouceTypeLabelKey, selectResourceURL,
|
||||
selectResourceIdField, selectResourceNameField, permissionMetas);
|
||||
|
||||
if (supportPattern)
|
||||
{
|
||||
String selectResourceLabelKey = LABEL_KEY_PREFIX + resourceType + ".selectResourceLabel";
|
||||
String selectResourceLabelDescKey = selectResourceLabelKey + ".desc";
|
||||
String fillPatternLabelKey = LABEL_KEY_PREFIX + resourceType + ".fillPatternLabel";
|
||||
String fillPatternLabelDescKey = fillPatternLabelKey + ".desc";
|
||||
|
||||
meta.setSupportPattern(true);
|
||||
meta.setSelectResourceLabelKey(selectResourceLabelKey);
|
||||
meta.setSelectResourceLabelDescKey(selectResourceLabelDescKey);
|
||||
meta.setFillPatternLabelKey(fillPatternLabelKey);
|
||||
meta.setFillPatternLabelDescKey(fillPatternLabelDescKey);
|
||||
}
|
||||
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权资源权限值元信息。
|
||||
*
|
||||
* @author datagear@163.com
|
||||
*
|
||||
*/
|
||||
public static class PermissionMeta implements Serializable
|
||||
{
|
||||
public static final String[] DEFAULT_SUB_LABELS = { "READ", "EDIT", "DELETE", "NONE" };
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int permission;
|
||||
|
||||
private String permissionLabelKey;
|
||||
|
||||
private String permissionLabelDescKey;
|
||||
|
||||
public PermissionMeta()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public PermissionMeta(int permission, String permissionLabelKey, String permissionLabelDescKey)
|
||||
{
|
||||
super();
|
||||
this.permission = permission;
|
||||
this.permissionLabelKey = permissionLabelKey;
|
||||
this.permissionLabelDescKey = permissionLabelDescKey;
|
||||
}
|
||||
|
||||
public int getPermission()
|
||||
{
|
||||
return permission;
|
||||
}
|
||||
|
||||
public void setPermission(int permission)
|
||||
{
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public String getPermissionLabelKey()
|
||||
{
|
||||
return permissionLabelKey;
|
||||
}
|
||||
|
||||
public void setPermissionLabelKey(String permissionLabelKey)
|
||||
{
|
||||
this.permissionLabelKey = permissionLabelKey;
|
||||
}
|
||||
|
||||
public String getPermissionLabelDescKey()
|
||||
{
|
||||
return permissionLabelDescKey;
|
||||
}
|
||||
|
||||
public void setPermissionLabelDescKey(String permissionLabelDescKey)
|
||||
{
|
||||
this.permissionLabelDescKey = permissionLabelDescKey;
|
||||
}
|
||||
|
||||
public static PermissionMeta valueOf(int permission, String permissionLabelKey)
|
||||
{
|
||||
return new PermissionMeta(permission, permissionLabelKey, permissionLabelKey + ".desc");
|
||||
}
|
||||
|
||||
public static PermissionMeta[] valuesOf()
|
||||
{
|
||||
PermissionMeta[] permissionMetas = new PermissionMeta[4];
|
||||
|
||||
permissionMetas[0] = valueOf(Authorization.PERMISSION_READ_START, "authorization.permission.READ");
|
||||
permissionMetas[1] = valueOf(Authorization.PERMISSION_EDIT_START, "authorization.permission.EDIT");
|
||||
permissionMetas[2] = valueOf(Authorization.PERMISSION_DELETE_START, "authorization.permission.DELETE");
|
||||
permissionMetas[3] = valueOf(Authorization.PERMISSION_NONE_START, "authorization.permission.NONE");
|
||||
|
||||
return permissionMetas;
|
||||
}
|
||||
|
||||
public static PermissionMeta[] valuesOf(String resourceType, int read, int edit, int delete, int none,
|
||||
boolean customDesc)
|
||||
{
|
||||
PermissionMeta[] permissionMetas = new PermissionMeta[4];
|
||||
|
||||
permissionMetas[0] = valueOf(read, "authorization.permission.READ");
|
||||
permissionMetas[1] = valueOf(edit, "authorization.permission.EDIT");
|
||||
permissionMetas[2] = valueOf(delete, "authorization.permission.DELETE");
|
||||
permissionMetas[3] = valueOf(none, "authorization.permission.NONE");
|
||||
|
||||
if (customDesc)
|
||||
{
|
||||
permissionMetas[0].setPermissionLabelDescKey(LABEL_KEY_PREFIX + resourceType + ".permission.READ.desc");
|
||||
permissionMetas[1].setPermissionLabelDescKey(LABEL_KEY_PREFIX + resourceType + ".permission.EDIT.desc");
|
||||
permissionMetas[2]
|
||||
.setPermissionLabelDescKey(LABEL_KEY_PREFIX + resourceType + ".permission.DELETE.desc");
|
||||
permissionMetas[3].setPermissionLabelDescKey(LABEL_KEY_PREFIX + resourceType + ".permission.NONE.desc");
|
||||
}
|
||||
|
||||
return permissionMetas;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -546,18 +546,26 @@ authorization.principal=\u6388\u6743\u4E3B\u4F53
|
|||
authorization.principalType=\u6388\u6743\u4E3B\u4F53\u7C7B\u578B
|
||||
authorization.permission=\u6743\u9650
|
||||
authorization.permission.NONE=\u65E0
|
||||
authorization.permission.NONE.desc=
|
||||
authorization.permission.READ=\u53EA\u8BFB
|
||||
authorization.permission.READ.desc=
|
||||
authorization.permission.EDIT=\u53EF\u7F16\u8F91
|
||||
authorization.permission.EDIT.desc=
|
||||
authorization.permission.DELETE=\u53EF\u5220\u9664
|
||||
authorization.enabled=\u662F\u5426\u542F\u7528
|
||||
authorization.createUser=\u8BBE\u7F6E\u7528\u6237
|
||||
authorization.resourceType.DATA_SOURCE=\u6307\u5B9A\u6570\u636E\u6E90
|
||||
authorization.resourceType.DATA_SOURCE_PATTERN=\u6570\u636E\u6E90URL\u901A\u914D
|
||||
authorization.resourceType.DATA_SOURCE_PATTERN.desc=\u53EF\u5728[\u6388\u6743\u8D44\u6E90]\u8F93\u5165\u6846\u4E2D\u586B\u5199\u6570\u636E\u6E90URL\u901A\u914D\u7B26\uFF0C\u9488\u5BF9\u6240\u6709\u5339\u914D\u7684\u6570\u636E\u6E90\u6388\u6743\uFF0C\u4F8B\u5982\uFF1A*\u3001*192.168.1.1*
|
||||
authorization.permission.DELETE.desc=
|
||||
authorization.principalType.ROLE=\u6307\u5B9A\u7528\u6237\u7EC4
|
||||
authorization.principalType.USER=\u6307\u5B9A\u7528\u6237
|
||||
authorization.principalType.ANONYMOUS=\u5168\u90E8\u533F\u540D\u7528\u6237
|
||||
authorization.principalType.ALL=\u5168\u90E8\u7528\u6237
|
||||
authorization.permission.Schema.PERMISSION_TABLE_DATA_READ.desc=\u4EC5\u53EF\u6D4F\u89C8\u6570\u636E
|
||||
authorization.permission.Schema.PERMISSION_TABLE_DATA_EDIT.desc=\u53EF\u7F16\u8F91\u3001\u6D4F\u89C8\u6570\u636E
|
||||
authorization.permission.Schema.PERMISSION_TABLE_DATA_DELETE.desc=\u53EF\u5220\u9664\u3001\u7F16\u8F91\u3001\u6D4F\u89C8\u6570\u636E
|
||||
authorization.enabled=\u662F\u5426\u542F\u7528
|
||||
authorization.createUser=\u8BBE\u7F6E\u7528\u6237
|
||||
#DATA_SOURCE resource meta
|
||||
authorization.resourceMeta.DATA_SOURCE.resouceTypeLabel=\u6570\u636E\u6E90
|
||||
authorization.resourceMeta.DATA_SOURCE.selectResourceLabel=\u6307\u5B9A\u6570\u636E\u6E90
|
||||
authorization.resourceMeta.DATA_SOURCE.selectResourceLabel.desc=
|
||||
authorization.resourceMeta.DATA_SOURCE.fillPatternLabel=\u6570\u636E\u6E90URL\u901A\u914D
|
||||
authorization.resourceMeta.DATA_SOURCE.fillPatternLabel.desc=\u53EF\u5728[\u6570\u636E\u6E90]\u8F93\u5165\u6846\u4E2D\u586B\u5199\u6570\u636E\u6E90URL\u901A\u914D\u7B26\uFF0C\u9488\u5BF9\u6240\u6709\u5339\u914D\u7684\u6570\u636E\u6E90\u6388\u6743\uFF0C\u4F8B\u5982\uFF1A*\u3001*192.168.1.1*
|
||||
authorization.resourceMeta.DATA_SOURCE.permission.READ.desc=\u4EC5\u53EF\u6D4F\u89C8\u6570\u636E
|
||||
authorization.resourceMeta.DATA_SOURCE.permission.EDIT.desc=\u53EF\u7F16\u8F91\u3001\u6D4F\u89C8\u6570\u636E
|
||||
authorization.resourceMeta.DATA_SOURCE.permission.DELETE.desc=\u53EF\u5220\u9664\u3001\u7F16\u8F91\u3001\u6D4F\u89C8\u6570\u636E
|
||||
authorization.resourceMeta.DATA_SOURCE.permission.NONE.desc=
|
|
@ -2,6 +2,7 @@
|
|||
<#include "../include/html_doctype.ftl">
|
||||
<#--
|
||||
titleMessageKey 标题标签I18N关键字,不允许null
|
||||
ResourceMeta resourceMeta 资源元信息,不允许null
|
||||
formAction 表单提交action,允许为null
|
||||
readonly 是否只读操作,允许为null
|
||||
-->
|
||||
|
@ -9,42 +10,47 @@ readonly 是否只读操作,允许为null
|
|||
<#assign readonly=(readonly!false)>
|
||||
<#assign isAdd=(formAction == 'saveAdd')>
|
||||
<#assign Authorization=statics['org.datagear.management.domain.Authorization']>
|
||||
<#assign Schema=statics['org.datagear.management.domain.Schema']>
|
||||
<#assign resourceType=((authorization.resourceType)!Schema.AUTHORIZATION_RESOURCE_TYPE)>
|
||||
<#assign resourceTypePattern=Schema.AUTHORIZATION_RESOURCE_TYPE + Authorization.PATTERN_RESOURCE_TYPE_SUFFIX>
|
||||
<#assign resourceTypePattern=resourceMeta.resourceType + Authorization.PATTERN_RESOURCE_TYPE_SUFFIX>
|
||||
|
||||
<#assign resourceType=((authorization.resourceType)!resourceMeta.resourceType)>
|
||||
<#assign principalType=((authorization.principalType)!Authorization.PRINCIPAL_TYPE_USER)>
|
||||
<#assign permission=((authorization.permission)!Schema.PERMISSION_TABLE_DATA_READ)>
|
||||
<#assign permission=((authorization.permission)!resourceMeta.permissionMetas[0].permission)>
|
||||
<#assign enabled=(((authorization.enabled)!true)?string('true', 'false'))>
|
||||
<#assign isResourceTypePattern=(resourceType != Schema.AUTHORIZATION_RESOURCE_TYPE)>
|
||||
<#assign isResourceTypePattern=(resourceType == resourceTypePattern)>
|
||||
<html>
|
||||
<head>
|
||||
<#include "../include/html_head.ftl">
|
||||
<title><#include "../include/html_title_app_name.ftl"><@spring.message code='${titleMessageKey}' /></title>
|
||||
<title><#include "../include/html_title_app_name.ftl"><@spring.message code='${titleMessageKey}' /> - <@spring.message code='${resourceMeta.resouceTypeLabelKey}' /></title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="${pageId}" class="page-form page-form-authorization">
|
||||
<form id="${pageId}-form" action="${contextPath}/authorization/${formAction}" method="POST">
|
||||
<form id="${pageId}-form" action="${contextPath}/authorization/${resourceMeta.resourceType}/${formAction}" method="POST">
|
||||
<div class="form-head"></div>
|
||||
<div class="form-content">
|
||||
<input type="hidden" name="id" value="${(authorization.id)!''?html}" />
|
||||
<input type="hidden" name="resource" value="${(authorization.resource)!''?html}" />
|
||||
<input type="hidden" name="principal" value="${(authorization.principal)!''?html}" />
|
||||
<#if resourceMeta.supportPattern>
|
||||
<div class="form-item form-item-resourceType">
|
||||
<div class="form-item-label">
|
||||
<label><@spring.message code='authorization.resourceType' /></label>
|
||||
<label> </label>
|
||||
</div>
|
||||
<div class="form-item-value">
|
||||
<div class="resourceType-radios">
|
||||
<label for="${pageId}-resourceType_0"><@spring.message code='authorization.resourceType.DATA_SOURCE' /></label>
|
||||
<input type="radio" id="${pageId}-resourceType_0" name="resourceType" value="${Schema.AUTHORIZATION_RESOURCE_TYPE}" />
|
||||
<label for="${pageId}-resourceType_1" title="<@spring.message code='authorization.resourceType.DATA_SOURCE_PATTERN.desc' />"><@spring.message code='authorization.resourceType.DATA_SOURCE_PATTERN' /></label>
|
||||
<label for="${pageId}-resourceType_0" title="<@spring.message code='${resourceMeta.selectResourceLabelDescKey}' />">
|
||||
<@spring.message code='${resourceMeta.selectResourceLabelKey}' />
|
||||
</label>
|
||||
<input type="radio" id="${pageId}-resourceType_0" name="resourceType" value="${resourceMeta.resourceType}" />
|
||||
<label for="${pageId}-resourceType_1" title="<@spring.message code='${resourceMeta.fillPatternLabelDescKey}' />">
|
||||
<@spring.message code='${resourceMeta.fillPatternLabelKey}' />
|
||||
</label>
|
||||
<input type="radio" id="${pageId}-resourceType_1" name="resourceType" value="${resourceTypePattern}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-item form-item-resource-name-pattern">
|
||||
<div class="form-item-label">
|
||||
<label><@spring.message code='authorization.resource' /></label>
|
||||
<label><@spring.message code='${resourceMeta.resouceTypeLabelKey}' /></label>
|
||||
</div>
|
||||
<div class="form-item-value">
|
||||
<input type="text" name="resourceNameForPattern" value="${(!isResourceTypePattern)?string('', (authorization.resourceName)!'')}" class="ui-widget ui-widget-content" />
|
||||
|
@ -54,9 +60,12 @@ readonly 是否只读操作,允许为null
|
|||
</#if>
|
||||
</div>
|
||||
</div>
|
||||
<#else>
|
||||
<input type="hidden" name="resourceType" value="${resourceType}" />
|
||||
</#if>
|
||||
<div class="form-item form-item-resource-name-entity">
|
||||
<div class="form-item-label">
|
||||
<label><@spring.message code='authorization.resource' /></label>
|
||||
<label><@spring.message code='${resourceMeta.resouceTypeLabelKey}' /></label>
|
||||
</div>
|
||||
<div class="form-item-value">
|
||||
<input type="text" name="resourceNameForEntity" value="${isResourceTypePattern?string('', (authorization.resourceName)!'')}" class="ui-widget ui-widget-content" readonly="readonly" />
|
||||
|
@ -134,14 +143,12 @@ readonly 是否只读操作,允许为null
|
|||
</div>
|
||||
<div class="form-item-value">
|
||||
<div class="permission-radios">
|
||||
<label for="${pageId}-permission_0" title="<@spring.message code='authorization.permission.Schema.PERMISSION_TABLE_DATA_READ.desc' />"><@spring.message code='authorization.permission.READ' /></label>
|
||||
<input type="radio" id="${pageId}-permission_0" name="permission" value="${Schema.PERMISSION_TABLE_DATA_READ}" />
|
||||
<label for="${pageId}-permission_1" title="<@spring.message code='authorization.permission.Schema.PERMISSION_TABLE_DATA_EDIT.desc' />"><@spring.message code='authorization.permission.EDIT' /></label>
|
||||
<input type="radio" id="${pageId}-permission_1" name="permission" value="${Schema.PERMISSION_TABLE_DATA_EDIT}" />
|
||||
<label for="${pageId}-permission_2" title="<@spring.message code='authorization.permission.Schema.PERMISSION_TABLE_DATA_DELETE.desc' />"><@spring.message code='authorization.permission.DELETE' /></label>
|
||||
<input type="radio" id="${pageId}-permission_2" name="permission" value="${Schema.PERMISSION_TABLE_DATA_DELETE}" />
|
||||
<label for="${pageId}-permission_3"><@spring.message code='authorization.permission.NONE' /></label>
|
||||
<input type="radio" id="${pageId}-permission_3" name="permission" value="${Authorization.PERMISSION_NONE_START}" />
|
||||
<#list resourceMeta.permissionMetas as pm>
|
||||
<label for="${pageId}-permission_${pm?counter}" title="<@spring.message code='${pm.permissionLabelDescKey}' />">
|
||||
<@spring.message code='${pm.permissionLabelKey}' />
|
||||
</label>
|
||||
<input type="radio" id="${pageId}-permission_${pm?counter}" name="permission" value="${pm.permission}" />
|
||||
</#list>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -196,9 +203,11 @@ readonly 是否只读操作,允许为null
|
|||
},
|
||||
submitHandler : function(form)
|
||||
{
|
||||
<#if resourceMeta.supportPattern>
|
||||
var resourceType = po.element("input[name='resourceType']:checked").val();
|
||||
if(resourceType == '${resourceTypePattern}')
|
||||
po.element("input[name='resource']").val(po.element("input[name='resourceNameForPattern']").val());
|
||||
</#if>
|
||||
|
||||
$(form).ajaxSubmit(
|
||||
{
|
||||
|
@ -223,17 +232,17 @@ readonly 是否只读操作,允许为null
|
|||
{
|
||||
pageParam :
|
||||
{
|
||||
submit : function(schema)
|
||||
submit : function(res)
|
||||
{
|
||||
po.element("input[name='resource']").val(schema.id);
|
||||
po.element("input[name='resourceNameForEntity']").val(schema.title);
|
||||
po.element("input[name='resource']").val(res.${resourceMeta.selectResourceIdField});
|
||||
po.element("input[name='resourceNameForEntity']").val(res.${resourceMeta.selectResourceNameField});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.setGridPageHeightOption(options);
|
||||
|
||||
po.open("${contextPath}/schema/select", options);
|
||||
po.open("${contextPath}${resourceMeta.selectResourceURL}", options);
|
||||
});
|
||||
|
||||
po.element(".principal-user-select-button").click(function()
|
||||
|
@ -282,6 +291,7 @@ readonly 是否只读操作,允许为null
|
|||
});
|
||||
</#if>
|
||||
|
||||
<#if resourceMeta.supportPattern>
|
||||
po.element("input[name='resourceType']").on("change", function()
|
||||
{
|
||||
var val = $(this).val();
|
||||
|
@ -291,7 +301,7 @@ readonly 是否只读操作,允许为null
|
|||
var $resourceNameForPattern = po.element("input[name='resourceNameForPattern']");
|
||||
var $resourceNameForEntity = po.element("input[name='resourceNameForEntity']");
|
||||
|
||||
if(val == '${Schema.AUTHORIZATION_RESOURCE_TYPE}')
|
||||
if(val == '${resourceMeta.resourceType}')
|
||||
{
|
||||
$formItemForPattern.hide();
|
||||
$formItemForEntity.show();
|
||||
|
@ -320,6 +330,15 @@ readonly 是否只读操作,允许为null
|
|||
</#if>
|
||||
}
|
||||
});
|
||||
<#else>
|
||||
<#if !readonly>
|
||||
po.element("input[name='resourceNameForEntity']").rules("add",
|
||||
{
|
||||
"required" : true,
|
||||
messages : {"required" : "<@spring.message code='validation.required' />"}
|
||||
});
|
||||
</#if>
|
||||
</#if>
|
||||
|
||||
po.element("input[name='principalType']").on("change", function()
|
||||
{
|
||||
|
@ -349,9 +368,11 @@ readonly 是否只读操作,允许为null
|
|||
</#if>
|
||||
});
|
||||
|
||||
po.element("input[name='resourceType'][value='${resourceType}']").attr("checked", "checked").change();
|
||||
po.element("input[name='resourceType']").checkboxradio({icon:false});
|
||||
po.element(".resourceType-radios").controlgroup();
|
||||
<#if resourceMeta.supportPattern>
|
||||
po.element("input[name='resourceType'][value='${resourceType}']").attr("checked", "checked").change();
|
||||
po.element("input[name='resourceType']").checkboxradio({icon:false});
|
||||
po.element(".resourceType-radios").controlgroup();
|
||||
</#if>
|
||||
|
||||
po.element("input[name='principalType'][value='${principalType}']").attr("checked", "checked").change();
|
||||
po.element("input[name='principalType']").checkboxradio({icon:false});
|
||||
|
@ -366,16 +387,20 @@ readonly 是否只读操作,允许为null
|
|||
po.element(".enabled-radios").controlgroup();
|
||||
|
||||
<#if appointResource??>
|
||||
po.element("input[name='resourceType'][value='${Schema.AUTHORIZATION_RESOURCE_TYPE}']").attr("checked", "checked").change();
|
||||
<#if resourceMeta.supportPattern>
|
||||
po.element("input[name='resourceType'][value='${resourceMeta.resourceType}']").attr("checked", "checked").change();
|
||||
po.element(".form-item-resourceType").hide();
|
||||
</#if>
|
||||
po.element("input[name='resource']").val("${appointResource}");
|
||||
po.element(".form-item-resourceType").hide();
|
||||
po.element(".form-item-resource-name-entity").hide();
|
||||
</#if>
|
||||
|
||||
<#--编辑时禁设资源类型,因为管理员也可能编辑普通用户设置的授权,而它们不允许是通配符-->
|
||||
<#if formAction == 'saveEdit'>
|
||||
po.element("input[name='resourceType'][value!='${resourceType}']").attr("disabled", "disabled");
|
||||
po.element("input[name='resourceType']").checkboxradio("refresh");
|
||||
<#if resourceMeta.supportPattern>
|
||||
po.element("input[name='resourceType'][value!='${resourceType}']").attr("disabled", "disabled");
|
||||
po.element("input[name='resourceType']").checkboxradio("refresh");
|
||||
</#if>
|
||||
</#if>
|
||||
})
|
||||
(${pageId});
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
<#include "../include/html_doctype.ftl">
|
||||
<#--
|
||||
String titleMessageKey 标题标签I18N关键字,不允许null
|
||||
ResourceMeta resourceMeta 资源元信息,不允许null
|
||||
-->
|
||||
<#assign AuthorizationController=statics['org.datagear.web.controller.AuthorizationController']>
|
||||
<html>
|
||||
<head>
|
||||
<#include "../include/html_head.ftl">
|
||||
<title><#include "../include/html_title_app_name.ftl"><@spring.message code='${titleMessageKey}' /></title>
|
||||
<title><#include "../include/html_title_app_name.ftl"><@spring.message code='${titleMessageKey}' /> - <@spring.message code='${resourceMeta.resouceTypeLabelKey}' /></title>
|
||||
</head>
|
||||
<body class="fill-parent">
|
||||
<#if !isAjaxRequest>
|
||||
|
@ -42,7 +43,6 @@ String titleMessageKey 标题标签I18N关键字,不允许null
|
|||
<#include "../include/page_obj_searchform_js.ftl">
|
||||
<#include "../include/page_obj_grid.ftl">
|
||||
<#include "../include/page_obj_data_permission.ftl">
|
||||
<#include "../include/page_obj_data_permission_ds_table.ftl">
|
||||
<script type="text/javascript">
|
||||
(function(po)
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ String titleMessageKey 标题标签I18N关键字,不允许null
|
|||
|
||||
po.url = function(action)
|
||||
{
|
||||
return "${contextPath}/authorization/" + action;
|
||||
return "${contextPath}/authorization/${resourceMeta.resourceType}/" + action;
|
||||
};
|
||||
|
||||
po.element("input[name=addButton]").click(function()
|
||||
|
@ -151,17 +151,11 @@ String titleMessageKey 标题标签I18N关键字,不允许null
|
|||
return data;
|
||||
};
|
||||
|
||||
var columnPermission = $.buildDataTablesColumnSimpleOption("<@spring.message code='authorization.permission' />", "permission");
|
||||
columnPermission.render = function(data, type, row, meta)
|
||||
{
|
||||
return po.toTableDataPermissionLabel(data);
|
||||
};
|
||||
|
||||
var tableColumns = [
|
||||
$.buildDataTablesColumnSimpleOption("<@spring.message code='id' />", "id", true),
|
||||
$.buildDataTablesColumnSimpleOption($.buildDataTablesColumnTitleSearchable("<@spring.message code='authorization.resource' />"), "resourceName"),
|
||||
$.buildDataTablesColumnSimpleOption($.buildDataTablesColumnTitleSearchable("<@spring.message code='authorization.principal' />"), "principalName"),
|
||||
columnPermission,
|
||||
$.buildDataTablesColumnSimpleOption("<@spring.message code='authorization.permission' />", "permissionLabel"),
|
||||
columnEnabled,
|
||||
$.buildDataTablesColumnSimpleOption("<@spring.message code='authorization.createUser' />", "createUser.nameLabel")
|
||||
];
|
||||
|
|
|
@ -402,7 +402,7 @@
|
|||
{
|
||||
var options = {};
|
||||
$.setGridPageHeightOption(options);
|
||||
po.open(contextPath+"/authorization/query", options);
|
||||
po.open(contextPath+"/authorization/${statics['org.datagear.management.domain.Schema'].AUTHORIZATION_RESOURCE_TYPE}/query", options);
|
||||
}
|
||||
else if($item.hasClass("system-set-personal-set"))
|
||||
{
|
||||
|
@ -705,7 +705,7 @@
|
|||
|
||||
var options = {};
|
||||
$.setGridPageHeightOption(options);
|
||||
po.open(contextPath+"/authorization/query?${statics['org.datagear.web.controller.AuthorizationController'].PARAM_APPOINT_RESOURCE}="+encodeURIComponent(schemaId), options);
|
||||
po.open(contextPath+"/authorization/${statics['org.datagear.management.domain.Schema'].AUTHORIZATION_RESOURCE_TYPE}/query?${statics['org.datagear.web.controller.AuthorizationController'].PARAM_APPOINT_RESOURCE}="+encodeURIComponent(schemaId), options);
|
||||
}
|
||||
else if($item.hasClass("schema-operation-reload"))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue