permission not set

cancel
Showing results for 
Search instead for 
Did you mean: 
sergus_dev
Active Member II

permission not set

Jump to solution

Hello.

I'm use java api when set permission to nodeRef:

permissionService.setPermission(nodeRef, userName, PermissionService.CONTRIBUTOR, true);

but when I see nodeRef in my node browser I don't see the assigned rights for this user.

All what I see in my alfresco log is this(I think this is a consequence):

2021-05-19T14:28:21.816860615Z Caused by: org.apache.ibatis.reflection.ReflectionException: Error instantiating class java.util.ArrayList with invalid types () or values (). Cause: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
2021-05-19T14:28:21.816865845Z 	at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:90)
2021-05-19T14:28:21.816870724Z 	at org.apache.ibatis.reflection.factory.DefaultObjectFactory.create(DefaultObjectFactory.java:50)

why its not work?

1 Solution

Accepted Solutions
sergus_dev
Active Member II

Re: permission not set

Jump to solution

I found problem, that was in my script task variable.

View solution in original post

5 Replies
cristinamr
Advanced

Re: permission not set

Jump to solution

There is nothing wrong with that line. Could you please share with us the complete code? So, we can check what is hapening.

--
VenziaIT: helping companies since 2005! Our ECM products: AQuA & Seidoc
angelborroy
Alfresco Employee

Re: permission not set

Jump to solution

Are you executing that line as Alfresco Administrator?

Hyland Developer Evangelist
sergus_dev
Active Member II

Re: permission not set

Jump to solution

Class from activiti:

    <scriptTask id="initializeNextStep" name="Initialize next step" scriptFormat="javascript" activiti:autoStoreVariables="false">
      <extensionElements>
        <activiti:executionListener event="start" class="ru.customorg.repo.workflow.planning.StartStepExecutionListener"></activiti:executionListener>
      </extensionElements>
      <script><![CDATA[execution.setVariable('cowf_isRejected', false);]]></script>
    </scriptTask>

Part of code from that class:

						AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>() {
							@Override
							public Void doWork() {
								try {
									FilePermissionServiceImpl filePermissionService = (FilePermissionServiceImpl) WorkflowUtils
											.getServiceRegistry()
											.getService(QName.createQName(null, FilePermissionServiceImpl.BEAN));
									filePermissionService.addPermissions(docRef, userName);
								} catch (Exception e) {
									LOGGER.error("StartStepExecution permission error ", e);
								}

								return null;
							}
						}, AuthenticationUtil.getSystemUserName());

here my full stack trace:

2021-05-20T14:19:01.465071292Z Warning: Nashorn engine is planned to be removed from a future JDK release
2021-05-20T14:19:01.521319176Z  2021-05-20 14:19:01,508  ERROR [impl.interceptor.CommandContext] [http-nio-8080-exec-6] Error while closing command context
2021-05-20T14:19:01.521370262Z  org.apache.ibatis.exceptions.PersistenceException: 
2021-05-20T14:19:01.521377505Z ### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: Error instantiating class java.util.ArrayList with invalid types () or values (). Cause: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
2021-05-20T14:19:01.521384078Z ### The error may exist in org/activiti/db/mapping/entity/HistoricVariableInstance.xml
2021-05-20T14:19:01.521410577Z ### The error may involve org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.selectHistoricVariableInstanceByVariableInstanceId
2021-05-20T14:19:01.521417821Z ### The error occurred while handling results
2021-05-20T14:19:01.521422039Z ### SQL: select * from ACT_HI_VARINST where ID_ = ?
2021-05-20T14:19:01.521426327Z ### Cause: org.apache.ibatis.reflection.ReflectionException: Error instantiating class java.util.ArrayList with invalid types () or values (). Cause: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
2021-05-20T14:19:01.521430855Z 	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
2021-05-20T14:19:01.521435464Z 	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:122)
2021-05-20T14:19:01.521440473Z 	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:113)
2021-05-20T14:19:01.521444972Z 	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:73)
2021-05-20T14:19:01.521448689Z 	at org.activiti.engine.impl.db.DbSqlSession.selectOne(DbSqlSession.java:455)
2021-05-20T14:19:01.521453337Z 	at org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntityManager.findHistoricVariableInstanceByVariableInstanceId(HistoricVariableInstanceEntityManager.java:67)
2021-05-20T14:19:01.521458136Z 	at org.activiti.engine.impl.history.DefaultHistoryManager.recordVariableUpdate(DefaultHistoryManager.java:692)
2021-05-20T14:19:01.521462975Z 	at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.updateVariableInstance(VariableScopeImpl.java:829)
2021-05-20T14:19:01.521468135Z 	at org.activiti.engine.impl.persistence.entity.ExecutionEntity.updateVariableInstance(ExecutionEntity.java:1208)
2021-05-20T14:19:01.521473685Z 	at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariableLocal(VariableScopeImpl.java:710)
2021-05-20T14:19:01.521478304Z 	at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:617)
2021-05-20T14:19:01.521482953Z 	at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:590)
2021-05-20T14:19:01.521487721Z 	at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$5$\^eval\_/0x00000008013a4440.:program(<eval>:1)
2021-05-20T14:19:01.523356955Z 	... 368 more
2021-05-20T14:19:01.523361324Z Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
2021-05-20T14:19:01.523366203Z 	at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
2021-05-20T14:19:01.523370871Z 	at java.base/java.security.AccessController.checkPermission(AccessController.java:895)
2021-05-20T14:19:01.523375530Z 	at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:322)
2021-05-20T14:19:01.523386521Z 	at java.base/java.lang.Class.checkMemberAccess(Class.java:2848)
2021-05-20T14:19:01.523392111Z 	at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2550)
2021-05-20T14:19:01.523396830Z 	at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:62)
2021-05-20T14:19:01.523401459Z 	... 381 more

 

sergus_dev
Active Member II

Re: permission not set

Jump to solution

I found problem, that was in my script task variable.

EddieMay
Alfresco Employee

Re: permission not set

Jump to solution

Hi @sergus_dev 

Thanks for updating your thread.

Best wishes,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!