cancel
Showing results for 
Search instead for 
Did you mean: 

Access Denied. You do not have the appropriate permissions

wuchen
Champ in-the-making
Champ in-the-making
Hi All

I am trying to create a new user by


rootNodeRef = nodeService.getRootNode(storeRef);
NodeRef newPerson = personService.createPerson(createDefaultProperties(userName, "test",      "Hulley", "dh@dh","alfresco", rootNodeRef));
permissionService.setPermission(newPerson, userName,permissionService.getAllPermission(), true);
       

After created i am trying to login this user, the authentication is ok , but when i call the nodeService.getRootNode(storeRef);
will got the following errors :
org.alfresco.repo.security.permissions.AccessDeniedException: Access Denied. You do not have the appropriate permissions to perform this operation.
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:41)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:57)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
   at $Proxy78.getRootNode(Unknown Source)
   at com.mymcsb.dms.servlet.ViewResource.doGet(ViewResource.java:84)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at com.mymcsb.security.SecurityFilter.doFilter(SecurityFilter.java:102)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
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:144)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:37)
   … 25 more

what might be the problems ?  or any more information i need provide ? thanks for help

Regards
4 REPLIES 4

derek
Star Contributor
Star Contributor
Hi,

The executing code needs to be authenticated if you want to use the bean NodeService, which is given by the service registry.  If you used nodeService then no authentication would be required.

To authenticate, you have two choices.
Either use the AuthenticationService and login using a username and password (not nice in code), or use the authenticationComponentImpl bean and call setSystemUserAsCurrentUser.

It is very difficult to get away without authenticating a thread.  But you can use the internal services to simply the process.

Regards

wuchen
Champ in-the-making
Champ in-the-making
Hi:
Thanks for answering.
I "use the AuthenticationService and login using a username and password" by


authenticationService.authenticate(userName, password.toCharArray());

and did a checking just before i try to get the root node

logger.info("current user is "+authenticationService.getCurrentUserName());
NodeRef currentNode = nodeService.getRootNode(storeRef);

the output is fine, but i still get the same error for getRootNode().

output:
Feb 13, 2006 11:27:57 AM com.test.View doGet
INFO: current user is testuser4

error:
org.alfresco.repo.security.permissions.AccessDeniedException: Access Denied. You do not have the appropriate permissions to perform this operation.
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:41)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy78.getRootNode(Unknown Source)
at com.mymcsb.dms.servlet.ViewResource.doGet(ViewResource.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.mymcsb.security.SecurityFilter.doFilter(SecurityFilter.java:102)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
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:144)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:37)
… 25 more


I suspect this user don't have the correct permission to getRootNode(), how can i check user permissions ?and how to set user correct permissions ? As previous post , I try to set All permission when i create the new user by
permissionService.setPermission(newPerson, userName,permissionService.getAllPermission(), true);


btw, if i modify authority-services-context.xml
<property name="adminUsers">
        <set>
            <value>administrator</value>
          <value>testuser4</value>
       </set>
   </property>

The permission problem will be solved…

Thanks in advance for helping

Regards

wuchen
Champ in-the-making
Champ in-the-making
I think i solved it myself by reading the code at org.alfresco.repo.security.permissions.impl.PermissionServiceTest  to setting the proper permission for new users.

Thanks very much to all of u.

Regards

yjsosa
Champ in-the-making
Champ in-the-making

Hola amigos, a mí también me está sucediendo esto pero a la hora descargar carpetas como ZIP por los usuarios no admistradores. Yo corro Alfresco detrás de Nginx por HTTPS y tuve que modificar varios archivos para que Alfresco no diera muchos problemas al recibir las peticiones desde el nginx.

Este es el log:

2016-11-25 19:17:57,249  ERROR [repo.action.AsynchronousActionExecutionQueueImpl] [defaultAsyncAction3] Failed to execute asynchronous action: Action[ id=4e2102bd-7342-475a-aac5-722db5c79f86, node=null ]: Access is denied.
 org.alfresco.repo.security.permissions.AccessDeniedException: 10252582 Access Denied.  You do not have the appropriate permissions to perform this operation.
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:50)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:161)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:79)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:452)
        at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:69)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at com.sun.proxy.$Proxy10.getPath(Unknown Source)
        at org.alfresco.repo.exporter.ExporterComponent$DefaultCrawler.isWithinExport(ExporterComponent.java:936)
        at org.alfresco.repo.exporter.ExporterComponent$DefaultCrawler.walkNodeAssociations(ExporterComponent.java:760)
        at org.alfresco.repo.exporter.ExporterComponent$DefaultCrawler.export(ExporterComponent.java:324)
        at org.alfresco.repo.exporter.ExporterComponent.exportView(ExporterComponent.java:207)
        at org.alfresco.repo.download.CreateDownloadArchiveAction$1.doWork(CreateDownloadArchiveAction.java:196)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548)
        at org.alfresco.repo.download.CreateDownloadArchiveAction.executeImpl(CreateDownloadArchiveAction.java:178)
        at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:258)
        at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:838)
        at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:738)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:428)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:452)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:323)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:437)
        at org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:119)
        at org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:88)
        at org.alfresco.repo.tenant.TenantUtil$1.doWork(TenantUtil.java:62)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548)
        at org.alfresco.repo.tenant.TenantUtil.runAsUserTenant(TenantUtil.java:58)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:440)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)
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:398)
        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:46)
        ... 32 more
2016-11-25 19:18:18,164  ERROR [repo.action.AsynchronousActionExecutionQueueImpl] [defaultAsyncAction5] Failed to execute asynchronous action: Action[ id=58cfd1ab-dc01-409a-a6ce-ca1809a903de, node=null ]: Access is denied.
 org.alfresco.repo.security.permissions.AccessDeniedException: 10252583 Access Denied.  You do not have the appropriate permissions to perform this operation.
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:50)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:161)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:79)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:452)
        at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:69)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at com.sun.proxy.$Proxy10.getPath(Unknown Source)
        at org.alfresco.repo.exporter.ExporterComponent$DefaultCrawler.isWithinExport(ExporterComponent.java:936)
        at org.alfresco.repo.exporter.ExporterComponent$DefaultCrawler.walkNodeAssociations(ExporterComponent.java:760)
        at org.alfresco.repo.exporter.ExporterComponent$DefaultCrawler.export(ExporterComponent.java:324)
        at org.alfresco.repo.exporter.ExporterComponent.exportView(ExporterComponent.java:207)
        at org.alfresco.repo.download.CreateDownloadArchiveAction$1.doWork(CreateDownloadArchiveAction.java:196)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548)
        at org.alfresco.repo.download.CreateDownloadArchiveAction.executeImpl(CreateDownloadArchiveAction.java:178)
        at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:258)
        at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:838)
        at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:738)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:428)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:452)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:323)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:437)
        at org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:119)
        at org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:88)
        at org.alfresco.repo.tenant.TenantUtil$1.doWork(TenantUtil.java:62)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548)
        at org.alfresco.repo.tenant.TenantUtil.runAsUserTenant(TenantUtil.java:58)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:440)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)
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:398)
        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:46)
        ... 32 more