Fixed a bug in AssetRepository
parent
5c140fd98f
commit
2533c16196
|
|
@ -280,7 +280,8 @@ public class AssetRepository
|
||||||
final String uuid, final Class<T> type) {
|
final String uuid, final Class<T> type) {
|
||||||
|
|
||||||
final TypedQuery<Asset> query = entityManager.createNamedQuery(
|
final TypedQuery<Asset> query = entityManager.createNamedQuery(
|
||||||
"Asset.findByUuidAndType", Asset.class);
|
"Asset.findByUuidAndType", Asset.class
|
||||||
|
);
|
||||||
query.setParameter("uuid", uuid);
|
query.setParameter("uuid", uuid);
|
||||||
query.setParameter("type", type);
|
query.setParameter("type", type);
|
||||||
setAuthorizationParameters(query);
|
setAuthorizationParameters(query);
|
||||||
|
|
@ -721,7 +722,13 @@ public class AssetRepository
|
||||||
final boolean isSystemUser = shiro.isSystemUser();
|
final boolean isSystemUser = shiro.isSystemUser();
|
||||||
final boolean isAdmin = permissionChecker.isPermitted("*");
|
final boolean isAdmin = permissionChecker.isPermitted("*");
|
||||||
|
|
||||||
query.setParameter("roles", roles);
|
// The roles collection is passed to an IN JPQL query. JPQL/SQL
|
||||||
|
// does not allow empty collections as parameter of IN. But null works...
|
||||||
|
if (roles.isEmpty()) {
|
||||||
|
query.setParameter("roles", null);
|
||||||
|
} else {
|
||||||
|
query.setParameter("roles", roles);
|
||||||
|
}
|
||||||
query.setParameter("isSystemUser", isSystemUser);
|
query.setParameter("isSystemUser", isSystemUser);
|
||||||
query.setParameter("isAdmin", isAdmin);
|
query.setParameter("isAdmin", isAdmin);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -782,7 +782,7 @@ public class ContentItemRepository
|
||||||
final boolean isAdmin = permissionChecker.isPermitted("*");
|
final boolean isAdmin = permissionChecker.isPermitted("*");
|
||||||
|
|
||||||
// The roles collection is passed to an IN JPQL query. JPQL/SQL
|
// The roles collection is passed to an IN JPQL query. JPQL/SQL
|
||||||
// does not allow empty collections as paramete of IN. But null works...
|
// does not allow empty collections as parameter of IN. But null works...
|
||||||
if (roles.isEmpty()) {
|
if (roles.isEmpty()) {
|
||||||
query.setParameter("roles", null);
|
query.setParameter("roles", null);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue