Closed gtolarc closed 3 years ago
Hi @gtolarc,
It's an interesting idea we can give you a react component props say permissions
It takes an array of strings, create/update/delete
. It will force what is in adminSettings.json
.
What do you think?
If you can receive one prop(I think the name updateModel would be good.) of the following shape in PrismaTable, it seems that we can solve both the permission and i18n problem at the same time.
{
actions: ['create', 'update', 'delete'],
titles: {
id: '번호', // This part can be replaced by using a library like react-i18next.
name: '이름',
createdAt: '생성일',
},
}
Please, I need to focus on one issue. Can we solve permissions here and open a new issue for other issues
Got it. I think your solution is fine. It seems to be a simple way to allow the client to determine actions.
you can now pass actions props to the PrismaAdmin
component from version 2.12.0
import { PrismaTable } from '@paljs/admin';
const Table: React.FC<{ model: string }> = ({ model }) => {
const router = useRouter();
return <PrismaTable model={model} push={router.push} query={router.query} actions={['update']} />;
};
export default Table;
Setting management using the'adminSettings.json' file is not flexible. It is not possible to restrict actions (create/update/delete) according to each user's permission or support i18n of field titles. Can you guys think about this and improve it?