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