Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Admin Role to SystemAdmin for Clarity #1054

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

minwoox
Copy link
Member

@minwoox minwoox commented Nov 6, 2024

Motivation:
The term "Admin" does not clearly convey its purpose as a system-wide administrator role, as discussed in issue #1048. Renaming this role improves clarity for users and developers.

Modifications:

  • Renamed all "Admin" to "SystemAdmin" across the codebase.
  • Updated MetadataService.updateTokenLevel() to avoid directly accessing the admin property.

Result:

  • The role name "Admin" has been replaced with "SystemAdmin".
  • (Breaking)
    • authentication.administrators in dogma.json is now authentication.systemAdministrators.
  • (Deprecation)
    • Use systemAdmin property instead of admin when creating a token via REST API:
      {"appId": "foo", "isSystemAdmin": true, ...}
    • Use SYSTEMADMIN instead of admin when changing the token level:
      {"level":"SYSTEMADMIN"}

Motivation:
The term "Admin" does not clearly convey its purpose as a system-wide administrator role, as discussed in [issue line#1048](line#1048).
Renaming this role improves clarity for users and developers.

Modifications:
- Renamed all "Admin" to "SystemAdmin" across the codebase.
- Updated `MetadataService.updateTokenLevel()` to avoid directly accessing the `admin` property.

Result:
- The role name "Admin" has been replaced with "SystemAdmin".
@@ -86,7 +86,7 @@ public final class AuthConfig {
@JsonCreator
public AuthConfig(
@JsonProperty("factoryClassName") String factoryClassName,
@JsonProperty("administrators") @Nullable Set<String> administrators,
@JsonProperty("systemAdministrators") @Nullable Set<String> systemAdministrators,
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't implement this in a backward-compatible way because the configuration file raises an exception at startup. Please let me know if you have a different opinion on this. 🙇

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

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

👍 👍

@@ -126,7 +126,7 @@ public final <T> CompletableFuture<T> execute(Command<T> command) {
if (!isStarted()) {
throw new ReadOnlyException("running in read-only mode. command: " + command);
}
if (!writable && !(command instanceof AdministrativeCommand)) {
if (!writable && !(command instanceof SystemAdministrativeCommand)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Double checked that the superclass [System]AdministrativeCommand isn't exposed in the JSON in any way

*/
@JsonProperty
public boolean isAdmin() {
return isAdmin;
public boolean isSystemAdmin() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Note:

  1. While releasing, if a user tries to access a token via UI served by old servers to a new server he/she may encounter errors.
  2. If a new token is registered while releasing, old servers may not be able to access it
  3. Regarding rollback plan: if a new token is registered we need to clean up the token before performing rollback. Having said this, I'm not sure if there is an easy way to detect this at the moment.

Copy link
Member Author

Choose a reason for hiding this comment

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

While releasing, if a user tries to access a token via UI served by old servers to a new server he/she may encounter errors.

That's correct. 👍 We need to let them refresh the page after finishing the rolling restart.

If a new token is registered while releasing, old servers may not be able to access it

That's correct. 👍 I thought it should be okay, but it probably shouldn't be. 😓
Let me create a separate commit to solve this issue.

Regarding rollback plan:

I'm implementing a client that migrates admin to systemAdmin.
Let me also implement the client the vise-versa.

Copy link
Member Author

Choose a reason for hiding this comment

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

@jrhee17 Here it is. 😉
#1056

minwoox added a commit to minwoox/centraldogma that referenced this pull request Nov 8, 2024
Motivation
To ensure smooth compatibility with line#1054, the `Token` structure needs an update to support changes in `admin` property.

Modifications:
- Enhanced the Token deserializer to accept both `admin` and `systemAdmin` properties, ensuring backward compatibility.
- Updated `MetadataService.updateTokenLevel()` to avoid direct access to the `admin` property.

Result:
- The `Token` structure now supports the upcoming changes, allowing seamless updates with line#1054.
@minwoox minwoox modified the milestones: 0.71.0, 0.72.0 Nov 8, 2024
minwoox added a commit that referenced this pull request Nov 8, 2024
Motivation
To ensure smooth compatibility with #1054, the `Token` structure needs an update to support changes in `admin` property.

Modifications:
- Enhanced the Token deserializer to accept both `admin` and `systemAdmin` properties, ensuring backward compatibility.
- Updated `MetadataService.updateTokenLevel()` to avoid direct access to the `admin` property.

Result:
- The `Token` structure now supports the upcoming changes, allowing seamless updates with #1054.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants