AnsweredAssumed Answered

Error when accessing permissions.get.js

Question asked by laurent1050 on Dec 7, 2010
Latest reply on Dec 8, 2010 by kevinr
In a custom web script, I'm calling permissions.get.js to get the full permissions on a node.


var currentNode = args.current;
var servicePermissions = "/slingshot/doclib/permissions/" + currentNode.replace(":/", "");

// Authentication
var ticket = session.getTicket();
if (ticket != null) {
   var urlParts = servicePermissions.split("?");
   if (urlParts.length > 1) {
      servicePermissions += "&guest=false&alf_ticket=" + ticket;
   } else {
      servicePermissions += "?guest=false&alf_ticket=" + ticket;
   }
}

// Call webscript
var connector = remote.connect("alfresco");
result = connector.get(servicePermissions);
if (result.status == 200) {
   var perms = eval('(' + result + ')');
   model.permissions = perms;
}

This webscript is run as invite
<authentication runas="invite">none</authentication>

invite is a user that as a read access to the nodes (no problem to access the nodes and their content), but can't access the permissions, Caused by: net.sf.acegisecurity.AccessDeniedException: Access is denied.

I don't understand why the access to permissions is restricted ???

Full stacktrace.

08:52:54,992 ERROR [org.springframework.extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 11070040 Wrapped Exception (with status template): 11070111 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js': 11070110 Access refusé.  Vous n'avez pas la permission de réaliser cette opération.
org.springframework.extensions.webscripts.WebScriptException: 11070040 Wrapped Exception (with status template): 11070111 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js': 11070110 Access refusé.  Vous n'avez pas la permission de réaliser cette opération.
   at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:740)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:167)
   at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:367)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:325)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:417)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:434)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:298)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:319)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:177)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)
   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.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:128)
   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:286)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Thread.java:636)
Caused by: org.alfresco.scripts.ScriptException: 11070111 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js': 11070110 Access refusé.  Vous n'avez pas la permission de réaliser cette opération.
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:183)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:268)
   at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
   at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:971)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
   … 21 more
Caused by: org.alfresco.repo.security.permissions.AccessDeniedException: 11070110 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:47)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:135)
   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 $Proxy38.getAllSetPermissions(Unknown Source)
   at org.alfresco.repo.jscript.ScriptNode.retrieveAllSetPermissions(ScriptNode.java:1300)
   at org.alfresco.repo.jscript.ScriptNode.getDirectPermissions(ScriptNode.java:1276)
   at sun.reflect.GeneratedMethodAccessor696.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:616)
   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.c42._c9(file:/v5h/web-apps/prod/j2ee/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js:481)
   at org.mozilla.javascript.gen.c42.call(file:/v5h/web-apps/prod/j2ee/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js)
   at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
   at org.mozilla.javascript.gen.c42._c0(file:/v5h/web-apps/prod/j2ee/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js:562)
   at org.mozilla.javascript.gen.c42.call(file:/v5h/web-apps/prod/j2ee/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js)
   at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
   at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
   at org.mozilla.javascript.gen.c42.call(file:/v5h/web-apps/prod/j2ee/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js)
   at org.mozilla.javascript.gen.c42.exec(file:/v5h/web-apps/prod/j2ee/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:453)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:179)
   … 25 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:43)
   … 51 more
08:52:55,158 ERROR [freemarker.runtime]
And I've the same problem in a ftl using
<#list companyhome.nodeByReference[d.nodeRef].permissions as perm>
Thanks,
Laurent

Outcomes