Project

General

Profile

Actions

Task #1694

closed

Automatic roles by contract state

Added by Alena Peterová almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Low
Assignee:
Radek Tomiška
Category:
Automatic roles
Target version:
Start date:
05/24/2019
Due date:
% Done:

100%

Estimated time:
Owner:

Description

Version: 9.6.2

When you define automatic role by attribute "ContractState=EXCLUDED", then following error occurs:

java.lang.ClassCastException: Cannot cast java.lang.String to eu.bcvsolutions.idm.core.api.domain.ContractState
    at java.lang.Class.cast(Class.java:3369)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService.castToType(DefaultIdmAutomaticRoleAttributeService.java:713)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService.getPredicateForRuleByContract(DefaultIdmAutomaticRoleAttributeService.java:506)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService.access$000(DefaultIdmAutomaticRoleAttributeService.java:106)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService$1.toPredicate(DefaultIdmAutomaticRoleAttributeService.java:469)
    at org.springframework.data.jpa.repository.support.SimpleJpaRepository.applySpecificationToCriteria(SimpleJpaRepository.java:587)
    at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:535)
    at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:520)
    at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:402)
    at sun.reflect.GeneratedMethodAccessor284.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:483)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:468)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:440)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:131)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy283.findAll(Unknown Source)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService.getContractsForAutomaticRole(DefaultIdmAutomaticRoleAttributeService.java:318)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService$$FastClassBySpringCGLIB$$4dda5ce1.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService$$EnhancerBySpringCGLIB$$264ce5f6.getContractsForAutomaticRole(<generated>)
    at eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessAutomaticRoleByAttributeTaskExecutor.process(ProcessAutomaticRoleByAttributeTaskExecutor.java:66)
    at eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessAutomaticRoleByAttributeTaskExecutor.process(ProcessAutomaticRoleByAttributeTaskExecutor.java:35)
    at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor.call(AbstractLongRunningTaskExecutor.java:189)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.springframework.security.concurrent.DelegatingSecurityContextRunnable.run(DelegatingSecurityContextRunnable.java:80)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Use-case:
I want to add some specific roles to all users, that are out of evidence.

Actions #1

Updated by Radek Tomiška over 4 years ago

  • Status changed from New to Needs feedback
  • Assignee changed from Ondřej Kopr to Vít Švanda
  • Target version set to Rhyolite (9.7.3)
  • % Done changed from 0 to 90

I've added support for automatic roles by contract state attribute.

Commit:
https://github.com/bcvsolutions/CzechIdMng/commit/2acccda9aa030a9a2c033d727fcd1bbb01923ccc

Could you do a feedback, please?

Actions #2

Updated by Vít Švanda over 4 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Vít Švanda to Radek Tomiška
  • % Done changed from 90 to 100

I did review. Works perfectly, now I can assigne automatic role to user with contract in EXCLUDED state. Thnaks for that.

Actions #3

Updated by Radek Tomiška over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF