Mercurial > lada > lada-server
changeset 960:7fc536615624
Fixed authorization issues.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 27 May 2016 16:03:40 +0200 |
parents | 391ef3356b60 |
children | 091b955c12e7 |
files | src/main/java/de/intevation/lada/util/auth/MessungAuthorizer.java src/main/java/de/intevation/lada/util/auth/UserInfo.java |
diffstat | 2 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/util/auth/MessungAuthorizer.java Thu May 26 12:20:15 2016 +0200 +++ b/src/main/java/de/intevation/lada/util/auth/MessungAuthorizer.java Fri May 27 16:03:40 2016 +0200 @@ -116,22 +116,21 @@ repository.filterPlain(lstFilter.getQuery(), "stamm"); for (int i = 0; i < lsts.size(); i++) { if (lsts.get(i).getUmwId().equals(probe.getUmwId()) - && status.getStatusStufe() == 2 - && status.getStatusWert() != 4 - || status.getStatusStufe() == 3 + && (status.getStatusStufe() == 2 + || status.getStatusStufe() == 3) ) { statusEdit = true; } } } - else if (userInfo.getFunktionen().contains(2) && + if (userInfo.getFunktionenForNetzbetreiber(probe.getNetzbetreiberId()).contains(2) && userInfo.getNetzbetreiber().contains(probe.getNetzbetreiberId()) && (status.getStatusStufe() == 1 || status.getStatusStufe() == 2) && status.getStatusWert() >= 1 ) { statusEdit = true; } - else if (userInfo.getFunktionen().contains(1) && + if (userInfo.getFunktionenForMst(probe.getMstId()).contains(1) && userInfo.belongsTo(probe.getMstId(), probe.getLaborMstId()) && (status.getStatusStufe() <= 1 || status.getStatusWert() == 4) ) {
--- a/src/main/java/de/intevation/lada/util/auth/UserInfo.java Thu May 26 12:20:15 2016 +0200 +++ b/src/main/java/de/intevation/lada/util/auth/UserInfo.java Fri May 27 16:03:40 2016 +0200 @@ -10,6 +10,10 @@ import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + +import org.apache.log4j.Logger; + import de.intevation.lada.model.stamm.Auth; /** @@ -18,6 +22,8 @@ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> */ public class UserInfo { + private Logger logger = Logger.getLogger(UserInfo.class); + private String name; private Integer userId; private List<String> messstellen; @@ -109,10 +115,10 @@ if (a.getMstId() == null) { continue; } - if (a.getMstId().contains(messstelle) && - a.getLaborMstId() != null && + if (a.getMstId().contains(messstelle) || + (a.getLaborMstId() != null && labor != null && - a.getLaborMstId().contains(labor)) { + a.getLaborMstId().contains(labor))) { return true; } }