Project

General

Profile

Actions

Defect #1695

closed

Automatic roles by assignedRoles

Added by Alena Peterová over 5 years ago. Updated over 5 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:
Affected versions:
Owner:

Description

Version: 9.6.2

When you define automatic role by an identity attribute "assignedRoles", then following error occurs:

org.springframework.dao.InvalidDataAccessApiUsageException: Unable to locate SingularAttribute  with the the given name [assignedRoles] on this ManagedType [eu.bcvsolutions.idm.core.api.entity.AbstractEntity]; nested exception is java.lang.IllegalArgumentException: Unable to locate SingularAttribute  with the the given name [assignedRoles] on this ManagedType [eu.bcvsolutions.idm.core.api.entity.AbstractEntity]
    at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:384)
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:227)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:436)
    at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
    at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
    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.$Proxy212.findAll(Unknown Source)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService.getContractsForAutomaticRole(DefaultIdmAutomaticRoleAttributeService.java:355)
    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$$d06c4dc9.getContractsForAutomaticRole(<generated>)
    at eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessAutomaticRoleByAttributeTaskExecutor.process(ProcessAutomaticRoleByAttributeTaskExecutor.java:67)
    at eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessAutomaticRoleByAttributeTaskExecutor.process(ProcessAutomaticRoleByAttributeTaskExecutor.java:34)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Unable to locate SingularAttribute  with the the given name [assignedRoles] on this ManagedType [eu.bcvsolutions.idm.core.api.entity.AbstractEntity]
    at org.hibernate.jpa.internal.metamodel.AbstractManagedType.checkNotNull(AbstractManagedType.java:144)
    at org.hibernate.jpa.internal.metamodel.AbstractManagedType.getSingularAttribute(AbstractManagedType.java:177)
    at org.hibernate.jpa.internal.metamodel.AbstractManagedType.getSingularAttribute(AbstractManagedType.java:175)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService.getPredicateForRuleByContract(DefaultIdmAutomaticRoleAttributeService.java:635)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService.access$000(DefaultIdmAutomaticRoleAttributeService.java:112)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService$1.toPredicate(DefaultIdmAutomaticRoleAttributeService.java:537)
    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.GeneratedMethodAccessor329.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)
    ... 20 more

I don't see use case for this (yet :-) ), so maybe just hide the option.

Actions #1

Updated by Ondřej Kopr over 5 years ago

I agree, this attribute doesn't make sense now. This enumeration is also used in provisioning and there is needed.

Actions #2

Updated by Radek Tomiška over 5 years ago

  • Status changed from New to Needs feedback
  • Target version set to Rhyolite (9.7.0)
  • % Done changed from 0 to 90

I fixed enumeration usage the same (ugly) way as for contract attributes. Assigned roles are not available for automatic roles by attribute now.
I fixed some localization issues for both enumeration (field was used instead a key).

Commit:
https://github.com/bcvsolutions/CzechIdMng/commit/7f861abca2ad1faa70913a5f1b6ee211b437b84f

Could you do a feedback, please?

Actions #3

Updated by Radek Tomiška over 5 years ago

  • Target version changed from Rhyolite (9.7.0) to Quartz (9.6.4)
Actions #4

Updated by Ondřej Kopr over 5 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Ondřej Kopr to Radek Tomiška
  • % Done changed from 90 to 100

Thank you for fixing this ugly thing! And also for you immediate fix the my issue.

I added documentation for another data types: https://wiki.czechidm.com/devel/documentation/roles/adm/automatic_roles#rules_for_automatic_roles_and_and_operator

Thank you.

Actions #5

Updated by Radek Tomiška over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF