X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=blobdiff_plain;f=org.argeo.app.ui%2Fsrc%2Forg%2Fargeo%2Fapp%2Fui%2FDefaultLeadPane.java;h=7b7a0319991f4fff4abb00037f2e19127509a29b;hp=44d43f657b4206a0b65c69a1d0b5d1fd806f8d99;hb=553773e18b2b0261d9f0baae99029d490c5999ac;hpb=23cb953f1408398ee2eb3fdbb82166a6aaa3bd33 diff --git a/org.argeo.app.ui/src/org/argeo/app/ui/DefaultLeadPane.java b/org.argeo.app.ui/src/org/argeo/app/ui/DefaultLeadPane.java index 44d43f6..7b7a031 100644 --- a/org.argeo.app.ui/src/org/argeo/app/ui/DefaultLeadPane.java +++ b/org.argeo.app.ui/src/org/argeo/app/ui/DefaultLeadPane.java @@ -43,7 +43,7 @@ public class DefaultLeadPane implements CmsUiProvider { private ClassLoader l10nClassLoader; @Override - public Control createUiPart(Composite parent, Content node) { + public Control createUiPart(Composite parent, Content node) { CmsView cmsView = CmsSwtUtils.getCmsView(parent); parent.setLayout(CmsSwtUtils.noSpaceGridLayout()); Composite appLayersC = new Composite(parent, SWT.NONE); @@ -72,7 +72,7 @@ public class DefaultLeadPane implements CmsUiProvider { } // boolean isAdmin = cmsView.doAs(() -> CurrentUser.isInRole(NodeConstants.ROLE_USER_ADMIN)); - Set userRoles = cmsView.doAs(() -> CurrentUser.roles()); + // Set userRoles = cmsView.doAs(() -> CurrentUser.roles()); Button first = null; layers: for (String layerDef : defaultLayers) { layerDef = layerDef.trim(); @@ -83,10 +83,21 @@ public class DefaultLeadPane implements CmsUiProvider { Set layerRoles = SuiteUtils.extractRoles(semiColArr); if (layers.containsKey(layerId)) { if (!layerRoles.isEmpty()) { - Set intersection = new HashSet(layerRoles); - intersection.retainAll(userRoles); - if (intersection.isEmpty()) + boolean authorized = false; + authorized = cmsView.doAs(() -> { + for (String layerRole : layerRoles) { + if (CurrentUser.implies(layerRole, null)) { + return true; + } + } + return false; + }); + if (!authorized) continue layers;// skip unauthorized layer +// Set intersection = new HashSet(layerRoles); +// intersection.retainAll(userRoles); +// if (intersection.isEmpty()) +// continue layers;// skip unauthorized layer } RankedObject layerObj = layers.get(layerId);