Mercurial > dive4elements > river
changeset 3492:d45fcf70b994
Don't display not allowed rivers to the user
Only return rivers that the user is allowed to see. Evaluate the allowed
features of the current logged in user and hide rivers which aren't
mentioned in the features list.
flys-client/trunk@5208 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Wed, 15 Aug 2012 12:11:41 +0000 |
parents | 1c9bfdbfb265 |
children | e703555f8da1 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java |
diffstat | 2 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Wed Aug 15 12:08:20 2012 +0000 +++ b/flys-client/ChangeLog Wed Aug 15 12:11:41 2012 +0000 @@ -1,4 +1,12 @@ 2012-08-15 Björn Ricks <bjoern.ricks@intevation.de> + + * src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java: + Only return rivers that the user is allowed to see. Evaluate the allowed + features of the current logged in user and hide rivers which aren't + mentioned in the features list. + +2012-08-15 Björn Ricks <bjoern.ricks@intevation.de> + * src/main/java/de/intevation/flys/client/client/services/RemoteServiceServlet.java: Implement an extended GWT RemoteServiceServlet to be able to get the current logged in user easily.
--- a/flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java Wed Aug 15 12:08:20 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java Wed Aug 15 12:11:41 2012 +0000 @@ -11,7 +11,6 @@ import org.apache.log4j.Logger; -import com.google.gwt.user.server.rpc.RemoteServiceServlet; import de.intevation.artifacts.common.ArtifactNamespaceContext; import de.intevation.artifacts.common.utils.XMLUtils; @@ -25,6 +24,8 @@ import de.intevation.flys.client.shared.model.River; import de.intevation.flys.client.client.services.RiverService; +import de.intevation.flys.client.server.auth.User; + /** * This interface provides a method to list the supported rivers of the artifact @@ -79,8 +80,10 @@ } int count = rivers.getLength(); + int rcount = 0; List<River> theRivers = new ArrayList<River>(count); + User user = this.getUser(); for (int i = 0; i < count; i++) { Node tmp = rivers.item(i); @@ -88,10 +91,13 @@ String name = XMLUtils.xpathString( tmp, "@art:name", ArtifactNamespaceContext.INSTANCE); - theRivers.add(new DefaultRiver(name)); + if (user.canUseFeature("river:" + name)) { + theRivers.add(new DefaultRiver(name)); + rcount++; + } } - return theRivers.toArray(new River[count]); + return theRivers.toArray(new River[rcount]); } catch (ConnectionException ce) { logger.error(ce, ce);