if(id==null)
{
result.setFailed(REPORT_TEMPCAT_ID_IS_NULL);
return result;
}
TemplateCat category = templateCatDAO.findById(id);
if(category==null)
{
result.setFailed(REPORT_TEMPCAT_NOT_EXIST);
return result;
}
String expression = category.getOperSet();//报表权限配置的权限与报表编辑的权限等同,需要修改!!!
if(!evaluateUserWithExp(expression))//检测用户是否具有'权限配置'权限
{
result.setFailed(HAS_NO_SET_AUTHENTICATION);
return result;
}
Object operObj = properties.get("oper_id");
Object authorityObj = properties.get("authority");
if(operObj==null)
{
result.setFailed(OPER_ID_IS_NULL);
return result;
}
if(authorityObj==null)
{
result.setFailed(AUTHORITY_IS_NULL);
return result;
}
String operation = stringValue(operObj);
String authority = stringValue(authorityObj);
if(operation.equalsIgnoreCase("add"))
{
expression = category.getOperAdd();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
category.setOperAdd(exp);
}
else if(operation.equalsIgnoreCase("delete"))
{
expression = category.getOperDelete();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
category.setOperDelete(exp);
}
else if(operation.equalsIgnoreCase("edit"))
{
expression = category.getOperEdit();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
category.setOperEdit(exp);
}
else if(operation.equalsIgnoreCase("modify"))
{
expression = category.getOperModify();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
category.setOperModify(exp);
}
else if(operation.equalsIgnoreCase("query"))
{
expression = category.getOperQuery();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
category.setOperQuery(exp);
}
else if(operation.equalsIgnoreCase("set"))
{
expression = category.getOperSet();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
category.setOperSet(exp);
}
templateCatDAO.merge(category);
result.setSucceed();
return result;
}