Skip to content

Commit

Permalink
Capabilities are now assigned to the ENLARGE roles upon upgrading and…
Browse files Browse the repository at this point in the history
…, hopefully, when installing too
  • Loading branch information
Ravenink committed Nov 23, 2019
1 parent 56bbfc1 commit 4d37338
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@
* @throws dml_exception
*/
function xmldb_ltisource_enlarge_upgrade($oldversion) {
global $DB;
global $DB, $CFG;

require_once($CFG->libdir .'/accesslib.php');

// Get system context.
$context = context_system::instance();

// Assign capabilities to the myFrontier experiences designer role.
if (!$DB->record_exists('role', array('shortname' => 'enlargedesigner'))) {
if ($enlargedesignerid = $DB->get_field('role','id',array('shortname' => 'enlargedesigner'))) {
if ($DB->record_exists('role', array('shortname' => 'enlargedesigner'))) {
if ($enlargedesignerid = $DB->get_field('role','id', array('shortname' => 'enlargedesigner'))) {
// Assign capabilities.
if (get_capability_info("ltisource/enlarge:addinstance")) {
assign_capability('ltisource/enlarge:addinstance', CAP_ALLOW, $enlargedesignerid, $context->id, true);
Expand All @@ -67,8 +69,8 @@ function xmldb_ltisource_enlarge_upgrade($oldversion) {
}

// Assign capabilities to the myFrontier experiences manager role.
if (!$DB->record_exists('role', array('shortname' => 'enlargemanager'))) {
if ($enlargemanagerid = $DB->get_field('role','id',array('shortname' => 'enlargemanager'))) {
if ($DB->record_exists('role', array('shortname' => 'enlargemanager'))) {
if ($enlargemanagerid = $DB->get_field('role','id', array('shortname' => 'enlargemanager'))) {
// Assign capabilities.
if (get_capability_info("ltisource/enlarge:view")) {
assign_capability('ltisource/enlarge:view', CAP_ALLOW, $enlargemanagerid, $context->id, true);
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2019111800; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2019112301; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2016052300; // Requires this Moodle version.
$plugin->component = 'ltisource_enlarge'; // Full name of the plugin (used for diagnostics).
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '1.0 (Build: 2019111700)';
$plugin->release = '1.0 (Build: 2019112301)';
$plugin->dependencies = array('mod_ejsapp' => 2016080400);
$plugin->cron = 0;

0 comments on commit 4d37338

Please sign in to comment.