dry-scarletD
Refine3y ago
19 replies
dry-scarlet

How to limit the display of resources from users parameters?

I have two type of users.
One without ParentUserID (admin)
Another with parenUserId (employee who has parentUserId from the invitator(admin))

I would like to set up something like this:
resources={
            identity.hasParent
              ? [
                  // Resources for users with a parent
                  {
                    name: "my-profile",
                    icon: <AccountCircleOutlined />,
                    options: {
                      label: "My Profile",
                    },
                    list: MyProfile,
                  },
                ]
              : [
                  // Resources for users without a parent
                  {
                    name: "building-plans",
                    list: BuildingPlan,
                    show: BuildingsDetail,
                    create: CreateBuildingPlan,
                    edit: EditBuildingPlan,
                    icon: <ArticleOutlined />,
                  },
                  {
                    name: "employees",
                    list: EmployeeList,
                    create: AddEmployee,
                    icon: <PeopleIcon />,
                  },
                  {
                    name: "contracts",
                    list: AllContracts,
                    icon: <AddHomeWorkOutlinedIcon />,
                  },
                  {
                    name: "my-profile",
                    icon: <AccountCircleOutlined />,
                    options: {
                      label: "My Profile",
                    },
                    list: MyProfile,
                  },
                ]
          }
Was this page helpful?