Conversation
f929c4c to
5c70491
Compare
| 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; | ||
| } |
There was a problem hiding this comment.
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();
}
...
}There was a problem hiding this comment.
Thank you for your review. I have adapted the code and agree with your statements.
|
I am using the feature in my company and have come across a bug that should be fixed with the latest commit. |
|
The users of my company report that the error found has now been fixed. |
|
Review required. |
|
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! |
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
What is the Jira issue?
How should this be tested?
Questions: