-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat: 🚀 generic task view #3005
Conversation
nice work! |
Indeed, how would I go about checking for user-rights in OpenKAT? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice feature and work overall. I do have a few remarks to improve it even more.
Regarding user rights, you might be able to combine the OrganizationMember
and the current user to create a list of accessible schedulers
nice work!
That could work on the rocky end, but the scheduler api does not allow for filtering on many organizations I think? |
If the scheduler API doesn't support this yet, you'd still have to retrieve the user's organizations to know which task lists the user can see or retrieve |
From the scheduler side I'd recommend to retrieve the task for all organizations from the tasks endpoint, this makes sure that filtering is done in db-time instead of python-time. Filtering on multiple scheduler ids and retrieving tasks is possible from this endpoint. |
I updated the PR to retrieve the user accessible schedulers and show all related tasks and stats |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the rework and updates. Just a few tiny remarks on the scheduler client. Should be ready to be functionally tested (can you take a look at this, @stephanie0x00?)
def handle_page_action(self, action: str) -> None: | ||
if action == PageActions.RESCHEDULE_TASK.value: | ||
task_id = self.request.POST.get("task_id") | ||
organization_code = self.request.POST.get("organization_code") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to validate that the user can access this organization. There is some code further down the line that checks if the given organization ID matches the Job's organization ID, but checking for access rights needs to be done here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another route could be to just link to the organization's taskview page action, which because it loads with the organization in the url, will aready do this check for us. That would mean we just need to point the rerun form to that url in the same way the organiaton specific view does it. In that case this whole post handler and handle_page_action ca be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean something like
organization_code in [o.code for o in self.request.user.organizations]
?
merged as another PR after fixing the conflicts. |
Changes
This PR introduces a task view for all organizations simultaneously. To this end:
What needs to be done is to make sure the new views are only accessible for staff users. I tried this with the commented out django code, but the user object seems to be missing. I left some loggingdebugstatements that need to be removed after that is fixed.
Issue link
Closes #2645
Demo
Code Checklist
Communication
.env
changes files if required and changed the.env-dist
accordingly.Checklist for code reviewers:
Copy-paste the checklist from the docs/source/templates folder into your comment.
Checklist for QA:
Copy-paste the checklist from the docs/source/templates folder into your comment.