if(id==null)
{
result.setFailed(REPORT_TEMPLATE_ID_IS_NULL);
return result;
}
ReportTemplate template = reportTemplateDAO.findById(id);
if(template==null)
{
result.setFailed(REPORT_TEMPLATE_NOT_EXIST);
return result;
}
String expression = template.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 = template.getOperAdd();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
template.setOperAdd(exp);
}
else if(operation.equalsIgnoreCase("delete"))
{
expression = template.getOperDelete();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
template.setOperDelete(exp);
}
else if(operation.equalsIgnoreCase("edit"))
{
expression = template.getOperEdit();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
template.setOperEdit(exp);
}
else if(operation.equalsIgnoreCase("modify"))
{
expression = template.getOperModify();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
template.setOperModify(exp);
}
else if(operation.equalsIgnoreCase("query"))
{
expression = template.getOperQuery();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
template.setOperQuery(exp);
}
else if(operation.equalsIgnoreCase("set"))
{
expression = template.getOperSet();
String exp = AuthorityExpUtility.deleteRole4Expression(expression, authority);
template.setOperSet(exp);
}
reportTemplateDAO.merge(template);
result.setSucceed();
return result;
}