exo-addons / outlook

Add-on for Microsoft Outlook
GNU General Public License v3.0
2 stars 2 forks source link

AccessDeniedException when creating Uploads folder in a space #6

Closed pnedonosko closed 7 years ago

pnedonosko commented 7 years ago

AccessDeniedException happened for one of users in production. He faced the problem in space where he seems was not a manager. User was unable to access the Uploads folder when tried attach a document to his message in Outlook.

2016-11-18 09:05:54,454 | ERROR | Error showing add attachments form [org.exoplatform.outlook.portlet.Outlook<http-nio-127.0.0.1-10180-exec-33>] 
javax.jcr.AccessDeniedException: Access denied: ADD_NODE []:1[]Groups:1[]spaces:1[]free_space:1[]Documents:1[]Uploads:1 for: benjmestrallet item owner __system
    at org.exoplatform.services.jcr.impl.core.SessionDataManager.validateAccessPermissions(SessionDataManager.java:1719) ~[exo.jcr.component.core-1.17.0-M11.jar:1.17.0-M11]
    at org.exoplatform.services.jcr.impl.core.SessionDataManager.validate(SessionDataManager.java:1669) ~[exo.jcr.component.core-1.17.0-M11.jar:1.17.0-M11]
    at org.exoplatform.services.jcr.impl.core.SessionDataManager.commit(SessionDataManager.java:1556) ~[exo.jcr.component.core-1.17.0-M11.jar:1.17.0-M11]
    at org.exoplatform.services.jcr.impl.core.ItemImpl.save(ItemImpl.java:706) ~[exo.jcr.component.core-1.17.0-M11.jar:1.17.0-M11]
    at org.exoplatform.outlook.OutlookServiceImpl$OutlookSpaceImpl$RootFolder.readSubnodes(OutlookServiceImpl.java:546) ~[exo-outlook-services-1.0.0-RC1.jar:1.0.0-RC1]
    at org.exoplatform.outlook.jcr.Folder.hasSubfolders(Folder.java:78) ~[exo-outlook-services-1.0.0-RC1.jar:1.0.0-RC1]
    at org.exoplatform.outlook.OutlookServiceImpl$OutlookSpaceImpl$RootFolder.<init>(OutlookServiceImpl.java:526) ~[exo-outlook-services-1.0.0-RC1.jar:1.0.0-RC1]
    at org.exoplatform.outlook.OutlookServiceImpl$OutlookSpaceImpl.getRootFolder(OutlookServiceImpl.java:604) ~[exo-outlook-services-1.0.0-RC1.jar:1.0.0-RC1]
    at org.exoplatform.outlook.portlet.Outlook.addAttachmentForm(Outlook.java:564) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_66]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_66]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_66]
    at juzu.impl.request.Stage$Invoke.response(Stage.java:385) ~[juzu-core-1.1.3.jar:na]

Similar exception happened when he tried save attachment to eXo:

2016-11-19 16:37:19,882 | ERROR | Error showing save attachments form [org.exoplatform.outlook.portlet.Outlook<http-nio-127.0.0.1-10180-exec-48>] 
juzu.template.TemplateExecutionException: Groovy template exception for template org.exoplatform.outlook.portlet.templates.saveAttachment
    at juzu.impl.template.spi.juzu.dialect.gtmpl.GroovyTemplateStub.buildRuntimeException(GroovyTemplateStub.java:196) ~[juzu-core-1.1.3.jar:na]
    at juzu.impl.template.spi.juzu.dialect.gtmpl.GroovyTemplateStub.doRender(GroovyTemplateStub.java:146) ~[juzu-core-1.1.3.jar:na]
    at juzu.impl.template.spi.TemplateStub.render(TemplateStub.java:109) ~[juzu-core-1.1.3.jar:na]
    at juzu.template.TemplateRenderContext.render(TemplateRenderContext.java:154) ~[juzu-core-1.1.3.jar:na]
    at juzu.template.Template$Builder.doRender(Template.java:415) ~[juzu-core-1.1.3.jar:na]
    at juzu.template.Template$Builder.doRender(Template.java:330) ~[juzu-core-1.1.3.jar:na]
    at juzu.template.Template$Builder.status(Template.java:485) ~[juzu-core-1.1.3.jar:na]
    at juzu.template.Template$Builder.ok(Template.java:465) ~[juzu-core-1.1.3.jar:na]
    at org.exoplatform.outlook.portlet.Outlook.saveAttachmentForm(Outlook.java:431) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_66]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_66]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_66]
