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

Fixes #24219: Display user detail using information from database #668

Conversation

clarktsiory
Copy link
Contributor

@clarktsiory clarktsiory commented Feb 26, 2024

https://issues.rudder.io/issues/24219

The main UI change in this PR consists in handling users who have multiple provider information sources, and setting the correct UI state accordingly :

  • a user can have a provider which "extends" the file provider, so we need to display both roles inherited from the provider (readonly) and from the file (can be changed) :
    image

  • a user can have a provider which "overrides" roles so ignores the file completely, so the roles cannot be changed at all and only inherited from the provider :
    image

Since we can get query provider information in Normation/rudder#5408, we can pass them as json in the API such as :

{
  "providerProperties": {
    "ldap": {
      "roleListOverride": "none",
      "hasModifiablePassword": true
    },
    "oidc": {
      "roleListOverride": "extend",
      "hasModifiablePassword": false
    }
  }
}

for the UI to handle the logic depending on the value of roleListOverride for the provider.

We also need to have the user roles defined by each provider (see the yml files for complete examples) :

{
   ...,
   "users": [
     {
        "id": "test user",
        "roles": ["inventory", "read_only"],
        "providersInfo": {
          "oidc": {
            "roles": ["inventory"],
            ...
           },
           "file": {
             "roles": ["read_only"],
             ...
           }
         }
       }
   ]
}

@clarktsiory clarktsiory changed the base branch from 7.3-next to backports/7.3.12/24146 February 26, 2024 16:36
@clarktsiory clarktsiory force-pushed the bug_24219/display_user_detail_using_information_from_database branch from 4c91459 to b2353e8 Compare February 26, 2024 16:37
@clarktsiory
Copy link
Contributor Author

Commit modified

@clarktsiory clarktsiory force-pushed the bug_24219/display_user_detail_using_information_from_database branch from b2353e8 to 48c844f Compare February 26, 2024 16:53
@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

4 similar comments
@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

} yield user
}

/*
* When we delete an user, it can be from file or auto-added by OIDC or other backend supporting that.
* So we need to both remove it (mark "status=delete") from base and from file.
* So we let the callback on file reload do the deletion for file users, and then delete from the user repository.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a tricky bug that relates to how the "reload" work, the callback behind the deletion does some logic on users managed by file that can also change other users.
We absolutely don't want this logic for users managed by other providers, and we wait for the callbacks to terminate before effectively setting the status to deleted.

Fixes #24219: Display user detail using information from database
…m database

Fixes #24219: Display user detail using information from database
…ion from database

Fixes #24219: Display user detail using information from database
…nformation from database

Fixes #24219: Display user detail using information from database
…using information from database

Fixes #24219: Display user detail using information from database
@clarktsiory clarktsiory force-pushed the bug_24219/display_user_detail_using_information_from_database branch from 6adbd75 to 6627212 Compare February 28, 2024 10:53
@clarktsiory
Copy link
Contributor Author

PR rebased

@fanf fanf merged commit 8f6ae6d into Normation:backports/7.3.12/24146 Feb 29, 2024
0 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants