Commit 83524452 authored by Robert Lyon's avatar Robert Lyon

Artefacts still accessible when disabled/hidden (bug #646691)

Currently we only hide links to artefact when we 'hide' them on the
extensions page rather than have them not accessible.

This patch will check to see if artefact is active and if it isn't
will display a access denied message.

note for testing: when hiding an artefact plugin it turns off the blocktypes
associated with it - but when you re-enable the artefact it does not
re-enable the blocktypes

Change-Id: Ic2282ededa7e85696dcaaac0768d35c52ecf3d01
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 8689321f
......@@ -31,6 +31,10 @@ class PluginArtefactBlog extends PluginArtefact {
return 'blog';
}
public static function is_active() {
return get_field('artefact_installed', 'active', 'name', 'blog');
}
public static function menu_items() {
global $USER;
$tab = array(
......
......@@ -21,7 +21,9 @@ require_once('license.php');
safe_require('artefact', 'blog');
safe_require('artefact', 'file');
if (!PluginArtefactBlog::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('blog','artefact.blog')));
}
/*
* For a new post, the 'blog' parameter will be set to the blog's
* artefact id. For an existing post, the 'blogpost' parameter will
......
......@@ -20,6 +20,9 @@ define('TITLE', get_string('blogsettings','artefact.blog'));
require_once('pieforms/pieform.php');
require_once('license.php');
safe_require('artefact', 'blog');
if (!PluginArtefactBlog::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('blog','artefact.blog')));
}
$id = param_integer('id');
$blog = new ArtefactTypeBlog($id);
......
......@@ -19,7 +19,9 @@ require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
define('TITLE', get_string('viewblog','artefact.blog'));
safe_require('artefact', 'blog');
require_once(get_config('libroot') . 'pieforms/pieform.php');
if (!PluginArtefactBlog::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('blog','artefact.blog')));
}
if ($changepoststatus = param_integer('changepoststatus', null)) {
ArtefactTypeBlogpost::changepoststatus_form($changepoststatus);
}
......
......@@ -17,6 +17,9 @@ require_once('pieforms/pieform.php');
require_once('pieforms/pieform/elements/calendar.php');
require_once(get_config('docroot') . 'artefact/lib.php');
safe_require('artefact','plans');
if (!PluginArtefactPlans::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('plans','artefact.plans')));
}
define('TITLE', get_string('editplan','artefact.plans'));
......
......@@ -18,6 +18,10 @@ require_once('pieforms/pieform/elements/calendar.php');
require_once(get_config('docroot') . 'artefact/lib.php');
safe_require('artefact','plans');
if (!PluginArtefactPlans::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('plans','artefact.plans')));
}
define('TITLE', get_string('edittask','artefact.plans'));
$id = param_integer('id');
......
......@@ -21,6 +21,10 @@ safe_require('artefact', 'plans');
define('TITLE', get_string('Plans','artefact.plans'));
if (!PluginArtefactPlans::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('plans','artefact.plans')));
}
// offset and limit for pagination
$offset = param_integer('offset', 0);
$limit = param_integer('limit', 10);
......
......@@ -28,6 +28,10 @@ class PluginArtefactPlans extends PluginArtefact {
return 'plans';
}
public static function is_active() {
return get_field('artefact_installed', 'active', 'name', 'plans');
}
public static function menu_items() {
return array(
'content/plans' => array(
......
......@@ -16,6 +16,9 @@ define('SECTION_PLUGINNAME', 'plans');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'plans');
if (!PluginArtefactPlans::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('plans','artefact.plans')));
}
$id = param_integer('id',0);
if ($id) {
......
......@@ -18,6 +18,9 @@ define('SECTION_PAGE', 'plans');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'plans');
if (!PluginArtefactPlans::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('plans','artefact.plans')));
}
define('TITLE', get_string('tasks','artefact.plans'));
......
......@@ -21,6 +21,10 @@ define('TITLE', get_string('resume', 'artefact.resume'));
require_once('pieforms/pieform.php');
safe_require('artefact', 'resume');
if (!PluginArtefactResume::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('resume','artefact.resume')));
}
$compositetypes = array(
'certification',
'book',
......
......@@ -22,6 +22,10 @@ require_once(get_config('docroot') . 'artefact/lib.php');
safe_require('artefact', 'resume');
safe_require('artefact', 'file');
if (!PluginArtefactResume::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('resume','artefact.resume')));
}
define('TITLE', get_string('resume', 'artefact.resume'));
$id = param_integer('id');
......
......@@ -19,8 +19,13 @@ require_once(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
require_once('pieforms/pieform/elements/calendar.php');
require_once(get_config('docroot') . 'artefact/lib.php');
safe_require('artefact', 'resume');
safe_require('artefact', 'file');
if (!PluginArtefactResume::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('resume','artefact.resume')));
}
define('TITLE', get_string('resume', 'artefact.resume'));
$id = param_integer('id', 0);
......
......@@ -20,6 +20,10 @@ require_once(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('resume', 'artefact.resume'));
safe_require('artefact', 'resume');
if (!PluginArtefactResume::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('resume','artefact.resume')));
}
$compositetypes = array('employmenthistory', 'educationhistory');
$inlinejs = ArtefactTypeResumeComposite::get_js($compositetypes);
$compositeforms = ArtefactTypeResumeComposite::get_forms($compositetypes);
......
......@@ -19,6 +19,10 @@ require_once(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('resume', 'artefact.resume'));
safe_require('artefact', 'resume');
if (!PluginArtefactResume::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('resume','artefact.resume')));
}
$goals = ArtefactTypeResumeGoalAndSkill::get_goals_and_skills('goals');
$skills = ArtefactTypeResumeGoalAndSkill::get_goals_and_skills('skills');
......
......@@ -21,6 +21,10 @@ define('TITLE', get_string('resume', 'artefact.resume'));
require_once('pieforms/pieform.php');
safe_require('artefact', 'resume');
if (!PluginArtefactResume::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('resume','artefact.resume')));
}
$defaults = array(
'coverletter' => array(
'default' => '',
......
......@@ -21,6 +21,10 @@ define('TITLE', get_string('resume', 'artefact.resume'));
require_once('pieforms/pieform.php');
safe_require('artefact', 'resume');
if (!PluginArtefactResume::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('resume','artefact.resume')));
}
$defaults = array(
'interest' => array(
'default' => '',
......
......@@ -41,6 +41,10 @@ class PluginArtefactResume extends Plugin {
return 'resume';
}
public static function is_active() {
return get_field('artefact_installed', 'active', 'name', 'resume');
}
public static function menu_items() {
return array(
'content/resume' => array(
......
......@@ -55,6 +55,7 @@ $string['show'] = 'Show';
$string['hide'] = 'Hide';
$string['pluginenabled'] = 'The plugin is now visible.';
$string['plugindisabled'] = 'The plugin has been hidden.';
$string['plugindisableduser'] = 'The %s plugin has been disabled. Please check with your administrator to have this feature enabled.';
$string['pluginnotenabled'] = 'Plugin is hidden. You must make the %s plugin visible first.';
$string['pluginexplainaddremove'] = 'Plugins in Mahara are always installed and can be accessed if users know the URLs and would otherwise have access. Rather than enabling and disabling the functionality, plugins are hidden or made visible by clicking on the \'Hide\' or \'Show\' links beside the plugins below.';
$string['pluginexplainartefactblocktypes'] = 'When hiding an \'artefact\' type plugin, Mahara also stops the display of the blocks related to it.';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment