Apply RBAC permissions across admin and tasks

Enforce page access and action-level permissions across admin and task views, including exports and record actions. Move user creation to a client component behind server-side permission checks, standardize data fetching, and remove the deprecated user-role route.
This commit is contained in:
Ichsan Kurniawan
2026-11-09 17:32:31 +07:00
parent 1b37ff65f5
commit 279b642a7a
69 changed files with 1070 additions and 1167 deletions
@@ -156,16 +156,16 @@ const ComponentPage: FC<Props> = ({ data, actions }) => {
{record.status.code === 'A' ?
<DropdownMenuContent align="end" onClick={e => e?.stopPropagation()}>
<DropdownMenuItem><Link href={`user/${record.id}`} className='w-full'>View</Link></DropdownMenuItem>
{actions.includes('CHANGE_PASSWORD') &&
{actions?.includes('CHANGE_PASSWORD') &&
<DropdownMenuItem onClick={() => { setShowFormChangePass(true); setSelectedData(record) }}>Change password</DropdownMenuItem>
}
{actions.includes('RESET_PASSWORD') &&
{actions?.includes('RESET_PASSWORD') &&
<DropdownMenuItem onClick={() => { setShowResetPass(true), setSelectedData(record) }}>Reset Password</DropdownMenuItem>
}
{actions.includes('UPDATE') &&
{actions?.includes('UPDATE') &&
<DropdownMenuItem><Link href={`user/create?is_update=true&id=${record.id}`} className='w-full'>Edit</Link></DropdownMenuItem>
}
{actions.includes('DELETE') &&
{actions?.includes('DELETE') &&
<AlertDialogTrigger asChild>
<DropdownMenuItem>Delete</DropdownMenuItem>
</AlertDialogTrigger>
@@ -208,7 +208,7 @@ const ComponentPage: FC<Props> = ({ data, actions }) => {
<div className="flex flex-1 items-center space-x-2">
<Input placeholder="Search user..." className="h-8 w-full sm:w-62.5 lg:w-72" onChange={handleSearch} />
</div>
{actions.includes('CREATE') &&
{actions?.includes('CREATE') &&
<Link href='user/create'>
<Button size="sm" className="ml-auto h-8 w-full sm:w-max text-his" variant='ghost'>
<PlusCircledIcon className="mr-2 h-4 w-4" />