diff --git a/main/coursecopy/copy_course_session.php b/main/coursecopy/copy_course_session.php index 5350099012..4e3bffce98 100644 --- a/main/coursecopy/copy_course_session.php +++ b/main/coursecopy/copy_course_session.php @@ -18,7 +18,7 @@ $language_file = array('coursebackup', 'admin'); $cidReset = true; require_once '../inc/global.inc.php'; $current_course_tool = TOOL_COURSE_MAINTENANCE; -api_protect_course_script(true); +api_protect_course_script(true, true); require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; require_once api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php'; diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index 13ae574370..9bcc72ebd8 100644 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -769,14 +769,15 @@ function api_valid_email($address) { * * This is only the first proposal, test and improve! * @param boolean Option to print headers when displaying error message. Default: false + * @param boolean Whether session admins should be allowed or not. * @return boolean True if the user has access to the current course or is out of a course context, false otherwise * @todo replace global variable * @author Roan Embrechts */ -function api_protect_course_script($print_headers = false) { +function api_protect_course_script($print_headers = false, $allow_session_admins = false) { global $is_allowed_in_course; $is_visible = false; - if (api_is_platform_admin()) { + if (api_is_platform_admin($allow_session_admins)) { return true; } $course_info = api_get_course_info(); @@ -2048,6 +2049,7 @@ function api_get_self() { /** * Checks whether current user is a platform administrator + * @param boolean Whether session admins should be considered admins or not * @return boolean True if the user has platform admin rights, * false otherwise. * @see usermanager::is_admin(user_id) for a user-id specific function @@ -5898,4 +5900,4 @@ function api_get_locked_settings() { 'login_is_email', 'chamilo_database_version' ); -} \ No newline at end of file +}