fnardin-maystreet commented on code in PR #32995:
URL: https://github.com/apache/superset/pull/32995#discussion_r3558017860
##########
superset-frontend/src/pages/DatasetList/DatasetList.listview.test.tsx:
##########
@@ -1050,11 +1049,10 @@ test('edit action is disabled for non-editor', async ()
=> {
const row = screen.getByText(dataset.table_name).closest('tr');
const editIcon = within(row!).getByTestId('edit');
- const editButton = editIcon.closest('.action-button, .disabled');
+ const editButton = editIcon.closest('[role="button"]');
- // Should have disabled class (disabled buttons still have 'action-button'
class)
- expect(editButton).toHaveClass('disabled');
- expect(editButton).toHaveClass('action-button');
+ // Should be disabled
+ expect(editButton).toHaveAttribute('aria-disabled', 'true');
Review Comment:
This actually passed as mockAdminUser lacks the props to be recognized as an
admin user. Anyway, I replaced mockAdminUser with mockEditorUser
##########
superset-frontend/src/dashboard/util/permissionUtils.ts:
##########
@@ -40,6 +41,17 @@ export const isUserAdmin = (
role => role.toLowerCase() === ADMIN_ROLE_NAME,
);
+export const isUserEditorOrAdmin = (
+ user?: UserWithPermissionsAndRoles | UndefinedUser,
+ editors: Subject[] = [],
+): boolean => {
+ const userSubjects = getUserSubjects();
+ return (
+ editors.some(editor => userSubjects.includes(editor.id)) ||
+ isUserAdmin(user)
+ );
+};
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]