mirror of
https://github.com/rowyio/rowy.git
synced 2026-05-18 05:05:28 +02:00
show all tables to ADMIN users
This commit is contained in:
@@ -13,7 +13,7 @@ import { useSnackContext } from "./SnackContext";
|
||||
import { SideDrawerRef } from "components/SideDrawer";
|
||||
import { ColumnMenuRef } from "components/Table/ColumnMenu";
|
||||
import { ImportWizardRef } from "components/Wizards/ImportWizard";
|
||||
import _find from 'lodash/find';
|
||||
import _find from "lodash/find";
|
||||
export type Table = {
|
||||
collection: string;
|
||||
name: string;
|
||||
@@ -111,7 +111,8 @@ export const FiretableContextProvider: React.FC = ({ children }) => {
|
||||
const filteredTables = _sortBy(tables, "name")
|
||||
.filter(
|
||||
(table) =>
|
||||
!table.roles || table.roles.some((role) => userRoles.includes(role))
|
||||
userRoles.includes("ADMIN") ||
|
||||
table.roles.some((role) => userRoles.includes(role))
|
||||
)
|
||||
.map((table) => ({
|
||||
...table,
|
||||
@@ -157,20 +158,25 @@ export const FiretableContextProvider: React.FC = ({ children }) => {
|
||||
[fieldName]: value,
|
||||
_ft_updatedAt,
|
||||
_ft_updatedBy,
|
||||
}
|
||||
tableActions.row.update(ref,update, () => {
|
||||
if (onSuccess) onSuccess(ref, fieldName, value);
|
||||
},(error) => {
|
||||
if (error.code === "permission-denied") {
|
||||
open({
|
||||
message: `You don't have permissions to make this change`,
|
||||
variant: "error",
|
||||
duration: 2000,
|
||||
position: { horizontal: "center", vertical: "top" },
|
||||
});
|
||||
};
|
||||
tableActions.row.update(
|
||||
ref,
|
||||
update,
|
||||
() => {
|
||||
if (onSuccess) onSuccess(ref, fieldName, value);
|
||||
},
|
||||
(error) => {
|
||||
if (error.code === "permission-denied") {
|
||||
open({
|
||||
message: `You don't have permissions to make this change`,
|
||||
variant: "error",
|
||||
duration: 2000,
|
||||
position: { horizontal: "center", vertical: "top" },
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
// A ref to the data grid. Contains data grid functions
|
||||
const dataGridRef = useRef<DataGridHandle>(null);
|
||||
|
||||
Reference in New Issue
Block a user