Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

fix admin role does not appear until refresh (#62384)

Aleksandr Lesnenko75917ecd3ba0
diff --git a/e2e/test/scenarios/admin-2/people.cy.spec.js b/e2e/test/scenarios/admin-2/people.cy.spec.js
index c186e171955..77359287657 100644
--- a/e2e/test/scenarios/admin-2/people.cy.spec.js
+++ b/e2e/test/scenarios/admin-2/people.cy.spec.js
@@ -183,6 +183,38 @@ describe("scenarios > admin > people", () => {
cy.contains("Email address already in use.");
});
+ it("should immediately reflect admin privileges when creating user with admin group (metabase#60241)", () => {
+ const { first_name, last_name, email } = TEST_USER;
+ const FULL_NAME = `${first_name} ${last_name}`;
+
+ cy.visit("/admin/people");
+ clickButton("Invite someone");
+
+ // Fill in user details
+ cy.findByLabelText("First name").type(first_name);
+ cy.findByLabelText("Last name").type(last_name);
+ cy.findByLabelText(/Email/).type(email);
+
+ // Add user to Administrators group
+ H.modal().findByText("Default").click();
+ H.popover().findByText("Administrators").click();
+
+ clickButton("Create");
+
+ // Close the success modal
+ H.modal().findByText(`${FULL_NAME} has been added`);
+ H.modal().findByText("Done").click();
+
+ // Verify the user appears in the list with Admin role
+ cy.findByTestId("admin-people-list-table").within(() => {
+ cy.findByText(FULL_NAME)
+ .closest("tr")
+ .within(() => {
+ cy.findByText("Admin").should("exist");
+ });
+ });
+ });
+
it("'Invite someone' button shouldn't be covered/blocked on smaller screen sizes (metabase#16350)", () => {
cy.viewport(1000, 600);
diff --git a/frontend/src/metabase/api/user.ts b/frontend/src/metabase/api/user.ts
index 27785f368c5..22827efca6c 100644
--- a/frontend/src/metabase/api/user.ts
+++ b/frontend/src/metabase/api/user.ts
@@ -51,7 +51,8 @@ export const userApi = Api.injectEndpoints({
url: "/api/user",
body,
}),
- invalidatesTags: (_, error) => invalidateTags(error, [listTag("user")]),
+ invalidatesTags: (_, error) =>
+ invalidateTags(error, [listTag("user"), listTag("permissions-group")]),
onQueryStarted: async (request, { dispatch, queryFulfilled }) => {
if (request.password) {
const { data: user } = await queryFulfilled;