Skip to content

Commit

Permalink
CB-5584. Rename parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisSinelnikov committed Nov 11, 2024
1 parent b41e951 commit 0f32f18
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 56 deletions.
2 changes: 1 addition & 1 deletion server/bundles/io.cloudbeaver.server/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<extension point="org.jkiss.dbeaver.settings">
<propertyGroup id="log" label="Logger">
<property id="log.debug" label="Show all variables in log"
<property id="log.api.graphql.debug" label="Show all variables in log"
type="boolean" scopes="global"
description="Show in logs all variables in graphql endpoints"/>
</propertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,30 @@

public class GraphQLLoggerUtil {

private static final Set<String> PROHIBITED_VARIABLES = GraphQLProhibitedVariables.getAllProhibitedVariables();
private static final Set<String> PROHIBITED_VARIABLES =
Set.of("password", "config", "parameters", "settings", "licenseText", "credentials", "username");

public static String getUserId(HttpServletRequest request) {

Check warning on line 33 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java:33:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

Check warning on line 33 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java#L33

Missing a Javadoc comment.
String userId = null;
WebSession session = (WebSession) CBApplication.getInstance().getSessionManager().getSession(request.getSession().getId());
if (session != null) {
userId = session.getUserContext().getUserId();
if (userId == null && session.getUserContext().isAuthorizedInSecurityManager()) {
userId = "anonymous";
if (request.getSession() != null) {
WebSession session =
(WebSession) CBApplication.getInstance().getSessionManager().getSession(request.getSession().getId());
if (session != null) {
userId = session.getUserContext().getUserId();
if (userId == null && session.getUserContext().isAuthorizedInSecurityManager()) {
userId = "anonymous";
}
}
}
return userId;

}

public static String buildLoggerMessage(String sessionId, String userId, Map<String, Object> variables) {

Check warning on line 49 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java:49:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

Check warning on line 49 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java#L49

Missing a Javadoc comment.
StringBuilder loggerMessage = new StringBuilder(" [user: ").append(userId)
.append(", sessionId: ").append(sessionId).append("]");

if (CBPlatform.getInstance().getPreferenceStore().getBoolean("log.debug") && variables != null) {
if (CBPlatform.getInstance().getPreferenceStore().getBoolean("log.api.graphql.debug") && variables != null) {
loggerMessage.append(" [variables] ");
String parsedVariables = parseVarialbes(variables);
if (CommonUtils.isNotEmpty(parsedVariables)) {
Expand Down

This file was deleted.

0 comments on commit 0f32f18

Please sign in to comment.