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

CTP-1685 Add unfreeze button to lifecycle block #13

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nbozhkov-ucl
Copy link

No description provided.

@nbozhkov-ucl nbozhkov-ucl changed the title Ctp 1685 Add unfreeze button to lifecycle block Jan 22, 2024
@nbozhkov-ucl nbozhkov-ucl changed the title Add unfreeze button to lifecycle block CTP-1685 Add unfreeze button to lifecycle block Jan 22, 2024
block_lifecycle.php Outdated Show resolved Hide resolved
renderer.php Outdated Show resolved Hide resolved
renderer.php Outdated Show resolved Hide resolved
renderer.php Outdated Show resolved Hide resolved
@aydevworks
Copy link
Contributor

Also, please check the GHA checks results as well:
e.g. https://github.com/ucl-isd/moodle-block_lifecycle/actions/runs/7610338280/job/20723456253?pr=13

@nbozhkov-ucl
Copy link
Author

Added changes.

renderer.php Outdated Show resolved Hide resolved
@nbozhkov-ucl
Copy link
Author

Addressed all automatic check issues introduced by my code. Deployed to 43-clc for testing and sign-off.

@@ -79,6 +79,11 @@ public function get_content() {
if (manager::should_show_auto_freezing_preferences($courseid)) {
$html .= $renderer->fetch_block_content($courseid);
}
if (manager::is_course_frozen($courseid)) {
if (has_capability("moodle/site:managecontextlocks", $context)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this doesn't look like the right permission to be using, should be a course level permission not a site level one

Copy link
Author

Choose a reason for hiding this comment

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

Shall I create a new course level capability or maybe reuse existing one - https://github.com/ucl-isd/moodle-block_lifecycle/blob/main/db/access.php#L43-L51?

Copy link
Author

Choose a reason for hiding this comment

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

Seems that unlocking course context always rely on moodle/site:managecontextlocks to unlock course context. Even if I create new capability for the button, user will always need moodle/site:managecontextlock to unfreeze the course context.

Copy link
Author

Choose a reason for hiding this comment

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

Currently course admin and tutor roles in Moodle have moodle/site:managecontextlocks set to "Not set". If we want them to be able to unfreeze course context (and use the newly created button in the lifecycle block), we will need to update the permissions for these roles and set moodle/site:managecontextlocks set to "Allow". Hope both last comments gives enough context on the reason for using site level permission. Let me know if you need any further research - I will do it in separate Jira story.

Copy link
Collaborator

Choose a reason for hiding this comment

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

we can't be giving everyone a really critical site level permission with site wide effect. This is fundamentally wrong.

If this permission isn't suitable, then we need to create a new one, and if need be this will have to be processed through an ad-hoc task as a way around the the limitations of that permission check.

@aydevworks may have a second opinion on this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

P.S. at present this MR doesn't meet the definition of done so no, keep CTP-1685 story open, will have to rollover into next sprint, so be it.

Copy link
Author

Choose a reason for hiding this comment

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

I agree that site wide permission is not right. However, if it is only given to roles in the course context level would that not limit it just at course level?

I might be wrong but changing current way of working of context freezing should require changes to core moodle code.

I was also thinking about ad-hoc task as an option - it will need more development time/effort.

Copy link
Contributor

Choose a reason for hiding this comment

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

By looking at the /admin/lock.php, it looks like it's not very difficult to do the context locking / unlocking.
I think we could try create a new course level permission and do the context unfreezing in our plugin instead of using the /admin/lock.php.

@aspark21
Copy link
Collaborator

also - rebase, squash your commits and ignore these failures which aren't related to your change- #14 (comment)

@nbozhkov-ucl nbozhkov-ucl force-pushed the CTP-1685 branch 2 times, most recently from 0fb109e to df498ea Compare February 1, 2024 15:02
@nbozhkov-ucl
Copy link
Author

Rebased, squashed my commits and deployed to 43-clc for review.

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