I'm trying to secure a call like this:
Since this code doesn't work as Spring is trying to call inexistant 'hasPermission(Authentication, Serializable, Class, Object)Code:<T extends ModelObject> T getEntity(@NotNull Class<T> entity, @NotNull Serializable id);
this could work:Code:@PreAuthorize("hasPermission(#id, #entity, read)") <T extends ModelObject> T getEntity(@NotNull Class<T> entity, @NotNull Serializable id);
but I get a:Code:@PreAuthorize("hasPermission(#id, #entity.getCanonicalName(), read)") <T extends ModelObject> T getEntity(@NotNull Class<T> entity, @NotNull Serializable id);
suggesting the method call is made on the 'T' instead of the Class type itself.Code:org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 0): Method call: Method getCanonicalName() cannot be found on com.company.common.model.member.Member type
I can't find anything on hasPermission and generics either on the forum or on the web.
I'm a newbie in SPel (Acl as well indeed) so any suggestion might help!


Reply With Quote