diff --git a/public/app/features/admin/AdminEditOrgPage.tsx b/public/app/features/admin/AdminEditOrgPage.tsx index 93e1fc706d8..0a61c6d08d9 100644 --- a/public/app/features/admin/AdminEditOrgPage.tsx +++ b/public/app/features/admin/AdminEditOrgPage.tsx @@ -98,6 +98,7 @@ export const AdminEditOrgPage: FC = ({ match }) => { {canReadUsers && !!users.length && ( { updateOrgUserRole({ ...orgUser, role }, orgId); setUsers( diff --git a/public/app/features/users/UsersTable.tsx b/public/app/features/users/UsersTable.tsx index 8bdd8a78c13..92784d70234 100644 --- a/public/app/features/users/UsersTable.tsx +++ b/public/app/features/users/UsersTable.tsx @@ -8,12 +8,13 @@ import { fetchBuiltinRoles, fetchRoleOptions, UserRolePicker } from 'app/core/co export interface Props { users: OrgUser[]; + orgId?: number; onRoleChange: (role: OrgRole, user: OrgUser) => void; onRemoveUser: (user: OrgUser) => void; } const UsersTable: FC = (props) => { - const { users, onRoleChange, onRemoveUser } = props; + const { users, orgId, onRoleChange, onRemoveUser } = props; const canUpdateRole = contextSrv.hasPermission(AccessControlAction.OrgUsersRoleUpdate); const canRemoveFromOrg = contextSrv.hasPermission(AccessControlAction.OrgUsersRemove); const rolePickerDisabled = !canUpdateRole; @@ -25,9 +26,9 @@ const UsersTable: FC = (props) => { useEffect(() => { async function fetchOptions() { try { - let options = await fetchRoleOptions(); + let options = await fetchRoleOptions(orgId); setRoleOptions(options); - const builtInRoles = await fetchBuiltinRoles(); + const builtInRoles = await fetchBuiltinRoles(orgId); setBuiltinRoles(builtInRoles); } catch (e) { console.error('Error loading options'); @@ -36,7 +37,7 @@ const UsersTable: FC = (props) => { if (contextSrv.accessControlEnabled()) { fetchOptions(); } - }, []); + }, [orgId]); const getRoleOptions = async () => roleOptions; const getBuiltinRoles = async () => builtinRoles; @@ -83,6 +84,7 @@ const UsersTable: FC = (props) => { {contextSrv.accessControlEnabled() ? ( onRoleChange(newRole, user)} getRoleOptions={getRoleOptions}