我的 Alfresco 应用程序的 Share 部分有问题。确实,当我以普通帐户(不是管理员)登录并访问未选中“中等”选项的已创建站点时,每次我想修改站点的详细信息时都会收到一条错误消息,并且检查中度选项。
错误消息如下:
04110011 Wrapped Exception (with status template): 04110169 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/repository/site/site.put.json.js': 04110168 Access denied. You don't have the permission to perform this operation.
当站点已在“中等”选项下创建或您以管理员帐户登录时,该问题永远不会发生。
这里有控制台日志:
ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 04110001 Wrapped Exception (with status template): 04110097 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/repository/site/site.put.json.js': 04110096 Access refusé. Vous n'avez pas la permission de réaliser cette opération.
org.springframework.extensions.webscripts.WebScriptException: 04110001 Wrapped Exception (with status template): 04110097 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/repository/site/site.put.json.js': 04110096 Access refusé. Vous n'avez pas la permission de réaliser cette opération.
at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:758)
at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:383)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:436)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:304)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: org.alfresco.scripts.ScriptException: 04110097 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/repository/site/site.put.json.js': 04110096 Access refusé. Vous n'avez pas la permission de réaliser cette opération.
at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:194)
at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:282)
at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:981)
at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
... 24 more
Caused by: org.alfresco.repo.security.permissions.AccessDeniedException: 04110096 Access refusé. Vous n'avez pas la permission de réaliser cette opération.
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:48)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:217)
at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:184)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:137)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy53.setPermission(Unknown Source)
at org.alfresco.repo.site.SiteServiceImpl.setModeratedPermissions(SiteServiceImpl.java:1680)
at org.alfresco.repo.site.SiteServiceImpl.updateSite(SiteServiceImpl.java:1068)
at org.alfresco.repo.site.script.Site.save(Site.java:279)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119)
at org.mozilla.javascript.gen.c44._c11(file:/C:/workspace_starter/Tomcat/home/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/site/site.put.json.js:337)
at org.mozilla.javascript.gen.c44.call(file:/C:/workspace_starter/Tomcat/home/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/site/site.put.json.js)
at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
at org.mozilla.javascript.gen.c44._c0(file:/C:/workspace_starter/Tomcat/home/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/site/site.put.json.js:366)
at org.mozilla.javascript.gen.c44.call(file:/C:/workspace_starter/Tomcat/home/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/site/site.put.json.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at org.mozilla.javascript.gen.c44.call(file:/C:/workspace_starter/Tomcat/home/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/site/site.put.json.js)
at org.mozilla.javascript.gen.c44.exec(file:/C:/workspace_starter/Tomcat/home/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/site/site.put.json.js)
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:472)
at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:190)
... 28 more
Caused by: net.sf.acegisecurity.AccessDeniedException: Access is denied.
at net.sf.acegisecurity.vote.AffirmativeBased.decide(AffirmativeBased.java:86)
at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:394)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
... 58 more
该错误来自“site.put.json.js”网页脚本,其中包含以下源代码:
<import resource="classpath:alfresco/module/customAlfrescoAMP/javascript/tsUtils.js">
<import resource="classpath:alfresco/module/customAlfrescoAMP/javascript/ts-constants.js">
function main()
{
// Get the site
var shortName = url.extension;
var site = siteService.getSite(shortName);
if (site != null)
{
// Updafte the sites details
if (json.has("title") == true)
{
site.title = json.get("title");
}
if (json.has("description") == true)
{
site.description = json.get("description");
}
// Use the visibility flag before the isPublic flag
if (json.has("visibility") == true)
{
site.visibility = json.get("visibility");
}
else if (json.has("isPublic") == true)
{
// Deal with deprecated isPublic flag accordingly
var isPublic = json.getBoolean("isPublic");
if (isPublic == true)
{
site.visibility = siteService.PUBLIC_SITE;
}
else
{
site.visibility = siteService.PRIVATE_SITE;
}
}
//début modif T&S
if (!site.node.hasAspect("st:siteType"))
{
site.node.addAspect("st:siteType");
}
var siteType = "";
if (json.has("type") == true)
{
siteType = json.get("type");
}
var assocs = site.node.assocs["st:siteTypeAssoc"];
if (assocs != null && assocs.length == 1) {
site.node.removeAssociation(assocs[0], "st:siteTypeAssoc");
assocs[0].remove();
}
var siteTypeNode = site.node.createNode(null, "cm:content");
siteTypeNode.content = siteType;
site.node.createAssociation(siteTypeNode, "st:siteTypeAssoc");
var siteiconNodeRef = null;
if (json.has("siteiconNodeRef"))
{
siteiconNodeRef = json.get("siteiconNodeRef");
}
if (siteiconNodeRef != null && siteiconNodeRef != "")
{
var image = search.findNode(siteiconNodeRef);
// ensure cm:person has 'cm:preferences' aspect applied - as we want to add the avatar as
// the child node of the 'cm:preferenceImage' association
if (!site.node.hasAspect("st:siteIcon"))
{
site.node.addAspect("st:siteIcon");
}
// remove old image child node if we already have one
var assocs = site.node.assocs["st:siteIconAssoc"];
if (assocs != null && assocs.length == 1)
{
site.node.removeAssociation(assocs[0], "st:siteIconAssoc");
//no need to remove the image ?
//assocs[0].remove();
}
//images are created in userhome, move them to the site
image.move(site.node);
site.node.createAssociation(image, "st:siteIconAssoc");
}
//fin modif T&S
// Save the site
site.save();
var members = site.listMembers(null, null, 0);
var templateNodeRef = search.luceneSearch( "@\\{http\\://www.alfresco.org/model/content/1.0\\}name:\"edit-site-mail.ftl\"")[0].nodeRef;
for (username in members)
{
/*var mail = actions.create("mail");
mail.parameters.to_many = users;
mail.parameters.subject = EDIT_SITE_MAIL_SUBJECT + site.title;
mail.parameters.template = templateNodeRef;
mail.execute(site.node);
*/
createAndSendHtmlMail(site.node, EDIT_SITE_MAIL_SUBJECT + site.title, people.getPerson(username).properties["cm:email"], "", templateNodeRef, null);
}
// Pass the model to the template
model.site = site;
}
else
{
// Return 404
status.setCode(status.STATUS_NOT_FOUND, "Site " + shortName + " does not exist");
return;
}
}
main();
所以,如果你有什么建议...