I once had a similar issue.
I want a list of links. One is based on the static role. The other links are only shown if the user has a role with the name identically to the database.
So my snippet might help you:
<ul sec:authorize="isAuthenticated()">
<li sec:authorize="hasAnyRole('ROLE_TYPEA','ROLE_TYPEB','ROLE_ADMIN')">
Edit Profile </li>
<li th:each="db : ${databases}"
th:if="${#authorization.expression('hasAnyRole(''ROLE_'+db.name()+''',''ROLE_ADMIN'')')}">
Calllog </li>
</ul>