Skip to content

Commit 9ceb2a9

Browse files
authored
Merge pull request #428 from ucfopen/issue/426-admin-panel-option
Add feature flag for admin panel. Fixes #426
2 parents 6f54b3c + cb391ac commit 9ceb2a9

File tree

8 files changed

+33
-0
lines changed

8 files changed

+33
-0
lines changed

HEROKU.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ After clicking the Heroku button above:
2121
6. (optional) Copy and paste your Google/YouTube API key into the `GOOGLE_API_KEY` field.
2222
7. (optional) Copy and paste your Vimeo API key into the `VIMEO_API_KEY` field.
2323
8. (optional) If you have a Google Analytics account, you can paste your site tracking code into the `GA_TRACKING_CODE` field.
24+
9. (optional) If you would like to enable the Admin Panel, change the `ADMIN_PANEL_ENABLED` field to `true`.
2425
8. Click the Deploy button and wait for the process to complete.
2526

2627
### Step 3: Request a Developer Key

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ If you do not provide a Vimeo API key, a warning log will be recorded in `config
179179
### Google Analytics
180180
If you would like to use Google Analytics for tracking usage of UDOIT, create a new tracking code and add it to `config/localConfig.php` in the `define('GA_TRACKING_CODE', '');` statement. For example, if your tracking code is `UA-12345678-1`, that line should look like `define('GA_TRACKING_CODE', 'UA-12345678-1');` when you're done.
181181

182+
### Admin Panel
183+
As of 2.5.0, the admin panel is still an experimental feature. Consider it a first draft of what we'd like it to be. It lets you view reports across your institution, generate statistics about reports and user growth, and administer user accounts. This feature is disabled by default. To enable it, change `$admin_panel_enabled` to `true`.
184+
182185
### Installing the LTI in Canvas
183186
Log into Canvas to add UDOIT:
184187

app.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@
7373
"ALT_TEXT_LENGTH_LIMIT": {
7474
"description": "Maximum character length for alt-text before the item gets flagged as a warning.",
7575
"value": "125"
76+
},
77+
"ADMIN_PANEL_ENABLED": {
78+
"description": "Enable the Admin Panel feature. False disables access and removes the block from the configuration XML.",
79+
"value": "false"
7680
}
7781
},
7882
"addons": [

config/herokuConfig.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,6 @@
6868
// Sets CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST
6969
// This should be true for production environments
7070
$curl_ssl_verify = true;
71+
72+
// Admin panel. False disables access and removes block from XML.
73+
$admin_panel_enabled = (getenv("ADMIN_PANEL_ENABLED")) == 'true';

config/localConfig.template.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,17 @@
7171
// For use while developing with self-signed SSL Certificates
7272
// Sets CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST
7373
$curl_ssl_verify = true; // This should be true for production environments
74+
75+
76+
/* Admin Panel
77+
*
78+
* True adds a Admin Navigation placement to the XML. Allows for generating
79+
* statistics about usage of UDOIT. Also allows for user administration.
80+
*
81+
* False disables access and removes block from XML. Use this setting if you
82+
* are in a multitenant environment, as the 2.5.0 release of UDOIT does not
83+
* separate data between instances of Canvas.
84+
*
85+
* Default false
86+
*/
87+
$admin_panel_enabled = false;

config/localConfig.test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
// This should be true for production environments
5656
$curl_ssl_verify = true;
5757

58+
$admin_panel_enabled = true;
59+
5860
// send logs into the phpunit output
5961
$log_handler = new \Monolog\Handler\TestHandler(null, \Monolog\Logger::WARNING);
6062
$log_handler->setFormatter(new \Monolog\Formatter\LineFormatter(null, null, true, true));

public/admin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
UdoitUtils::instance()->exitWithPageError("Missing Session information. Please refresh the page. Missing: {$key}");
3131
}
3232
}
33+
// If the feature has been disabled, deny access.
34+
if (!$admin_panel_enabled) {
35+
UdoitUtils::instance()->exitWithPageError("This feature has been disabled. Please contact your UDOIT administrator.");
36+
}
3337

3438
// If Administrator is not found in the user's list of roles, kick them out with an error
3539
if (!$_SESSION['is_admin']) {

public/udoit.xml.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@
5757
<lticm:property name="text"><?= $canvas_nav_item_name ? $canvas_nav_item_name : 'UDOIT' ?></lticm:property>
5858
<lticm:property name="enabled">true</lticm:property>
5959
</lticm:options>
60+
<?php if ($admin_panel_enabled): ?>
6061
<lticm:options name="account_navigation">
6162
<lticm:property name="enabled">true</lticm:property>
6263
<lticm:property name="url"><?= $launch ?>?d=admin</lticm:property>
6364
<lticm:property name="text"><?= $canvas_nav_item_name ? $canvas_nav_item_name : 'UDOIT' ?> Admin</lticm:property>
6465
</lticm:options>
66+
<?php endif; ?>
6567
</blti:extensions>
6668
<cartridge_bundle identifierref="BLTI001_Bundle"/>
6769
<cartridge_icon identifierref="BLTI001_Icon"/>

0 commit comments

Comments
 (0)