diff --git a/local/o365/classes/rest/unified.php b/local/o365/classes/rest/unified.php index 3d29e0fb3..123b881a9 100644 --- a/local/o365/classes/rest/unified.php +++ b/local/o365/classes/rest/unified.php @@ -43,7 +43,8 @@ public static function is_configured() { * @return bool Whether the unified API is enabled. */ public static function is_enabled() { - return false; + $enabled = get_config('local_o365', 'enableunifiedapi'); + return (!empty($enabled)) ? true : false; } /** @@ -510,4 +511,4 @@ public function check_permissions() { return $missingpermsreturn; } -} \ No newline at end of file +} diff --git a/local/o365/lang/en/local_o365.php b/local/o365/lang/en/local_o365.php index 8b2982a3e..f02c2ee76 100644 --- a/local/o365/lang/en/local_o365.php +++ b/local/o365/lang/en/local_o365.php @@ -114,6 +114,8 @@ $string['settings_detectperms_update'] = 'Update'; $string['settings_detectperms_valid'] = 'Permissions have been set up.'; $string['settings_detectperms_invalid'] = 'Check permissions in Azure AD'; +$string['settings_enableunifiedapi'] = 'Enable Unified API'; +$string['settings_enableunifiedapi_details'] = 'The unified API is a preview API that provides some new features like the "Create user groups" setting below. It will eventually replace the application-specific Office APIs, however it is still in preview and is subject to change which may break some functionality. If you\'d like to try it out, enable this setting and click "Save changes". Add the "Unified API" to your application in Azure then return here and run the "Azure Setup" tool below.'; $string['settings_header_setup'] = 'Setup'; $string['settings_header_options'] = 'Options'; $string['settings_healthcheck'] = 'Health Check'; diff --git a/local/o365/settings.php b/local/o365/settings.php index 5451fa44f..665934c23 100644 --- a/local/o365/settings.php +++ b/local/o365/settings.php @@ -59,6 +59,10 @@ $desc = get_string('settings_o365china_details', 'local_o365'); $settings->add(new \admin_setting_configcheckbox('local_o365/chineseapi', $label, $desc, '0')); + $label = get_string('settings_enableunifiedapi', 'local_o365'); + $desc = get_string('settings_enableunifiedapi_details', 'local_o365'); + $settings->add(new \admin_setting_configcheckbox('local_o365/enableunifiedapi', $label, $desc, '0')); + $label = get_string('settings_creategroups', 'local_o365'); $desc = get_string('settings_creategroups_details', 'local_o365'); $settings->add(new \admin_setting_configcheckbox('local_o365/creategroups', $label, $desc, '0'));