Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Correct permissions for scheduled-job REST APIs #1490

Merged
merged 5 commits into from
Mar 21, 2022

Conversation

glennmatthews
Copy link
Contributor

Fixes: #1478

Correct the permissions on our custom scheduledjob REST API endpoints:

  • POST /api/extras/scheduled-jobs/<pk>/approve/
    • No longer requires extras.add_scheduledjob permission
    • Now requires extras.change_scheduledjob permission
    • Now requires extras.approve_job permission
  • POST /api/extras/scheduled-jobs/<pk>/deny/
    • No longer requires extras.add_scheduledjob permission
    • Now requires extras.delete_scheduledjob permission
    • Now requires extras.approve_job permission
  • POST /api/extras/scheduled-jobs/<pk>/dry-run/
    • No longer requires extras.add_scheduledjob permission
    • Now requires extras.view_scheduledjob permission
    • Now requires extras.run_job permission

There's got to be a better/cleaner way to adjust the permissions enforced for a given viewpoint that wouldn't require both overriding ModelViewSetMixin.restrict_queryset and subclassing TokenPermissions, but this is the briefest approach I've been able to identify with respect to the current implementation in Nautobot.

@bryanculver bryanculver added this to the v1.3.0 milestone Mar 15, 2022
nautobot/extras/api/views.py Outdated Show resolved Hide resolved
nautobot/extras/api/views.py Outdated Show resolved Hide resolved
Co-authored-by: Bryan Culver <31187+bryanculver@users.noreply.github.com>
@glennmatthews
Copy link
Contributor Author

glennmatthews commented Mar 17, 2022

TODO:

  • update nautobot/docs/additional-features/job-scheduling-and-approvals.md to clearly document the required permissions
  • clearly document this as a behavior change in the release-notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants