Skip to content

Commit

Permalink
Merge pull request #3 from grezniczek/super-user-only-control
Browse files Browse the repository at this point in the history
Option to limit project config access to super users only
  • Loading branch information
grezniczek authored Jul 22, 2020
2 parents 19ac5b6 + d32aa61 commit 404426d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ExternalModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
*/
class ExternalModule extends AbstractExternalModule {

function redcap_module_configure_button_display() {
if ($this->getSystemSetting("su_only") && !SUPER_USER) return null;
return true;
}

function redcap_data_entry_form_top($project_id, $record = null, $instrument, $event_id, $group_id = null, $repeat_instance = 1) {
$this->injectJS("data_entry", $instrument);
}
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ If more than one snippet is injected into the same page, the injection occurs in

_Note:_ Due to a limitation in the EM configuration dialog, branching logic does not work for nested elements, and thus the instrument selection box cannot be hidden when not applicable (in case of _Project Home Page_, _Record Status Dashboard_, _Add / Edit Records_, and _Record Home Page_).

In the system configuration, admins can set this module's project configurations to be accessible only to super users.

## Acknowledgments

This external module is basically just a modification of the [REDCap CSS Injector](https://github.com/ctsit/redcap_css_injector) module.
Expand All @@ -36,6 +38,7 @@ Instructions for testing the module can be found [here](?prefix=redcap_javascrip

Version | Description
------- | ------------------
1.1.1 | Fix the _All project pages_ behavior that was broken in version 1.1.0.<br>Disable branching logic.<br>Add instructions for testing the module.
1.1.2 | Add system setting for limiting project configuration access to super users only.
1.1.1 | Fix the _All project pages_ behavior that was broken in version 1.1.0.<br>Disable branching logic.<br>Add instructions for testing the module.
1.1.0 | New feature: Inject JS on more project pages: _Project Home Page_, _Record Home Page_, _Add / Edit Records_, and _Record Status Dashboard_.
1.0.0 | Initial release.
7 changes: 7 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"institution": "Ruhr-Universität Bochum"
}
],
"system-settings": [
{
"name": "Allow only super-users to configure this module in projects",
"key": "su_only",
"type": "checkbox"
}
],
"project-settings": [
{
"name": "JS Code",
Expand Down
14 changes: 14 additions & 0 deletions redcap_js_injector.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"folders": [
{
"path": "."
},
{
"path": "..\\..\\external_modules",
"name": "EM Framework"
}
],
"settings": {
"php.suggest.basic": false
}
}

0 comments on commit 404426d

Please sign in to comment.