# HG changeset patch # User Bjoern Ricks # Date 1345032701 0 # Node ID d45fcf70b994994235fcf5512d46b0d8694b3832 # Parent 1c9bfdbfb26591a525854f97c83f342d6d8117e2 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 diff -r 1c9bfdbfb265 -r d45fcf70b994 flys-client/ChangeLog --- 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 + + * 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 + * 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. diff -r 1c9bfdbfb265 -r d45fcf70b994 flys-client/src/main/java/de/intevation/flys/client/server/RiverServiceImpl.java --- 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 theRivers = new ArrayList(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);