Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add permission check to new GardenAdminCard #204

Closed
obr42 opened this issue Oct 28, 2022 · 0 comments · Fixed by #237
Closed

Add permission check to new GardenAdminCard #204

obr42 opened this issue Oct 28, 2022 · 0 comments · Fixed by #237
Assignees
Labels
feature New feature or request good first issue Good for newcomers
Milestone

Comments

@obr42
Copy link
Contributor

obr42 commented Oct 28, 2022

Once #185 and #203 have both been merged, call the hasGardenPermission function from #203 in the new GardenAdminCard.tsx file from #185 as follows:

      <CardActions>
        {hasGardenPermission('garden:update') && (
            <Button
              variant="contained"
              color="secondary"
              component={RouterLink}
              to={'/admin/gardens/' + garden.name}
              sx={{ width: 0.75, mr: 1 }}
            >
              Edit configurations
            </Button>
        )}
        {garden.connection_type !== 'LOCAL' && hasGardenPermission('garden:delete') && (
          <>
            <Button
              variant="contained"
              color="error"
              onClick={() => setOpen(true)}
            >
              Delete
            </Button>
            <Modal
              ...
            </Modal>
          </>
        ) }
      </CardActions>
@jlrpnbbngtn jlrpnbbngtn added this to the release-0.1.0 milestone Nov 9, 2022
@obr42 obr42 self-assigned this Nov 12, 2022
obr42 added a commit to obr42/react-ui that referenced this issue Nov 14, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants