Skip to content

[ZEPPELIN-6075] Configuration for global Roles - #4808

Open
Reamer wants to merge 4 commits into
apache:masterfrom
Reamer:globalRoles
Open

Reamer wants to merge 4 commits into
apache:masterfrom
Reamer:globalRoles

Conversation

@Reamer

@Reamer Reamer commented Sep 2, 2024 •

Copy link
Copy Markdown
Contributor

What is this PR for?

This PR adds global roles, which can be stored in the Zeppelin configuration.

What type of PR is it?

Feature

Todos

  • - Documentation

What is the Jira issue?

How should this be tested?

  • Ci

Questions:

  • Does the license files need to update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? Yes

@Reamer
Reamer force-pushed the globalRoles branch 2 times, most recently from f929c4c to 5c70491 Compare September 25, 2024 08:27

@seung-00 seung-00 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our team needed this feature too. thank you for contributing. I've left a few simple comments for your review.

Comment on lines +327 to +337
switch (confvar) {
case ZEPPELIN_OWNER_ROLES:
case ZEPPELIN_WRITER_ROLES:
case ZEPPELIN_READER_ROLES:
case ZEPPELIN_RUNNER_ROLES:
defaultRolesConf = zConf.getString(confvar);
break;
default:
LOGGER.warn("getDefaultRoles is used with {}, which is not valid", confvar);
break;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using a collection like EnumSet instead of a switch statement to manage valid roles? IMO, this simplifies the code and makes it easier to add or modify roles in the future.

private static final Set<ZeppelinConfiguration.ConfVars> VALID_CONF_VARS = EnumSet.of(
      ZeppelinConfiguration.ConfVars.ZEPPELIN_OWNER_ROLES,
      ZeppelinConfiguration.ConfVars.ZEPPELIN_WRITER_ROLES,
      ZeppelinConfiguration.ConfVars.ZEPPELIN_READER_ROLES,
      ZeppelinConfiguration.ConfVars.ZEPPELIN_RUNNER_ROLES
  );

private Set<String> getDefaultRoles(ZeppelinConfiguration.ConfVars confvar) {
    if (!VALID_CONF_VARS.contains(confvar)) {
      LOGGER.warn("getDefaultRoles is used with {}, which is not valid", confvar);
      return Collections.emptySet();
    }
    ...
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review. I have adapted the code and agree with your statements.

@seung-00 seung-00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Reamer

Reamer commented Oct 30, 2024

Copy link
Copy Markdown
Contributor Author

I am using the feature in my company and have come across a bug that should be fixed with the latest commit.
The error should no longer occur because it has been covered by unit tests.
I will roll out the feature in my production environment in the next few days and report back on the status.

@Reamer

Reamer commented Oct 31, 2024

Copy link
Copy Markdown
Contributor Author

The users of my company report that the error found has now been fixed.

@Reamer

Reamer commented Sep 16, 2025

Copy link
Copy Markdown
Contributor Author

Review required.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been inactive for over a year. If no further activity occurs within the next 30 days, it will be automatically closed. If you believe this PR is still relevant, please feel free to leave a comment or make an update. Thank you!

@github-actions github-actions Bot added the Stale label Sep 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants