Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ around the world.
---
### Changelog

##### 4.3.0 (14.10.2024)
- Update to show embedcode for tenant admins.

##### 3.9.6 (24.08.2022)
- Update code style to trigger less errors.

Expand Down
17 changes: 16 additions & 1 deletion renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* @author Luuk Verhoeven
**/

use tool_tenant\tenancy;

/**
* Class mod_stackview_renderer
*
Expand Down Expand Up @@ -59,8 +61,21 @@ public function render_stack(\mod_stackview\stack $stack) {
* @throws \coding_exception
*/
public function show_filter_code(\mod_stackview\stack $stack): string {
global $USER;

$istenantadmin = false;

// Always allow for Tenant admins.
if (class_exists(tenancy::class)) {

// Check if the user is tenant admin.
$tenantid = tenancy::get_tenant_id();
if (\tool_tenant\manager::is_tenant_admin($tenantid, $USER->id)) {
$istenantadmin = true;
}
}

if (has_capability('mod/stackview:management', $this->page->cm->context)) {
if (has_capability('mod/stackview:management', $this->page->cm->context) || $istenantadmin) {
return html_writer::div($stack->get_filter_code(), 'stackviewer-embedcode');
}

Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'mod_stackview';
$plugin->release = '3.9.7';
$plugin->version = 2024010200;
$plugin->release = '4.3.0';
$plugin->version = 2024101400;
$plugin->requires = 2018051700;
$plugin->maturity = MATURITY_STABLE;
Loading