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

Fixes #36751 - check permissions for schedule job button #836

Merged

Conversation

MariaAga
Copy link
Member

Took the permissions from the old host page, schedule job button:

can_schedule_jobs? && can_execute_on_infrastructure_host?(host)

@MariaAga MariaAga force-pushed the schedule_job_button_permissions branch 3 times, most recently from c61fb49 to 40a7c82 Compare September 15, 2023 15:51
@adamruzicka
Copy link
Contributor

Does the trick for me. @pnovotny could you please take this for a spin when you have time?

@pnovotny
Copy link

@adamruzicka Hi, sure, I'll take a look.

@pnovotny
Copy link

Good news: a user without permissions to schedule jobs, i.e., View hosts role, cannot see the Schedule a job button in the host detail at all.

Bad news: a user with permissions can see the button, however the dropdown toggle with REX options doesn't work.
This seems to be because of incorrect API call to .../api/v2/hosts/undefined/available_remote_execution_features, where the host ID value is undefined.
host-detail-rex-features-error

@MariaAga MariaAga force-pushed the schedule_job_button_permissions branch from 40a7c82 to 65c13dc Compare September 26, 2023 08:04
@MariaAga
Copy link
Member Author

Fixed, I used features instead of remote_execution_features accidentally.
the undefined host id can happen sometimes when the host id is still not set when the component loaded but another api call will be made once the host id is defined

@pnovotny
Copy link

LGTM.
The Schedule a job dropdown now works correctly.
The rest is fine too:

Good news: a user without permissions to schedule jobs, i.e., View hosts role, cannot see the Schedule a job button in the host detail at all.

Copy link
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

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

Looks good

@adamruzicka adamruzicka merged commit 5bf78eb into theforeman:master Oct 3, 2023
5 checks passed
@adamruzicka
Copy link
Contributor

Thank you @MariaAga & @pnovotny !

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.

4 participants