@Override public boolean hasRole(User user, String role) { Authorization authorization = m_useradmin.getAuthorization(user); return authorization.hasRole(role); }
@Override public boolean isUserInRole(String role) { Authorization authorization = (Authorization) getAttribute(HttpContext.AUTHORIZATION); if (authorization != null) { return authorization.hasRole(role); } return super.isUserInRole(role); }
@Override public boolean isNoAppPermitted(String user) { User usr = (User) usrAdmin.getRole(user); if (usr == null) return false; Authorization auth = usrAdmin.getAuthorization(usr); return auth.hasRole(NOAPPS); }
@Override public boolean isUserInRole(String role) { Authorization authorization = (Authorization) getAttribute(HttpContext.AUTHORIZATION); if (authorization != null) { return authorization.hasRole(role); } return super.isUserInRole(role); }
@Override public boolean isAllAppsPermitted(String user) { User usr = (User) usrAdmin.getRole(user); if (usr == null) return false; Authorization auth = usrAdmin.getAuthorization(usr); return auth.hasRole(ALLAPPS); }
/** * Developers can override this method. * * For example, if a developer has a modeled or otherwise controlled access to the UserAdmin service, it is possible * to provide specialized access here. * * @param role the name of the action to test for authorization * * @return {@code true} if the currently logged in user is authorized to perform the action described in the "role" * parameter, {@code false} otherwise */ public boolean isAuthorized(String role) { // This is totally hackish. // The only way to avoid this is to use something other than // AuthenticatedWebSession. As it stands, we are trying to force // a use case on AuthenticatedWebSession that it was not intended for. final PaxWicketAuthentication paxWicketAuth = (PaxWicketAuthentication) AuthenticatedWebSession.get(); final String loginName = paxWicketAuth.getLoggedInUser(); final User user = getUser(userAdmin, loginName); if (null == user) { return false; } final Authorization auth = userAdmin.getAuthorization(user); return auth.hasRole(role); }
int count = 0; for (String role : new String[] { "viewArtifact", "viewFeature", "viewDistribution", "viewTarget" }) { if (auth.hasRole(role)) { count++; if (auth.hasRole("viewArtifact")) { m_grid.addComponent(artifactsPanelWrapper, count, 2); m_grid.addComponent(m_artifactToolbar, count, 1); m_featureToolbar = createFeatureToolbar(); if (auth.hasRole("viewFeature")) { m_grid.addComponent(m_featuresPanel, count, 2); m_grid.addComponent(m_featureToolbar, count, 1); m_distributionToolbar = createDistributionToolbar(); if (auth.hasRole("viewDistribution")) { m_grid.addComponent(m_distributionsPanel, count, 2); m_grid.addComponent(m_distributionToolbar, count, 1); m_targetToolbar = createTargetToolbar(); if (auth.hasRole("viewTarget")) { m_grid.addComponent(m_targetsPanel, count, 2); m_grid.addComponent(m_targetToolbar, count, 1);