...
Caused by: javax.jcr.AccessDeniedException: Access denied: ADD_NODE []:1[]Groups:1[]spaces:1[]free_space:1[]Documents:1[]Uploads:1 for: benjmestrallet item owner __system
    at org.exoplatform.services.jcr.impl.core.SessionDataManager.validateAccessPermissions(SessionDataManager.java:1719) ~[exo.jcr.component.core-1.17.0-M11.jar:1.17.0-M11]
    at org.exoplatform.services.jcr.impl.core.SessionDataManager.validate(SessionDataManager.java:1669) ~[exo.jcr.component.core-1.17.0-M11.jar:1.17.0-M11]
    at org.exoplatform.services.jcr.impl.core.SessionDataManager.commit(SessionDataManager.java:1556) ~[exo.jcr.component.core-1.17.0-M11.jar:1.17.0-M11]
    at org.exoplatform.services.jcr.impl.core.ItemImpl.save(ItemImpl.java:706) ~[exo.jcr.component.core-1.17.0-M11.jar:1.17.0-M11]
    at org.exoplatform.outlook.OutlookServiceImpl$OutlookSpaceImpl$RootFolder.readSubnodes(OutlookServiceImpl.java:546) ~[exo-outlook-services-1.0.0-RC1.jar:1.0.0-RC1]
    at org.exoplatform.outlook.jcr.Folder.hasSubfolders(Folder.java:78) ~[exo-outlook-services-1.0.0-RC1.jar:1.0.0-RC1]
    at org.exoplatform.outlook.OutlookServiceImpl$OutlookSpaceImpl$RootFolder.<init>(OutlookServiceImpl.java:526) ~[exo-outlook-services-1.0.0-RC1.jar:1.0.0-RC1]
    at org.exoplatform.outlook.OutlookServiceImpl$OutlookSpaceImpl.getRootFolder(OutlookServiceImpl.java:604) ~[exo-outlook-services-1.0.0-RC1.jar:1.0.0-RC1]
    at sun.reflect.GeneratedMethodAccessor1437.invoke(Unknown Source) ~[na:na]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_66]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_66]
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) ~[groovy-all-1.8.9.jar:1.8.9]
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) ~[groovy-all-1.8.9.jar:1.8.9]
    at groovy.lang.MetaClassImpl$GetBeanMethodMetaProperty.getProperty(MetaClassImpl.java:3500) ~[groovy-all-1.8.9.jar:1.8.9]
    at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:61) ~[groovy-all-1.8.9.jar:1.8.9]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227) ~[groovy-all-1.8.9.jar:1.8.9]
    at org.exoplatform.outlook.portlet.templates.myscript.run(myscript) ~[na:na]
    at juzu.impl.template.spi.juzu.dialect.gtmpl.GroovyTemplateStub.doRender(GroovyTemplateStub.java:139) ~[juzu-core-1.1.3.jar:na]
    ... 188 common frames omitted
pnedonosko commented 7 years ago

Such situation when space member cannot write in the space Documents might be issued by Platform Content UI issue PLF-7073. But folder permissions may be changed specially for some usecase, thus the add-on should work with them correctly and letting an user to know what a reason failed saving attachments. For this reason we don't create Uploads folder when cannot do this due to access exception and later, when user will try save in this folder, we will show the original error message to the user.