cancel
Showing results for 
Search instead for 
Did you mean: 

Create Folder issues

chapeaurouge
Champ in-the-making
Champ in-the-making
Hi all,

I have a weird issue… if someone could explain to me why this would happen. This is an Alfresco 3.2r1 release.

I have a script that creates a folder. If I create the folder as follows, it works fine:
acc_node = space.parent.createFolder(idtituadrl);

However, if I do script it as such (which I ultimately want to do, it fails with an Access denied error:
acc_node = space.parent.createNode("" + idtituadrl, "bibo:bo_folder", props);

Same user, same everything. Just that one line changes. Using the hasPermissions("CreateChildren") and ("Write"), both return true.

09:28:28,845  DEBUG [repo.jscript.ScriptLogger] Permission create children: true
09:28:28,845  DEBUG [repo.jscript.ScriptLogger] Permission Write: true
09:28:28,918  ERROR [repo.action.AsynchronousActionExecutionQueueImpl] Failed to execute asynchronous action: Action[ id=1d25bcfc-db28-43e0-a130-cff0b6e6d5b7, node=workspace://SpacesStore/1d25bcfc-db28-43e0-a130-cff0b6e6d5b7 ]
org.alfresco.scripts.ScriptException: 04170020 Failed to execute script 'workspace://SpacesStore/403ab5be-b0ec-40da-b62c-d1c67a6568ca': 04170019 Access Denied.  You do not have the appropriate permissions to perform this operation.
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:228)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:187)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:147)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy205.executeScript(Unknown Source)
   at org.alfresco.repo.action.executer.ScriptActionExecuter.executeImpl(ScriptActionExecuter.java:170)
   at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:127)
   at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:711)
   at org.alfresco.repo.action.executer.CompositeActionExecuter.executeImpl(CompositeActionExecuter.java:72)
   at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:127)
   at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:711)
   at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:648)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:369)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:326)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:233)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:378)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:503)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:381)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:619)
Caused by: org.alfresco.repo.security.permissions.AccessDeniedException: 04170019 Access Denied.  You do not have the appropriate permissions to perform this operation.
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:147)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy9.moveNode(Unknown Source)
   at org.alfresco.repo.jscript.ScriptNode.move(ScriptNode.java:1592)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
   at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
   at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
   at org.mozilla.javascript.gen.c14._c0(workspace://SpacesStore/403ab5be-b0ec-40da-b62c-d1c67a6568ca:136)
   at org.mozilla.javascript.gen.c14.call(workspace://SpacesStore/403ab5be-b0ec-40da-b62c-d1c67a6568ca)
   at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
   at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
   at org.mozilla.javascript.gen.c14.call(workspace://SpacesStore/403ab5be-b0ec-40da-b62c-d1c67a6568ca)
   at org.mozilla.javascript.gen.c14.exec(workspace://SpacesStore/403ab5be-b0ec-40da-b62c-d1c67a6568ca)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:457)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:224)
   … 34 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:171)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   … 57 more

Any ideas? Thanks a lot.
fred
11 REPLIES 11

jm_pascal
Star Contributor
Star Contributor
hi.

I think there's a difference between how to create a cm:folder and  how you want to create your bibo:bo_folder…
Maybe you have defined special permission when you create your custom folder…

chapeaurouge
Champ in-the-making
Champ in-the-making
Not really, well, from my model which only contains the type for this folder, very basic.

<types>
      <type name="bibo:bo_folder">
      <title>BO folder</title>
         <properties>
            <property name="bibo:account_number">
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            <property name="bibo:cli_name">
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
         </properties>
      </type>
   </types>

jm_pascal
Star Contributor
Star Contributor
Is it normal that your custom folder don't have <parent> tag ?

chapeaurouge
Champ in-the-making
Champ in-the-making
mmhh… I omitted it (on purpose), but this may have broken off the link to cm:folder? I'll modify the model and post an update. Thanks.

chapeaurouge
Champ in-the-making
Champ in-the-making
Modified it, but same error.

jm_pascal
Star Contributor
Star Contributor
Each permission is linked with a basic alfresco type like cm:folder, sys:base or cm:content…
For you, this is a new type. There are no default link between your custom type and default alfresco permission…

chapeaurouge
Champ in-the-making
Champ in-the-making
Right.. I import both "cm" and "d" URIs, and now, the parent of my custom type is "cm:folder", so these basic permissions should now be set correct? Or what else would I be missing? Thx.

jm_pascal
Star Contributor
Star Contributor
Yes it should be working…
Except if you have special right or permission in your parent folder…

chapeaurouge
Champ in-the-making
Champ in-the-making
No, that same user is used for both methods, and it works for one and not the other. The user has all rights on the parent folder, and rights are inherited down.
If you stumble into something, please let me know. Thanks already for your time and help.
I'll post an update if I do find something.
fred