|
|
|
@ -35,7 +35,7 @@ public class RoleServiceImpl extends AbstractService<Role> implements RoleServic
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public List<Role> getRolesWithPermission(Permission perm, boolean centre) {
|
|
|
|
|
public List<Role> getRolesWithPermission(Permission perm, String moduleId, boolean centre) {
|
|
|
|
|
String wgClausule;
|
|
|
|
|
if (centre) {
|
|
|
|
|
wgClausule = "centre";
|
|
|
|
@ -44,17 +44,18 @@ public class RoleServiceImpl extends AbstractService<Role> implements RoleServic
|
|
|
|
|
}
|
|
|
|
|
Set<Permission> perms = new HashSet<Permission>();
|
|
|
|
|
perms.add(perm);
|
|
|
|
|
Query q = dao.getQuery("select r from Role r join r.permissions p where r." + wgClausule + " = true and p in (:perms)");
|
|
|
|
|
Query q = dao.getQuery("select r from Role r join r.permissions p where r." + wgClausule + " = true and p.module = :module and p in (:perms)");
|
|
|
|
|
q.setParameterList("perms", perms);
|
|
|
|
|
q.setParameter("module", moduleId);
|
|
|
|
|
return q.list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public List<Role> getRolesWithPermission(String authority, boolean centre) {
|
|
|
|
|
Query q = dao.getQuery("from Permission where authority = '" + authority + "'");
|
|
|
|
|
public List<Role> getRolesWithPermission(String authority, String moduleId, boolean centre) {
|
|
|
|
|
Query q = dao.getQuery("from Permission where authority = '" + authority + "' and module = '" + moduleId + "'");
|
|
|
|
|
Permission p = (Permission) q.uniqueResult();
|
|
|
|
|
return getRolesWithPermission(p, centre);
|
|
|
|
|
return getRolesWithPermission(p, moduleId, centre);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|