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

[4.4] Fix Permissions for Manually Running Scheduled Tasks #36719

Draft
wants to merge 4 commits into
base: 4.4-dev
Choose a base branch
from

Conversation

ditsuke
Copy link
Contributor

@ditsuke ditsuke commented Jan 17, 2022

Pull Request for Issue #36677.

Summary of Changes

  • Explicitly disables the "run task" button on insufficient authorization.
  • Adds tooltip to give context on disabling the button.
  • Change default permission level for running tasks/grant access to creator.
  • Prevent manual runs from being publicly accessible regardless of permission levels. Ref: #36453#issuecomment-1001793962 / @PhilETaylor

Testing Instructions

  • Create a new task with an admin (not superuser) account.
  • Try to run it from the Scheduled tasks manager.

Actual result BEFORE applying this Pull Request

There is no indication that the user is not authorized to run the task. The button is usable.

Expected result AFTER applying this Pull Request

The button is disabled. Reason for being disabled is available through a tooltip on hover.

Documentation Changes Required

N/A

- Explicitly disables the "run task" button on
  insufficient authorization.
- Adds tooltip to give context on disabling.
@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-4.1-dev labels Jan 17, 2022
@brianteeman
Copy link
Contributor

How can it make sense for a user to be able to create a new task and setup lazy loading etc but not be able to run the task directly

@ditsuke
Copy link
Contributor Author

ditsuke commented Jan 17, 2022

How can it make sense for a user to be able to create a new task and setup lazy loading etc but not be able to run the task directly

Definitely, now that I think of it the creator should be able to run them manually as a default. I'll work on enabling that behavior before opening this PR.

@brianteeman
Copy link
Contributor

brianteeman commented Jan 17, 2022

Possibly need a new permission for that "Edit own"

Task creators should now be able to run them even if they do not have
the `core.testrun` permission. The current permission checks should be
reviewed.
*
* @since __DEPLOY_VERSION__
*/
public static function isAuthorizedToRun(object $taskRecord, User $user): bool
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianteeman what do you think about this check?

We need this field in the authorization check. Begs the question, should
we just get all fields?
@HLeithner HLeithner changed the base branch from 4.1-dev to 4.2-dev June 27, 2022 13:06
@HLeithner
Copy link
Member

This pull request has automatically rebased to 4.2-dev.

@HLeithner HLeithner changed the base branch from 4.2-dev to 4.3-dev May 2, 2023 16:30
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 4.3-dev.

@HLeithner HLeithner changed the base branch from 4.3-dev to 4.4-dev September 30, 2023 22:45
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 4.4-dev.

@HLeithner HLeithner changed the title [4.1] Fix Permissions for Manually Running Scheduled Tasks [4.4] Fix Permissions for Manually Running Scheduled Tasks Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants