private static void checkPermission(boolean preview, boolean hasScanPerm, boolean hasBrowsePerm) { if (!hasBrowsePerm && !hasScanPerm) { throw new ForbiddenException(Messages.NO_PERMISSION); } if (!preview && !hasScanPerm) { throw new ForbiddenException("You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. " + "Please contact your SonarQube administrator."); } if (preview && !hasBrowsePerm) { throw new ForbiddenException("You don't have the required permissions to access this project. Please contact your SonarQube administrator."); } }
public static ForbiddenException insufficientPrivilegesException() { return new ForbiddenException(INSUFFICIENT_PRIVILEGES_MESSAGE); }
@Override public final UserSession checkComponentUuidPermission(String permission, String componentUuid) { if (!hasComponentUuidPermission(permission, componentUuid)) { throw new ForbiddenException(INSUFFICIENT_PRIVILEGES_MESSAGE); } return this; }
@Override public final UserSession checkComponentPermission(String projectPermission, ComponentDto component) { if (!hasComponentPermission(projectPermission, component)) { throw new ForbiddenException(INSUFFICIENT_PRIVILEGES_MESSAGE); } return this; }
@Override public final UserSession checkPermission(OrganizationPermission permission, String organizationUuid) { if (!hasPermission(permission, organizationUuid)) { throw new ForbiddenException(INSUFFICIENT_PRIVILEGES_MESSAGE); } return this; }
@Override public UserSession checkIsRoot() { if (!isRoot()) { throw new ForbiddenException(INSUFFICIENT_PRIVILEGES_MESSAGE); } return this; }
@Override public UserSession checkMembership(OrganizationDto organization) { if (!hasMembership(organization)) { throw new ForbiddenException(format("You're not member of organization '%s'", organization.getKey())); } return this; }
@Override public void handle(Request request, Response response) throws Exception { if (!systemPasscode.isValid(request)) { throw new ForbiddenException("Insufficient privileges"); } WsUtils.writeProtobuf(support.checkNodeHealth(), request, response); } }
@Override public void handle(Request request, Response response) throws Exception { if (!systemPasscode.isValid(request) && !isSystemAdmin()) { throw new ForbiddenException("Insufficient privileges"); } if (webServer.isStandalone()) { WsUtils.writeProtobuf(support.checkNodeHealth(), request, response); } else { WsUtils.writeProtobuf(support.checkClusterHealth(), request, response); } }
private static void checkPermission(boolean preview, boolean hasScanPerm, boolean hasBrowsePerm) { if (!hasBrowsePerm && !hasScanPerm) { throw new ForbiddenException(Messages.NO_PERMISSION); } if (!preview && !hasScanPerm) { throw new ForbiddenException("You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. " + "Please contact your SonarQube administrator."); } if (preview && !hasBrowsePerm) { throw new ForbiddenException("You don't have the required permissions to access this project. Please contact your SonarQube administrator."); } }
@Override public final UserSession checkPermission(OrganizationPermission permission, String organizationUuid) { if (!hasPermission(permission, organizationUuid)) { throw new ForbiddenException(INSUFFICIENT_PRIVILEGES_MESSAGE); } return this; }
@Override public final UserSession checkComponentUuidPermission(String permission, String componentUuid) { if (!hasComponentUuidPermission(permission, componentUuid)) { throw new ForbiddenException(INSUFFICIENT_PRIVILEGES_MESSAGE); } return this; }
@Override public UserSession checkIsRoot() { if (!isRoot()) { throw new ForbiddenException(INSUFFICIENT_PRIVILEGES_MESSAGE); } return this; }
@Override public final UserSession checkComponentPermission(String projectPermission, ComponentDto component) { if (!hasComponentPermission(projectPermission, component)) { throw new ForbiddenException(INSUFFICIENT_PRIVILEGES_MESSAGE); } return this; }
@Override public void handle(Request request, Response response) throws Exception { if (!systemPasscode.isConfigured() || !systemPasscode.isValid(request)) { throw new ForbiddenException("Insufficient privileges"); } WsUtils.writeProtobuf(support.checkNodeHealth(), request, response); } }
@Override public void handle(Request request, Response response) throws Exception { if (!isPassCodeAuthenticated(request) && !isSystemAdmin()) { throw new ForbiddenException("Insufficient privileges"); } if (webServer.isStandalone()) { WsUtils.writeProtobuf(support.checkNodeHealth(), request, response); } else { WsUtils.writeProtobuf(support.checkClusterHealth(), request, response); } }