diff --git a/edit_form.php b/edit_form.php index aad2521..96da1d5 100644 --- a/edit_form.php +++ b/edit_form.php @@ -71,6 +71,7 @@ protected function specific_definition($mform) { $mform->addElement('select', 'config_course', get_string('existing_course', 'block_panopto'), $courselist['courses']); + $mform->addHelpButton('config_course', 'existing_course', 'block_panopto'); $mform->setDefault('config_course', $courselist['selected']); // Set course context to get roles. @@ -115,6 +116,28 @@ protected function specific_definition($mform) { $mform->addElement('static', 'error', '', get_string('block_edit_error', 'block_panopto')); } } + + /** + * Custom form validation + * + * @param array $data + * @param array $files + * @return array + */ + public function validation($data, $files) { + $errors = parent::validation($data, $files); + + // Check to determine if folder is inheriting permissions. + $panoptodata = new \panopto_data($this->page->course->id); + $isfolderinheritingpermissions = $panoptodata->is_folder_inheriting_permissions($data['config_course']); + + // If folder is inheriting permissions, display error. + if ($isfolderinheritingpermissions) { + $errors['config_course'] = get_string('block_edit_error_inherited_permissions', 'block_panopto'); + } + + return $errors; + } } /* End of file edit_form.php */ diff --git a/lang/en/block_panopto.php b/lang/en/block_panopto.php index 3590a93..32bdb83 100644 --- a/lang/en/block_panopto.php +++ b/lang/en/block_panopto.php @@ -39,7 +39,7 @@ $string['attempt_unprovision_course'] = 'Attempting to unprovision a Panopto folder with an external Id of {$a}.'; $string['attempted_target_course_id'] = 'Moodle Id of the target course'; $string['attribute_ensure_branch_failed'] = 'Ensure branch error'; -$string['attribute_ensured_branch'] = 'Ensured branch heirarchy'; +$string['attribute_ensured_branch'] = 'Ensured branch hierarchy'; $string['attribute_new_name'] = 'New folder name'; $string['attribute_original_name'] = 'Original folder name'; $string['attribute_target_branch_leaf'] = 'Target branch leaf node category name'; @@ -52,6 +52,7 @@ $string['begin_building_category_structure'] = 'Start building category structure'; $string['begin_reinitializing_imports'] = 'Begin reinitializing imports'; $string['block_edit_error'] = 'Cannot configure block instance: Global configuration incomplete. Please contact your system administrator.'; +$string['block_edit_error_inherited_permissions'] = 'This folder inherits its sharing permissions access from a parent folder and therefore cannot be tied to a course. Please adjust the sharing setting to remove the inherited settings.'; $string['block_edit_header'] = 'Select the Panopto course folder to display in this block.'; $string['block_edit_header_help'] = 'Choose an existing Panopto course folder or provision a new Panopto course folder for this block'; $string['block_global_add_courses'] = 'Add Moodle courses to Panopto'; @@ -123,10 +124,10 @@ $string['block_panopto_sso_sync_type_desc'] = 'Select the behavior for user syncing when accessing Panopto content. Users can be synced at the same time as they are logged into Panopto, or in the background using an asynchronous task after they have successfully logged in.'; $string['block_panopto_sync_after_login'] = 'Authenticate and Sync to Panopto on Moodle Login (not recommended)'; $string['block_panopto_sync_after_login_desc'] = 'When selected, users are authenticated with Panopto and their permissions are synced when logging in to Moodle. Typically, authentication and permission sync will occur when a user accesses Panopto in the course and as such, we only recommend that organizations turn this setting on if they do not place the Panopto block in Moodle (not recommended). Additionally, log-in time will be extended if this option is selected.'; -$string['block_panopto_sync_after_provisioning'] = 'Sync Enroled Users after Successfully Provisioning (not recommended)'; -$string['block_panopto_sync_after_provisioning_desc'] = 'When selected, all users enroled in a course will be synchronized after provisioning. Typically, when a user accesses the Panopto block in a course, authentication and permission sync of that course happen. As such, we only recommend that organizations turn this setting on if they do not place the Panopto block in Moodle (not recommended).'; +$string['block_panopto_sync_after_provisioning'] = 'Sync Enrolled Users after Successfully Provisioning (not recommended)'; +$string['block_panopto_sync_after_provisioning_desc'] = 'When selected, all users enrolled in a course will be synchronized after provisioning. Typically, when a user accesses the Panopto block in a course, authentication and permission sync of that course happen. As such, we only recommend that organizations turn this setting on if they do not place the Panopto block in Moodle (not recommended).'; $string['block_panopto_sync_on_enrolment'] = 'Sync Users after Class Enrolment (optional)'; -$string['block_panopto_sync_on_enrolment_desc'] = 'When selected, the permission when a student is enroled into a course is synchronized with a valid Panopto folder. When disabled, users will be synced with Panopto when the user views the Panopto block. If you do not intend to use the block in a course, or if a course has embedded Panopto content directly into the course homepage (content will load before the block syncs in this case), this feature can be enabled. Note: Enabling this feature may cause a performance slowdown when enroling users.'; +$string['block_panopto_sync_on_enrolment_desc'] = 'When selected, the permission when a student is enrolled into a course is synchronized with a valid Panopto folder. When disabled, users will be synced with Panopto when the user views the Panopto block. If you do not intend to use the block in a course, or if a course has embedded Panopto content directly into the course homepage (content will load before the block syncs in this case), this feature can be enabled. Note: Enabling this feature may cause a performance slowdown when enroling users.'; $string['block_panopto_wsdl_proxy_host'] = 'WSDL Proxy Host'; $string['block_panopto_wsdl_proxy_host_desc'] = 'Optionally, you can add in the host address used as a proxy for any Panopto service WSDL.'; $string['block_panopto_wsdl_proxy_port'] = 'WSDL Proxy Port'; @@ -180,8 +181,9 @@ $string['error_no_admin_account_found'] = 'Error: No admin account was found'; $string['error_retrieving'] = 'Error retrieving Panopto course folder. Please check the PHP error_log for more details.'; $string['existing_course'] = 'Select an existing Panopto folder that is not currently mapped to another course:'; +$string['existing_course_help'] = 'Please note that we cannot map to the assignment folders or folders with inherited permissions.'; $string['fetching_content'] = 'Fetching Panopto content...'; -$string['folder_not_found_error'] = 'The folder currenty provisioned to the target Moodle course on the Panopto server could not be found, was it deleted? Provisioning will continue by linking to the default Moodle folder or creating one if it does not already exist.'; +$string['folder_not_found_error'] = 'The folder currently provisioned to the target Moodle course on the Panopto server could not be found, was it deleted? Provisioning will continue by linking to the default Moodle folder or creating one if it does not already exist.'; $string['get_provisioning_info'] = 'Attempting to get provisioning info for a course with the Moodle Id: {$a}.'; $string['groups_getting_synced'] = 'Groups to be synced with this call: {$a}'; $string['impacted_server'] = 'Impacted server: {$a}'; @@ -213,7 +215,7 @@ $string['no_publishers'] = 'No publishers.'; $string['no_server'] = 'There are no servers set up for provisioning. Please contact system administrator.'; $string['no_viewers'] = 'No viewers.'; -$string['no_users_synced_desc'] = 'Any users enroled in the course will be synced to Panopto once they view the Panopto block in a course.'; +$string['no_users_synced_desc'] = 'Any users enrolled in the course will be synced to Panopto once they view the Panopto block in a course.'; $string['or'] = 'OR'; $string['panopto:addinstance'] = 'Add a new Panopto block'; $string['panopto:myaddinstance'] = 'Add a new Panopto block to my page'; @@ -260,7 +262,7 @@ $string['show_less'] = 'Show less'; $string['sso_invalid_authcode'] = 'Invalid auth code.'; $string['sso_invalid_server'] = 'Invalid Panopto Server. Server needs to be configured in Panopto block config before use.'; -$string['sso_type_asyncsync'] = 'Make asnchronous sync task on Panopto login'; +$string['sso_type_asyncsync'] = 'Make asynchronous sync task on Panopto login'; $string['sso_type_nosync'] = 'Do not sync on Panopto login'; $string['sso_type_sync'] = 'Sync on Panopto login'; $string['synced_user_info'] = 'Synced user information'; @@ -279,7 +281,7 @@ $string['unprovisioncourseselect'] = 'Select which courses you want to unprovision from Panopto'; $string['unprovisioncourseselect_help'] = 'Multiple selections are possible by Ctrl-clicking (Windows) or Cmd-clicking (Mac).'; $string['unprovisioned'] = 'This course has not yet been provisioned.'; -$string['upgrade_panopto_required_version'] = 'A Panopto server you are using does not meet the minimum required version to support this version of the Moodle Panopto Block. The upgrade will be blocked from succeeding until all Panopto servers in use meet miniumum version requirements.'; +$string['upgrade_panopto_required_version'] = 'A Panopto server you are using does not meet the minimum required version to support this version of the Moodle Panopto Block. The upgrade will be blocked from succeeding until all Panopto servers in use meet minimum version requirements.'; $string['users_have_been_synced'] = 'The below users have been synced and should be ready to use Panopto.'; $string['users_will_be_synced_custom'] = 'Future users will automatically be synced according to your custom Panopto settings.'; $string['verifying_permission'] = 'Verifying permission'; diff --git a/lib/AuthManagement/AuthManagementWsdlClass.php b/lib/AuthManagement/AuthManagementWsdlClass.php index 141d456..7f7b733 100644 --- a/lib/AuthManagement/AuthManagementWsdlClass.php +++ b/lib/AuthManagement/AuthManagementWsdlClass.php @@ -631,7 +631,7 @@ public function length() * @uses AuthManagementWsdlClass::getInternArrayToIterateIsArray() * @return int */ - public function count() + public function count(): int { return $this->getInternArrayToIterateIsArray()?count($this->getInternArrayToIterate()):-1; } @@ -640,7 +640,7 @@ public function count() * @uses AuthManagementWsdlClass::offsetGet() * @return mixed */ - public function current() + public function current(): mixed { return $this->offsetGet($this->internArrayToIterateOffset); } @@ -648,20 +648,20 @@ public function current() * Method moving the current position to the next element * @uses AuthManagementWsdlClass::getInternArrayToIterateOffset() * @uses AuthManagementWsdlClass::setInternArrayToIterateOffset() - * @return int + * @return void */ - public function next() + public function next(): void { - return $this->setInternArrayToIterateOffset($this->getInternArrayToIterateOffset() + 1); + $this->setInternArrayToIterateOffset($this->getInternArrayToIterateOffset() + 1); } /** * Method resetting itemOffset * @uses AuthManagementWsdlClass::setInternArrayToIterateOffset() - * @return int + * @return void */ - public function rewind() + public function rewind(): void { - return $this->setInternArrayToIterateOffset(0); + $this->setInternArrayToIterateOffset(0); } /** * Method checking if current itemOffset points to an existing item @@ -669,16 +669,16 @@ public function rewind() * @uses AuthManagementWsdlClass::offsetExists() * @return bool true|false */ - public function valid() + public function valid(): bool { return $this->offsetExists($this->getInternArrayToIterateOffset()); } /** * Method returning current itemOffset value, alias to getInternArrayToIterateOffset * @uses AuthManagementWsdlClass::getInternArrayToIterateOffset() - * @return int + * @return mixed */ - public function key() + public function key(): mixed { return $this->getInternArrayToIterateOffset(); } @@ -767,7 +767,7 @@ public function last() * @param int $_offset * @return bool true|false */ - public function offsetExists($_offset) + public function offsetExists($_offset): bool { return ($this->getInternArrayToIterateIsArray() && array_key_exists($_offset,$this->getInternArrayToIterate())); } @@ -777,7 +777,7 @@ public function offsetExists($_offset) * @param int $_offset * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return $this->offsetExists($_offset)?$this->internArrayToIterate[$_offset]:null; } @@ -785,21 +785,17 @@ public function offsetGet($_offset) * Method useless but necessarly overridden, can't set * @param mixed $_offset * @param mixed $_value - * @return null + * @return void */ - public function offsetSet($_offset,$_value) - { - return null; - } + public function offsetSet($_offset,$_value): void + {} /** * Method useless but necessarly overridden, can't unset * @param mixed $_offset - * @return null + * @return void */ - public function offsetUnset($_offset) - { - return null; - } + public function offsetUnset($_offset): void + {} /** * Method returning current result from Soap call * @return mixed @@ -1008,7 +1004,7 @@ public function __construct ($wsdl, array $options = null) { * @param string $version * @param int $one_way */ - public function __doRequest($request, $location, $action, $version, $one_way = 0) { + public function __doRequest($request, $location, $action, $version, $one_way = 0): ?string { if (get_config('block_panopto', 'enforce_https_on_wsdl')) { $location = str_replace('http://', 'https://', $location); } diff --git a/lib/SessionManagement/Array/Context/SessionManagementStructArrayOfFolderWithExternalContext.php b/lib/SessionManagement/Array/Context/SessionManagementStructArrayOfFolderWithExternalContext.php index e798cea..8933e69 100644 --- a/lib/SessionManagement/Array/Context/SessionManagementStructArrayOfFolderWithExternalContext.php +++ b/lib/SessionManagement/Array/Context/SessionManagementStructArrayOfFolderWithExternalContext.php @@ -79,9 +79,9 @@ public function setFolderWithExternalContext($_folderWithExternalContext) /** * Returns the current element * @see SessionManagementWsdlClass::current() - * @return SessionManagementStructFolderWithExternalContext + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see SessionManagementWsdlClass::last() * @param int $_offset - * @return SessionManagementStructFolderWithExternalContext + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/SessionManagement/Array/Folder/SessionManagementStructArrayOfExtendedFolder.php b/lib/SessionManagement/Array/Folder/SessionManagementStructArrayOfExtendedFolder.php new file mode 100644 index 0000000..40417c0 --- /dev/null +++ b/lib/SessionManagement/Array/Folder/SessionManagementStructArrayOfExtendedFolder.php @@ -0,0 +1,155 @@ +. + +/** + * + * @package block_panopto + * @copyright Panopto 2020 + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + /** + * File for class SessionManagementStructArrayOfExtendedFolder + * @package SessionManagement + * @subpackage Structs + * @author Panopto + * @version 20150429-01 + * @date 2017-01-19 + */ +/** + * This class stands for SessionManagementStructArrayOfExtendedFolder originally named ArrayOfFolder + * Meta informations extracted from the WSDL + * - from schema : {@link http://demo.hosted.panopto.com/Panopto/PublicAPI/4.6/SessionManagement.svc?xsd=xsd3} + * @package SessionManagement + * @subpackage Structs + * @author Panopto + * @version 20150429-01 + * @date 2017-01-19 + */ +class SessionManagementStructArrayOfExtendedFolder extends SessionManagementWsdlClass +{ + /** + * The ExtendedFolder + * Meta informations extracted from the WSDL + * - maxOccurs : unbounded + * - minOccurs : 0 + * - nillable : true + * @var SessionManagementStructExtendedFolder + */ + public $ExtendedFolder; + /** + * Constructor method for ArrayOfExtendedFolder + * @see parent::__construct() + * @param SessionManagementStructExtendedFolder $_extendedFolder + * @return SessionManagementStructArrayOfExtendedFolder + */ + public function __construct($_extendedFolder = NULL) + { + parent::__construct(array('ExtendedFolder'=>$_extendedFolder),false); + } + /** + * Get ExtendedFolder value + * @return SessionManagementStructExtendedFolder|null + */ + public function getExtendedFolder() + { + return $this->Folder; + } + /** + * Set ExtendedFolder value + * @param SessionManagementStructExtendedFolder $_extendedFolder the ExtendedFolder + * @return SessionManagementStructExtendedFolder + */ + public function setExtendedFolder($_extendedFolder) + { + return ($this->ExtendedFolder = $_extendedFolder); + } + /** + * Returns the current element + * @see SessionManagementWsdlClass::current() + * @return mixed + */ + public function current(): mixed + { + return parent::current(); + } + /** + * Returns the indexed element + * @see SessionManagementWsdlClass::item() + * @param int $_index + * @return SessionManagementStructExtendedFolder + */ + public function item($_index) + { + return parent::item($_index); + } + /** + * Returns the first element + * @see SessionManagementWsdlClass::first() + * @return SessionManagementStructExtendedFolder + */ + public function first() + { + return parent::first(); + } + /** + * Returns the last element + * @see SessionManagementWsdlClass::last() + * @return SessionManagementStructExtendedFolder + */ + public function last() + { + return parent::last(); + } + /** + * Returns the element at the offset + * @see SessionManagementWsdlClass::last() + * @param int $_offset + * @return mixed + */ + public function offsetGet($_offset): mixed + { + return parent::offsetGet($_offset); + } + /** + * Returns the attribute name + * @see SessionManagementWsdlClass::getAttributeName() + * @return string ExtendedFolder + */ + public function getAttributeName() + { + return 'ExtendedFolder'; + } + /** + * Method called when an object has been exported with var_export() functions + * It allows to return an object instantiated with the values + * @see SessionManagementWsdlClass::__set_state() + * @uses SessionManagementWsdlClass::__set_state() + * @param array $_array the exported values + * @return SessionManagementStructArrayOfExtendedFolder + */ + public static function __set_state(array $_array) + { + return parent::__set_state($_array); + } + /** + * Method returning the class name + * @return string __CLASS__ + */ + public function __toString() + { + return __CLASS__; + } +} diff --git a/lib/SessionManagement/Array/Folder/SessionManagementStructArrayOfFolder.php b/lib/SessionManagement/Array/Folder/SessionManagementStructArrayOfFolder.php index 90778fe..b6ca3a6 100644 --- a/lib/SessionManagement/Array/Folder/SessionManagementStructArrayOfFolder.php +++ b/lib/SessionManagement/Array/Folder/SessionManagementStructArrayOfFolder.php @@ -79,9 +79,9 @@ public function setFolder($_folder) /** * Returns the current element * @see SessionManagementWsdlClass::current() - * @return SessionManagementStructFolder + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see SessionManagementWsdlClass::last() * @param int $_offset - * @return SessionManagementStructFolder + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/SessionManagement/Array/Note/SessionManagementStructArrayOfNote.php b/lib/SessionManagement/Array/Note/SessionManagementStructArrayOfNote.php index c6fefcc..43eeb02 100644 --- a/lib/SessionManagement/Array/Note/SessionManagementStructArrayOfNote.php +++ b/lib/SessionManagement/Array/Note/SessionManagementStructArrayOfNote.php @@ -79,9 +79,9 @@ public function setNote($_note) /** * Returns the current element * @see SessionManagementWsdlClass::current() - * @return SessionManagementStructNote + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see SessionManagementWsdlClass::last() * @param int $_offset - * @return SessionManagementStructNote + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/SessionManagement/Array/OfExternalHierarchyInfo/SessionManagementStructArrayOfExternalHierarchyInfo.php b/lib/SessionManagement/Array/OfExternalHierarchyInfo/SessionManagementStructArrayOfExternalHierarchyInfo.php index f2ab2b0..a2a2222 100644 --- a/lib/SessionManagement/Array/OfExternalHierarchyInfo/SessionManagementStructArrayOfExternalHierarchyInfo.php +++ b/lib/SessionManagement/Array/OfExternalHierarchyInfo/SessionManagementStructArrayOfExternalHierarchyInfo.php @@ -77,9 +77,9 @@ public function setExternalHierarchyInfo($_externalHierarchyInfo) /** * Returns the current element * @see SessionManagementWsdlClass::current() - * @return SessionManagementStructExternalHierarchyInfo + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -115,9 +115,9 @@ public function last() * Returns the element at the offset * @see SessionManagementWsdlClass::last() * @param int $_offset - * @return SessionManagementStructExternalHierarchyInfo + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/SessionManagement/Array/Ofguid/SessionManagementStructArrayOfguid.php b/lib/SessionManagement/Array/Ofguid/SessionManagementStructArrayOfguid.php index adf6c8a..43ebe94 100644 --- a/lib/SessionManagement/Array/Ofguid/SessionManagementStructArrayOfguid.php +++ b/lib/SessionManagement/Array/Ofguid/SessionManagementStructArrayOfguid.php @@ -79,9 +79,9 @@ public function setGuid($_guid) /** * Returns the current element * @see SessionManagementWsdlClass::current() - * @return guid + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see SessionManagementWsdlClass::last() * @param int $_offset - * @return guid + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/SessionManagement/Array/Ofstring/SessionManagementStructArrayOfstring.php b/lib/SessionManagement/Array/Ofstring/SessionManagementStructArrayOfstring.php index 77bf1ef..065374a 100644 --- a/lib/SessionManagement/Array/Ofstring/SessionManagementStructArrayOfstring.php +++ b/lib/SessionManagement/Array/Ofstring/SessionManagementStructArrayOfstring.php @@ -79,9 +79,9 @@ public function setString($_string) /** * Returns the current element * @see SessionManagementWsdlClass::current() - * @return string + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see SessionManagementWsdlClass::last() * @param int $_offset - * @return string + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/SessionManagement/Array/Role/SessionManagementStructArrayOfAccessRole.php b/lib/SessionManagement/Array/Role/SessionManagementStructArrayOfAccessRole.php index 01b8beb..1bede21 100644 --- a/lib/SessionManagement/Array/Role/SessionManagementStructArrayOfAccessRole.php +++ b/lib/SessionManagement/Array/Role/SessionManagementStructArrayOfAccessRole.php @@ -78,9 +78,9 @@ public function setAccessRole($_accessRole) /** * Returns the current element * @see SessionManagementWsdlClass::current() - * @return SessionManagementEnumAccessRole + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -116,9 +116,9 @@ public function last() * Returns the element at the offset * @see SessionManagementWsdlClass::last() * @param int $_offset - * @return SessionManagementEnumAccessRole + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/SessionManagement/Array/Session/SessionManagementStructArrayOfSession.php b/lib/SessionManagement/Array/Session/SessionManagementStructArrayOfSession.php index 791e6b9..29c9584 100644 --- a/lib/SessionManagement/Array/Session/SessionManagementStructArrayOfSession.php +++ b/lib/SessionManagement/Array/Session/SessionManagementStructArrayOfSession.php @@ -79,9 +79,9 @@ public function setSession($_session) /** * Returns the current element * @see SessionManagementWsdlClass::current() - * @return SessionManagementStructSession + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see SessionManagementWsdlClass::last() * @param int $_offset - * @return SessionManagementStructSession + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/SessionManagement/Array/Settings/SessionManagementStructArrayOfFolderAvailabilitySettings.php b/lib/SessionManagement/Array/Settings/SessionManagementStructArrayOfFolderAvailabilitySettings.php index 76c0027..5a9fdde 100644 --- a/lib/SessionManagement/Array/Settings/SessionManagementStructArrayOfFolderAvailabilitySettings.php +++ b/lib/SessionManagement/Array/Settings/SessionManagementStructArrayOfFolderAvailabilitySettings.php @@ -79,9 +79,9 @@ public function setFolderAvailabilitySettings($_folderAvailabilitySettings) /** * Returns the current element * @see SessionManagementWsdlClass::current() - * @return SessionManagementStructFolderAvailabilitySettings + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see SessionManagementWsdlClass::last() * @param int $_offset - * @return SessionManagementStructFolderAvailabilitySettings + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/SessionManagement/Array/Settings/SessionManagementStructArrayOfSessionAvailabilitySettings.php b/lib/SessionManagement/Array/Settings/SessionManagementStructArrayOfSessionAvailabilitySettings.php index 7d6ad93..80fe3e0 100644 --- a/lib/SessionManagement/Array/Settings/SessionManagementStructArrayOfSessionAvailabilitySettings.php +++ b/lib/SessionManagement/Array/Settings/SessionManagementStructArrayOfSessionAvailabilitySettings.php @@ -79,9 +79,9 @@ public function setSessionAvailabilitySettings($_sessionAvailabilitySettings) /** * Returns the current element * @see SessionManagementWsdlClass::current() - * @return SessionManagementStructSessionAvailabilitySettings + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see SessionManagementWsdlClass::last() * @param int $_offset - * @return SessionManagementStructSessionAvailabilitySettings + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/SessionManagement/Array/State/SessionManagementStructArrayOfSessionState.php b/lib/SessionManagement/Array/State/SessionManagementStructArrayOfSessionState.php index 3c39686..c7529e3 100644 --- a/lib/SessionManagement/Array/State/SessionManagementStructArrayOfSessionState.php +++ b/lib/SessionManagement/Array/State/SessionManagementStructArrayOfSessionState.php @@ -78,9 +78,9 @@ public function setSessionState($_sessionState) /** * Returns the current element * @see SessionManagementWsdlClass::current() - * @return SessionManagementEnumSessionState + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -116,9 +116,9 @@ public function last() * Returns the element at the offset * @see SessionManagementWsdlClass::last() * @param int $_offset - * @return SessionManagementEnumSessionState + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/SessionManagement/Folder/SessionManagementStructExtendedFolder.php b/lib/SessionManagement/Folder/SessionManagementStructExtendedFolder.php new file mode 100644 index 0000000..63af889 --- /dev/null +++ b/lib/SessionManagement/Folder/SessionManagementStructExtendedFolder.php @@ -0,0 +1,98 @@ +. + +/** + * + * @package block_panopto + * @copyright Panopto 2020 + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + /** + * File for class SessionManagementStructExtendedFolder + * @package SessionManagement + * @subpackage Structs + * @author Panopto + * @version 20150429-01 + * @date 2017-01-19 + */ +/** + * This class stands for SessionManagementStructExtendedFolder originally named ExternalFolder + * Meta informations extracted from the WSDL + * - from schema : {@link http://demo.hosted.panopto.com/Panopto/PublicAPI/4.6/SessionManagement.svc?xsd=xsd3} + * @package SessionManagement + * @subpackage Structs + * @author Panopto + * @version 20150429-01 + * @date 2017-01-19 + */ +class SessionManagementStructExtendedFolder extends SessionManagementStructFolderBase +{ + /** + * The ExternalId + * Meta informations extracted from the WSDL + * - minOccurs : 0 + * - nillable : true + * @var string + */ + public $IsAssignmentFolder; + /** + * Constructor method for Folder + * @see parent::__construct() + * @param string $_isAssignmentFolder + * @return SessionManagementStructExtendedFolder + */ + public function __construct($_isAssignmentFolder = NULL) + { + SessionManagementWsdlClass::__construct(array('IsAssignmentFolder'=>$_isAssignmentFolder),false); + } + /** + * Get IsAssignmentFolder value + * @return string|null + */ + public function getIsAssignmentFolder() + { + return $this->IsAssignmentFolder; + } + /** + * Set IsAssignmentFolder value + * @param string $_isAssignmentFolder the IsAssignmentFolder + * @return string + */ + public function setIsAssignmentFolder($_isAssignmentFolder) + { + return ($this->IsAssignmentFolder = $_isAssignmentFolder); + } + /** + * Method called when an object has been exported with var_export() functions + * It allows to return an object instantiated with the values + * @see SessionManagementWsdlClass::__set_state() + * @uses SessionManagementWsdlClass::__set_state() + * @param array $_array the exported values + * @return SessionManagementStructExtendedFolder + */ + public static function __set_state(array $_array) + { + return parent::__set_state($_array); + } + /** + * Method returning the class name + * @return string __CLASS__ + */ + public function __toString() + { + return __CLASS__; + } +} diff --git a/lib/SessionManagement/Get/List/SessionManagementStructGetExtendedCreatorFoldersList.php b/lib/SessionManagement/Get/List/SessionManagementStructGetExtendedCreatorFoldersList.php new file mode 100644 index 0000000..12fed60 --- /dev/null +++ b/lib/SessionManagement/Get/List/SessionManagementStructGetExtendedCreatorFoldersList.php @@ -0,0 +1,150 @@ +. + +/** + * + * @package block_panopto + * @copyright Panopto 2020 + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + /** + * File for class SessionManagementStructGetExtendedCreatorFoldersList + * @package SessionManagement + * @subpackage Structs + * @author Panopto + * @version 20150429-01 + * @date 2017-01-19 + */ +/** + * This class stands for SessionManagementStructGetExtendedCreatorFoldersList originally named GetCreatorFoldersList + * Meta informations extracted from the WSDL + * - from schema : {@link http://demo.hosted.panopto.com/Panopto/PublicAPI/4.6/SessionManagement.svc?xsd=xsd0} + * @package SessionManagement + * @subpackage Structs + * @author Panopto + * @version 20150429-01 + * @date 2017-01-19 + */ +class SessionManagementStructGetExtendedCreatorFoldersList extends SessionManagementWsdlClass +{ + /** + * The auth + * Meta informations extracted from the WSDL + * - minOccurs : 0 + * - nillable : true + * @var SessionManagementStructAuthenticationInfo + */ + public $auth; + /** + * The request + * Meta informations extracted from the WSDL + * - minOccurs : 0 + * - nillable : true + * @var SessionManagementStructListFoldersRequest + */ + public $request; + /** + * The searchQuery + * Meta informations extracted from the WSDL + * - minOccurs : 0 + * - nillable : true + * @var string + */ + public $searchQuery; + /** + * Constructor method for GetCreatorFoldersList + * @see parent::__construct() + * @param SessionManagementStructAuthenticationInfo $_auth + * @param SessionManagementStructListFoldersRequest $_request + * @param string $_searchQuery + * @return SessionManagementStructGetExtendedCreatorFoldersList + */ + public function __construct($_auth = NULL,$_request = NULL,$_searchQuery = NULL) + { + parent::__construct(array('auth'=>$_auth,'request'=>$_request,'searchQuery'=>$_searchQuery),false); + } + /** + * Get auth value + * @return SessionManagementStructAuthenticationInfo|null + */ + public function getAuth() + { + return $this->auth; + } + /** + * Set auth value + * @param SessionManagementStructAuthenticationInfo $_auth the auth + * @return SessionManagementStructAuthenticationInfo + */ + public function setAuth($_auth) + { + return ($this->auth = $_auth); + } + /** + * Get request value + * @return SessionManagementStructListFoldersRequest|null + */ + public function getRequest() + { + return $this->request; + } + /** + * Set request value + * @param SessionManagementStructListFoldersRequest $_request the request + * @return SessionManagementStructListFoldersRequest + */ + public function setRequest($_request) + { + return ($this->request = $_request); + } + /** + * Get searchQuery value + * @return string|null + */ + public function getSearchQuery() + { + return $this->searchQuery; + } + /** + * Set searchQuery value + * @param string $_searchQuery the searchQuery + * @return string + */ + public function setSearchQuery($_searchQuery) + { + return ($this->searchQuery = $_searchQuery); + } + /** + * Method called when an object has been exported with var_export() functions + * It allows to return an object instantiated with the values + * @see SessionManagementWsdlClass::__set_state() + * @uses SessionManagementWsdlClass::__set_state() + * @param array $_array the exported values + * @return SessionManagementStructGetExtendedCreatorFoldersList + */ + public static function __set_state(array $_array) + { + return parent::__set_state($_array); + } + /** + * Method returning the class name + * @return string __CLASS__ + */ + public function __toString() + { + return __CLASS__; + } +} diff --git a/lib/SessionManagement/Get/Response/SessionManagementStructGetExtendedCreatorFoldersListResponse.php b/lib/SessionManagement/Get/Response/SessionManagementStructGetExtendedCreatorFoldersListResponse.php new file mode 100644 index 0000000..3a348a5 --- /dev/null +++ b/lib/SessionManagement/Get/Response/SessionManagementStructGetExtendedCreatorFoldersListResponse.php @@ -0,0 +1,98 @@ +. + +/** + * + * @package block_panopto + * @copyright Panopto 2020 + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + /** + * File for class SessionManagementStructGetExtendedCreatorFoldersListResponse + * @package SessionManagement + * @subpackage Structs + * @author Panopto + * @version 20150429-01 + * @date 2017-01-19 + */ +/** + * This class stands for SessionManagementStructGetExtendedCreatorFoldersListResponse originally named GetExtendedCreatorFoldersListResponse + * Meta informations extracted from the WSDL + * - from schema : {@link http://demo.hosted.panopto.com/Panopto/PublicAPI/4.6/SessionManagement.svc?xsd=xsd0} + * @package SessionManagement + * @subpackage Structs + * @author Panopto + * @version 20150429-01 + * @date 2017-01-19 + */ +class SessionManagementStructGetExtendedCreatorFoldersListResponse extends SessionManagementWsdlClass +{ + /** + * The GetCreatorFoldersListResult + * Meta informations extracted from the WSDL + * - minOccurs : 0 + * - nillable : true + * @var SessionManagementStructListExtendedFoldersResponse + */ + public $GetExtendedCreatorFoldersListResult; + /** + * Constructor method for GetExtendedCreatorFoldersListResponse + * @see parent::__construct() + * @param SessionManagementStructListExtendedFoldersResponse $_getExtendedCreatorFoldersListResult + * @return SessionManagementStructGetCreatorFoldersListResponse + */ + public function __construct($_getExtendedCreatorFoldersListResult = NULL) + { + parent::__construct(array('GetExtendedCreatorFoldersListResult'=>$_getExtendedCreatorFoldersListResult),false); + } + /** + * Get GetCreatorFoldersListResult value + * @return SessionManagementStructListExtendedFoldersResponse|null + */ + public function getExtendedGetCreatorFoldersListResult() + { + return $this->GetExtendedCreatorFoldersListResult; + } + /** + * Set GetCreatorFoldersListResult value + * @param SessionManagementStructListExtendedFoldersResponse $_getExtendedCreatorFoldersListResult the GetExtendedCreatorFoldersListResult + * @return SessionManagementStructListExtendedFoldersResponse + */ + public function setGetCreatorFoldersListResult($_getExtendedCreatorFoldersListResult) + { + return ($this->GetExtendedCreatorFoldersListResult = $_getExtendedCreatorFoldersListResult); + } + /** + * Method called when an object has been exported with var_export() functions + * It allows to return an object instantiated with the values + * @see SessionManagementWsdlClass::__set_state() + * @uses SessionManagementWsdlClass::__set_state() + * @param array $_array the exported values + * @return SessionManagementStructGetExtendedCreatorFoldersListResponse + */ + public static function __set_state(array $_array) + { + return parent::__set_state($_array); + } + /** + * Method returning the class name + * @return string __CLASS__ + */ + public function __toString() + { + return __CLASS__; + } +} diff --git a/lib/SessionManagement/Get/SessionManagementServiceGet.php b/lib/SessionManagement/Get/SessionManagementServiceGet.php index 72a6872..f100611 100644 --- a/lib/SessionManagement/Get/SessionManagementServiceGet.php +++ b/lib/SessionManagement/Get/SessionManagementServiceGet.php @@ -266,6 +266,25 @@ public function GetCreatorFoldersList(SessionManagementStructGetCreatorFoldersLi return !$this->saveLastError(__METHOD__,$soapFault); } } + /** + * Method to call the operation originally named GetExtendedCreatorFoldersList + * @uses SessionManagementWsdlClass::getSoapClient() + * @uses SessionManagementWsdlClass::setResult() + * @uses SessionManagementWsdlClass::saveLastError() + * @param SessionManagementStructGetExtendedCreatorFoldersList $_sessionManagementStructGetExtendedCreatorFoldersList + * @return SessionManagementStructGetExtendedCreatorFoldersListResponse + */ + public function GetExtendedCreatorFoldersList(SessionManagementStructGetExtendedCreatorFoldersList $_sessionManagementStructGetExtendedCreatorFoldersList) + { + try + { + return $this->setResult(self::getSoapClient()->GetExtendedCreatorFoldersList($_sessionManagementStructGetExtendedCreatorFoldersList)); + } + catch(SoapFault $soapFault) + { + return !$this->saveLastError(__METHOD__,$soapFault); + } + } /** * Method to call the operation originally named GetCreatorFoldersWithExternalContextList * @uses SessionManagementWsdlClass::getSoapClient() @@ -383,7 +402,7 @@ public function GetPersonalFolderForUser(SessionManagementStructGetPersonalFolde /** * Returns the result * @see SessionManagementWsdlClass::getResult() - * @return SessionManagementStructGetAllFoldersByExternalIdResponse|SessionManagementStructGetAllFoldersWithExternalContextByExternalIdResponse|SessionManagementStructGetCreatorFoldersListResponse|SessionManagementStructGetCreatorFoldersWithExternalContextListResponse|SessionManagementStructGetFoldersAvailabilitySettingsResponse|SessionManagementStructGetFoldersByExternalIdResponse|SessionManagementStructGetFoldersByIdResponse|SessionManagementStructGetFoldersListResponse|SessionManagementStructGetFoldersWithExternalContextByExternalIdResponse|SessionManagementStructGetFoldersWithExternalContextByIdResponse|SessionManagementStructGetFoldersWithExternalContextListResponse|SessionManagementStructGetNoteResponse|SessionManagementStructGetPersonalFolderForUserResponse|SessionManagementStructGetRecorderDownloadUrlsResponse|SessionManagementStructGetSessionsAvailabilitySettingsResponse|SessionManagementStructGetSessionsByExternalIdResponse|SessionManagementStructGetSessionsByIdResponse|SessionManagementStructGetSessionsListResponse + * @return SessionManagementStructGetAllFoldersByExternalIdResponse|SessionManagementStructGetAllFoldersWithExternalContextByExternalIdResponse|SessionManagementStructGetCreatorFoldersListResponse|SessionManagementStructGetCreatorFoldersWithExternalContextListResponse|SessionManagementStructGetFoldersAvailabilitySettingsResponse|SessionManagementStructGetFoldersByExternalIdResponse|SessionManagementStructGetFoldersByIdResponse|SessionManagementStructGetFoldersListResponse|SessionManagementStructGetFoldersWithExternalContextByExternalIdResponse|SessionManagementStructGetFoldersWithExternalContextByIdResponse|SessionManagementStructGetFoldersWithExternalContextListResponse|SessionManagementStructGetNoteResponse|SessionManagementStructGetPersonalFolderForUserResponse|SessionManagementStructGetRecorderDownloadUrlsResponse|SessionManagementStructGetSessionsAvailabilitySettingsResponse|SessionManagementStructGetSessionsByExternalIdResponse|SessionManagementStructGetSessionsByIdResponse|SessionManagementStructGetSessionsListResponse|SessionManagementStructGetExtendedCreatorFoldersListResponse */ public function getResult() { diff --git a/lib/SessionManagement/List/Response/SessionManagementStructListExtendedFoldersResponse.php b/lib/SessionManagement/List/Response/SessionManagementStructListExtendedFoldersResponse.php new file mode 100644 index 0000000..228ae7a --- /dev/null +++ b/lib/SessionManagement/List/Response/SessionManagementStructListExtendedFoldersResponse.php @@ -0,0 +1,123 @@ +. + +/** + * + * @package block_panopto + * @copyright Panopto 2020 + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + /** + * File for class SessionManagementStructListExtendedFoldersResponse + * @package SessionManagement + * @subpackage Structs + * @author Panopto + * @version 20150429-01 + * @date 2017-01-19 + */ +/** + * This class stands for SessionManagementStructListExtendedFoldersResponse originally named ListExtendedFoldersResponse + * Meta informations extracted from the WSDL + * - from schema : {@link http://demo.hosted.panopto.com/Panopto/PublicAPI/4.6/SessionManagement.svc?xsd=xsd3} + * @package SessionManagement + * @subpackage Structs + * @author Panopto + * @version 20150429-01 + * @date 2017-01-19 + */ +class SessionManagementStructListExtendedFoldersResponse extends SessionManagementWsdlClass +{ + /** + * The Results + * Meta informations extracted from the WSDL + * - minOccurs : 0 + * - nillable : true + * @var SessionManagementStructArrayOfExtendedFolder + */ + public $Results; + /** + * The TotalNumberResults + * Meta informations extracted from the WSDL + * - minOccurs : 0 + * @var int + */ + public $TotalNumberResults; + /** + * Constructor method for ListFoldersResponse + * @see parent::__construct() + * @param SessionManagementStructArrayOfExtendedFolder $_results + * @param int $_totalNumberResults + * @return SessionManagementStructListExtendedFoldersResponse + */ + public function __construct($_results = NULL,$_totalNumberResults = NULL) + { + parent::__construct(array('Results'=>($_results instanceof SessionManagementStructArrayOfExtendedFolder)?$_results:new SessionManagementStructArrayOfExtendedFolder($_results),'TotalNumberResults'=>$_totalNumberResults),false); + } + /** + * Get Results value + * @return SessionManagementStructArrayOfExtendedFolder|null + */ + public function getResults() + { + return $this->Results; + } + /** + * Set Results value + * @param SessionManagementStructArrayOfExtendedFolder $_results the Results + * @return SessionManagementStructArrayOfExtendedFolder + */ + public function setResults($_results) + { + return ($this->Results = $_results); + } + /** + * Get TotalNumberResults value + * @return int|null + */ + public function getTotalNumberResults() + { + return $this->TotalNumberResults; + } + /** + * Set TotalNumberResults value + * @param int $_totalNumberResults the TotalNumberResults + * @return int + */ + public function setTotalNumberResults($_totalNumberResults) + { + return ($this->TotalNumberResults = $_totalNumberResults); + } + /** + * Method called when an object has been exported with var_export() functions + * It allows to return an object instantiated with the values + * @see SessionManagementWsdlClass::__set_state() + * @uses SessionManagementWsdlClass::__set_state() + * @param array $_array the exported values + * @return SessionManagementStructListExtendedFoldersResponse + */ + public static function __set_state(array $_array) + { + return parent::__set_state($_array); + } + /** + * Method returning the class name + * @return string __CLASS__ + */ + public function __toString() + { + return __CLASS__; + } +} diff --git a/lib/SessionManagement/SessionManagementAutoload.php b/lib/SessionManagement/SessionManagementAutoload.php index b0a1468..8ac8203 100644 --- a/lib/SessionManagement/SessionManagementAutoload.php +++ b/lib/SessionManagement/SessionManagementAutoload.php @@ -114,9 +114,12 @@ require_once dirname(__FILE__) . '/Update/Response/SessionManagementStructUpdateSessionOwnerResponse.php'; require_once dirname(__FILE__) . '/Update/Owner/SessionManagementStructUpdateSessionOwner.php'; require_once dirname(__FILE__) . '/Array/Folder/SessionManagementStructArrayOfFolder.php'; +require_once dirname(__FILE__) . '/Array/Folder/SessionManagementStructArrayOfExtendedFolder.php'; require_once dirname(__FILE__) . '/List/Response/SessionManagementStructListSessionsResponse.php'; require_once dirname(__FILE__) . '/List/Response/SessionManagementStructListFoldersResponse.php'; +require_once dirname(__FILE__) . '/List/Response/SessionManagementStructListExtendedFoldersResponse.php'; require_once dirname(__FILE__) . '/Folder/SessionManagementStructFolder.php'; +require_once dirname(__FILE__) . '/Folder/SessionManagementStructExtendedFolder.php'; require_once dirname(__FILE__) . '/Date/Offset/SessionManagementStructDateTimeOffset.php'; require_once dirname(__FILE__) . '/Array/Session/SessionManagementStructArrayOfSession.php'; require_once dirname(__FILE__) . '/Array/Context/SessionManagementStructArrayOfFolderWithExternalContext.php'; @@ -152,12 +155,14 @@ require_once dirname(__FILE__) . '/Get/List/SessionManagementStructGetFoldersWithExternalContextList.php'; require_once dirname(__FILE__) . '/Get/Response/SessionManagementStructGetFoldersWithExternalContextListResponse.php'; require_once dirname(__FILE__) . '/Get/List/SessionManagementStructGetCreatorFoldersList.php'; +require_once dirname(__FILE__) . '/Get/List/SessionManagementStructGetExtendedCreatorFoldersList.php'; require_once dirname(__FILE__) . '/Get/Response/SessionManagementStructGetFoldersListResponse.php'; require_once dirname(__FILE__) . '/Get/List/SessionManagementStructGetFoldersList.php'; require_once dirname(__FILE__) . '/Get/Response/SessionManagementStructGetSessionsByExternalIdResponse.php'; require_once dirname(__FILE__) . '/Get/List/SessionManagementStructGetSessionsList.php'; require_once dirname(__FILE__) . '/Get/Response/SessionManagementStructGetSessionsListResponse.php'; require_once dirname(__FILE__) . '/Get/Response/SessionManagementStructGetCreatorFoldersListResponse.php'; +require_once dirname(__FILE__) . '/Get/Response/SessionManagementStructGetExtendedCreatorFoldersListResponse.php'; require_once dirname(__FILE__) . '/Get/List/SessionManagementStructGetCreatorFoldersWithExternalContextList.php'; require_once dirname(__FILE__) . '/Update/Response/SessionManagementStructUpdateSessionDescriptionResponse.php'; require_once dirname(__FILE__) . '/Update/Broadcast/SessionManagementStructUpdateSessionIsBroadcast.php'; diff --git a/lib/SessionManagement/SessionManagementClassMap.php b/lib/SessionManagement/SessionManagementClassMap.php index fdf8e9d..82375bf 100644 --- a/lib/SessionManagement/SessionManagementClassMap.php +++ b/lib/SessionManagement/SessionManagementClassMap.php @@ -46,6 +46,7 @@ final public static function classMap() 'AreUsersNotesPublicResponse' => 'SessionManagementStructAreUsersNotesPublicResponse', 'ArrayOfAccessRole' => 'SessionManagementStructArrayOfAccessRole', 'ArrayOfFolder' => 'SessionManagementStructArrayOfFolder', + 'ArrayOfExtendedFolder' => 'SessionManagementStructArrayOfExtendedFolder', 'ArrayOfFolderAvailabilitySettings' => 'SessionManagementStructArrayOfFolderAvailabilitySettings', 'ArrayOfFolderWithExternalContext' => 'SessionManagementStructArrayOfFolderWithExternalContext', 'ArrayOfNote' => 'SessionManagementStructArrayOfNote', @@ -73,6 +74,7 @@ final public static function classMap() 'EditNote' => 'SessionManagementStructEditNote', 'EditNoteResponse' => 'SessionManagementStructEditNoteResponse', 'Folder' => 'SessionManagementStructFolder', + 'ExtendedFolder' => 'SessionManagementStructExtendedFolder', 'FolderAvailabilitySettings' => 'SessionManagementStructFolderAvailabilitySettings', 'FolderBase' => 'SessionManagementStructFolderBase', 'FolderEndSettingType' => 'SessionManagementEnumFolderEndSettingType', @@ -85,7 +87,9 @@ final public static function classMap() 'GetAllFoldersWithExternalContextByExternalId' => 'SessionManagementStructGetAllFoldersWithExternalContextByExternalId', 'GetAllFoldersWithExternalContextByExternalIdResponse' => 'SessionManagementStructGetAllFoldersWithExternalContextByExternalIdResponse', 'GetCreatorFoldersList' => 'SessionManagementStructGetCreatorFoldersList', + 'GetExtendedCreatorFoldersList' => 'SessionManagementStructGetExtendedCreatorFoldersList', 'GetCreatorFoldersListResponse' => 'SessionManagementStructGetCreatorFoldersListResponse', + 'GetExtendedCreatorFoldersListResponse' => 'SessionManagementStructGetExtendedCreatorFoldersListResponse', 'GetCreatorFoldersWithExternalContextList' => 'SessionManagementStructGetCreatorFoldersWithExternalContextList', 'GetCreatorFoldersWithExternalContextListResponse' => 'SessionManagementStructGetCreatorFoldersWithExternalContextListResponse', 'GetFoldersAvailabilitySettings' => 'SessionManagementStructGetFoldersAvailabilitySettings', @@ -120,6 +124,7 @@ final public static function classMap() 'IsDropboxResponse' => 'SessionManagementStructIsDropboxResponse', 'ListFoldersRequest' => 'SessionManagementStructListFoldersRequest', 'ListFoldersResponse' => 'SessionManagementStructListFoldersResponse', + 'ListExtendedFoldersResponse' => 'SessionManagementStructListExtendedFoldersResponse', 'ListFoldersResponseWithExternalContext' => 'SessionManagementStructListFoldersResponseWithExternalContext', 'ListNotes' => 'SessionManagementStructListNotes', 'ListNotesResponse' => 'SessionManagementStructListNotesResponse', diff --git a/lib/SessionManagement/SessionManagementWsdlClass.php b/lib/SessionManagement/SessionManagementWsdlClass.php index e586d8e..9c6f0a9 100644 --- a/lib/SessionManagement/SessionManagementWsdlClass.php +++ b/lib/SessionManagement/SessionManagementWsdlClass.php @@ -630,7 +630,7 @@ public function length() * @uses SessionManagementWsdlClass::getInternArrayToIterateIsArray() * @return int */ - public function count() + public function count(): int { return $this->getInternArrayToIterateIsArray()?count($this->getInternArrayToIterate()):-1; } @@ -639,7 +639,7 @@ public function count() * @uses SessionManagementWsdlClass::offsetGet() * @return mixed */ - public function current() + public function current(): mixed { return $this->offsetGet($this->internArrayToIterateOffset); } @@ -647,20 +647,20 @@ public function current() * Method moving the current position to the next element * @uses SessionManagementWsdlClass::getInternArrayToIterateOffset() * @uses SessionManagementWsdlClass::setInternArrayToIterateOffset() - * @return int + * @return void */ - public function next() + public function next(): void { - return $this->setInternArrayToIterateOffset($this->getInternArrayToIterateOffset() + 1); + $this->setInternArrayToIterateOffset($this->getInternArrayToIterateOffset() + 1); } /** * Method resetting itemOffset * @uses SessionManagementWsdlClass::setInternArrayToIterateOffset() - * @return int + * @return void */ - public function rewind() + public function rewind(): void { - return $this->setInternArrayToIterateOffset(0); + $this->setInternArrayToIterateOffset(0); } /** * Method checking if current itemOffset points to an existing item @@ -668,7 +668,7 @@ public function rewind() * @uses SessionManagementWsdlClass::offsetExists() * @return bool true|false */ - public function valid() + public function valid(): bool { return $this->offsetExists($this->getInternArrayToIterateOffset()); } @@ -677,7 +677,7 @@ public function valid() * @uses SessionManagementWsdlClass::getInternArrayToIterateOffset() * @return int */ - public function key() + public function key(): mixed { return $this->getInternArrayToIterateOffset(); } @@ -766,7 +766,7 @@ public function last() * @param int $_offset * @return bool true|false */ - public function offsetExists($_offset) + public function offsetExists($_offset): bool { return ($this->getInternArrayToIterateIsArray() && array_key_exists($_offset,$this->getInternArrayToIterate())); } @@ -776,7 +776,7 @@ public function offsetExists($_offset) * @param int $_offset * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return $this->offsetExists($_offset)?$this->internArrayToIterate[$_offset]:null; } @@ -784,21 +784,17 @@ public function offsetGet($_offset) * Method useless but necessarly overridden, can't set * @param mixed $_offset * @param mixed $_value - * @return null + * @return void */ - public function offsetSet($_offset,$_value) - { - return null; - } + public function offsetSet($_offset,$_value): void + {} /** * Method useless but necessarly overridden, can't unset * @param mixed $_offset - * @return null + * @return void */ - public function offsetUnset($_offset) - { - return null; - } + public function offsetUnset($_offset): void + {} /** * Method returning current result from Soap call * @return mixed @@ -1007,7 +1003,7 @@ public function __construct ($wsdl, array $options = null) { * @param string $version * @param int $one_way */ - public function __doRequest($request, $location, $action, $version, $one_way = 0) { + public function __doRequest($request, $location, $action, $version, $one_way = 0): ?string { if (get_config('block_panopto', 'enforce_https_on_wsdl')) { $location = str_replace('http://', 'https://', $location); } diff --git a/lib/UserManagement/Array/Group/UserManagementStructArrayOfGroup.php b/lib/UserManagement/Array/Group/UserManagementStructArrayOfGroup.php index 4cf144e..8143ba6 100644 --- a/lib/UserManagement/Array/Group/UserManagementStructArrayOfGroup.php +++ b/lib/UserManagement/Array/Group/UserManagementStructArrayOfGroup.php @@ -79,9 +79,9 @@ public function setGroup($_group) /** * Returns the current element * @see UserManagementWsdlClass::current() - * @return UserManagementStructGroup + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see UserManagementWsdlClass::last() * @param int $_offset - * @return UserManagementStructGroup + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/UserManagement/Array/Ofguid/UserManagementStructArrayOfguid.php b/lib/UserManagement/Array/Ofguid/UserManagementStructArrayOfguid.php index a3db0ff..5c6d180 100644 --- a/lib/UserManagement/Array/Ofguid/UserManagementStructArrayOfguid.php +++ b/lib/UserManagement/Array/Ofguid/UserManagementStructArrayOfguid.php @@ -79,9 +79,9 @@ public function setGuid($_guid) /** * Returns the current element * @see UserManagementWsdlClass::current() - * @return guid + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see UserManagementWsdlClass::last() * @param int $_offset - * @return guid + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/UserManagement/Array/Ofstring/UserManagementStructArrayOfstring.php b/lib/UserManagement/Array/Ofstring/UserManagementStructArrayOfstring.php index 07d621c..a52f0b4 100644 --- a/lib/UserManagement/Array/Ofstring/UserManagementStructArrayOfstring.php +++ b/lib/UserManagement/Array/Ofstring/UserManagementStructArrayOfstring.php @@ -79,9 +79,9 @@ public function setString($_string) /** * Returns the current element * @see UserManagementWsdlClass::current() - * @return string + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see UserManagementWsdlClass::last() * @param int $_offset - * @return string + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/UserManagement/Array/User/UserManagementStructArrayOfUser.php b/lib/UserManagement/Array/User/UserManagementStructArrayOfUser.php index 6a1e345..270ee26 100644 --- a/lib/UserManagement/Array/User/UserManagementStructArrayOfUser.php +++ b/lib/UserManagement/Array/User/UserManagementStructArrayOfUser.php @@ -79,9 +79,9 @@ public function setUser($_user) /** * Returns the current element * @see UserManagementWsdlClass::current() - * @return UserManagementStructUser + * @return mixed */ - public function current() + public function current(): mixed { return parent::current(); } @@ -117,9 +117,9 @@ public function last() * Returns the element at the offset * @see UserManagementWsdlClass::last() * @param int $_offset - * @return UserManagementStructUser + * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return parent::offsetGet($_offset); } diff --git a/lib/UserManagement/UserManagementWsdlClass.php b/lib/UserManagement/UserManagementWsdlClass.php index d48d080..d8d18a6 100644 --- a/lib/UserManagement/UserManagementWsdlClass.php +++ b/lib/UserManagement/UserManagementWsdlClass.php @@ -625,7 +625,7 @@ public function length() * @uses UserManagementWsdlClass::getInternArrayToIterateIsArray() * @return int */ - public function count() + public function count(): int { return $this->getInternArrayToIterateIsArray()?count($this->getInternArrayToIterate()):-1; } @@ -634,7 +634,7 @@ public function count() * @uses UserManagementWsdlClass::offsetGet() * @return mixed */ - public function current() + public function current(): mixed { return $this->offsetGet($this->internArrayToIterateOffset); } @@ -642,20 +642,20 @@ public function current() * Method moving the current position to the next element * @uses UserManagementWsdlClass::getInternArrayToIterateOffset() * @uses UserManagementWsdlClass::setInternArrayToIterateOffset() - * @return int + * @return void */ - public function next() + public function next(): void { - return $this->setInternArrayToIterateOffset($this->getInternArrayToIterateOffset() + 1); + $this->setInternArrayToIterateOffset($this->getInternArrayToIterateOffset() + 1); } /** * Method resetting itemOffset * @uses UserManagementWsdlClass::setInternArrayToIterateOffset() - * @return int + * @return void */ - public function rewind() + public function rewind(): void { - return $this->setInternArrayToIterateOffset(0); + $this->setInternArrayToIterateOffset(0); } /** * Method checking if current itemOffset points to an existing item @@ -663,7 +663,7 @@ public function rewind() * @uses UserManagementWsdlClass::offsetExists() * @return bool true|false */ - public function valid() + public function valid(): bool { return $this->offsetExists($this->getInternArrayToIterateOffset()); } @@ -672,7 +672,7 @@ public function valid() * @uses UserManagementWsdlClass::getInternArrayToIterateOffset() * @return int */ - public function key() + public function key(): int { return $this->getInternArrayToIterateOffset(); } @@ -761,7 +761,7 @@ public function last() * @param int $_offset * @return bool true|false */ - public function offsetExists($_offset) + public function offsetExists($_offset): bool { return ($this->getInternArrayToIterateIsArray() && array_key_exists($_offset,$this->getInternArrayToIterate())); } @@ -771,7 +771,7 @@ public function offsetExists($_offset) * @param int $_offset * @return mixed */ - public function offsetGet($_offset) + public function offsetGet($_offset): mixed { return $this->offsetExists($_offset)?$this->internArrayToIterate[$_offset]:null; } @@ -779,21 +779,17 @@ public function offsetGet($_offset) * Method useless but necessarly overridden, can't set * @param mixed $_offset * @param mixed $_value - * @return null + * @return void */ - public function offsetSet($_offset,$_value) - { - return null; - } + public function offsetSet($_offset,$_value): void + {} /** * Method useless but necessarly overridden, can't unset * @param mixed $_offset - * @return null + * @return void */ - public function offsetUnset($_offset) - { - return null; - } + public function offsetUnset($_offset): void + {} /** * Method returning current result from Soap call * @return mixed @@ -1002,7 +998,7 @@ public function __construct ($wsdl, array $options = null) { * @param string $version * @param int $one_way */ - public function __doRequest($request, $location, $action, $version, $one_way = 0) { + public function __doRequest($request, $location, $action, $version, $one_way = 0): ?string { if (get_config('block_panopto', 'enforce_https_on_wsdl')) { $location = str_replace('http://', 'https://', $location); } diff --git a/lib/lti/auth.php b/lib/lti/auth.php index 077d12a..2f58429 100644 --- a/lib/lti/auth.php +++ b/lib/lti/auth.php @@ -31,6 +31,7 @@ require_once($CFG->dirroot . '/mod/lti/locallib.php'); require_once($CFG->libdir . '/weblib.php'); require_once(dirname(__FILE__) . '/panoptoblock_lti_utility.php'); +require_once(dirname(__FILE__) . '../../panopto_data.php'); global $_POST, $_SERVER; @@ -57,9 +58,10 @@ $nonce = optional_param('nonce', '', PARAM_TEXT); $prompt = optional_param('prompt', '', PARAM_TEXT); -// Specific logic for Moodle 4.1 needed, in order to handle auth. -$isthismoodle41 = empty($CFG->version) ? false : $CFG->version >= 2022112800.00; -$ltimessagehint = $isthismoodle41 ? json_decode($ltimessagehintenc) : $ltimessagehintenc; +// Specific logic for Moodle 4.1 and 4.2 needed, in order to handle auth. +$ismoodle41minimum = empty($CFG->version) ? false : $CFG->version >= 2022112800.00; +$ltimessagehint = $ismoodle41minimum ? json_decode($ltimessagehintenc) : $ltimessagehintenc; +$cmid = !empty($ltimessagehint->cmid) ? $ltimessagehint->cmid : ''; list( $pluginname, @@ -68,10 +70,11 @@ $resourcelinkid, $contenturl, $customdata -) = explode( +) = array_pad(explode( ',', - $isthismoodle41 ? $ltimessagehint->cmid : $ltimessagehint, - 6 + $ismoodle41minimum ? $cmid : $ltimessagehint), + 6, + null ); $ispanoptoplugin = false; @@ -90,6 +93,10 @@ $ispanoptoplugin = true; $pluginpath = '/mod/panoptocourseembed/contentitem_return.php'; break; + case 'tiny_panoptoltibutton': + $ispanoptoplugin = true; + $pluginpath = '/lib/editor/tiny/plugins/panoptoltibutton/contentitem_return.php'; + break; default: $ispanoptoplugin = false; break; @@ -112,13 +119,13 @@ $ok = !empty($scope) && !empty($responsetype) && !empty($clientid) && !empty($redirecturi) && !empty($loginhint) && - !empty($nonce) && ($isthismoodle41 ? true : !empty($SESSION->lti_message_hint)); + !empty($nonce) && ($ismoodle41minimum ? true : !empty($SESSION->lti_message_hint)); if (!$ok) { $error = 'invalid_request'; } // This is only Moodle 4.1 check. -if ($isthismoodle41) { +if ($ismoodle41minimum) { $ok = $ok && isset($ltimessagehint->launchid); if (!$ok) { $error = 'invalid_request'; @@ -134,7 +141,7 @@ $error = 'unsupported_response_type'; } if ($ok) { - if ($isthismoodle41) { + if ($ismoodle41minimum) { $launchid = $ltimessagehint->launchid; list($courseid, $typeid, $id, $messagetype, $foruserid, $titleb64, $textb64) = explode(',', $SESSION->$launchid, 7); unset($SESSION->$launchid); @@ -166,6 +173,20 @@ $PAGE->set_course($course); } +// Specific logic for Moodle 4.2 +$ismoodle42minimum = empty($CFG->version) ? false : $CFG->version >= 2023042400.00; +if ($ismoodle42minimum) { + $panoptodata = new \panopto_data($course->id); + $coursemodules = $panoptodata->get_cm_for_course($course->id); + + $cmid = 0; + if (!empty($coursemodules)) { + $cmid = reset($coursemodules)->id; + } + + $_GET['id'] = $cmid; +} + // If we're unable to load up config; we cannot trust the redirect uri for POSTing to. if (empty($config)) { throw new moodle_exception('invalidrequest', 'error'); @@ -213,6 +234,9 @@ } } + // If we get to this point we know this is a plug-in based request and will not support grading + $lti->custom->grading_not_supported = true; + list($endpoint, $params) = panoptoblock_lti_utility::get_launch_data($lti, $nonce); } else { diff --git a/lib/lti/panoptoblock_lti_utility.php b/lib/lti/panoptoblock_lti_utility.php index d7a4748..166992d 100644 --- a/lib/lti/panoptoblock_lti_utility.php +++ b/lib/lti/panoptoblock_lti_utility.php @@ -35,8 +35,10 @@ public static function get_course_tool_id($courseid, $requiredcustomparam = '') global $DB, $CFG; require_once($CFG->dirroot . '/mod/lti/locallib.php'); - $ltitooltypes = $DB->get_records('lti_types', null, 'name'); $targetservername = self::get_target_server_name($courseid); + $ltitooltypes = !empty($targetservername) + ? $DB->get_records('lti_types', ['tooldomain' => $targetservername], 'name') + : $DB->get_records('lti_types', null, 'name'); $idmatches = []; foreach ($ltitooltypes as $type) { @@ -84,8 +86,10 @@ public static function get_course_tool_url($courseid, $requiredcustomparam) { global $DB, $CFG; require_once($CFG->dirroot . '/mod/lti/locallib.php'); - $ltitooltypes = $DB->get_records('lti_types', null, 'name'); $targetservername = self::get_target_server_name($courseid); + $ltitooltypes = !empty($targetservername) + ? $DB->get_records('lti_types', ['tooldomain' => $targetservername], 'name') + : $DB->get_records('lti_types', null, 'name'); $urlmatches = []; foreach ($ltitooltypes as $type) { @@ -417,8 +421,6 @@ public static function get_course_tool($courseid) { global $DB, $CFG; require_once($CFG->dirroot . '/mod/lti/locallib.php'); - $ltitooltypes = $DB->get_records('lti_types', null, 'name'); - $targetservername = null; $blockexists = $DB->get_record('block', array('name' => 'panopto'), 'name'); @@ -431,6 +433,10 @@ public static function get_course_tool($courseid) { $targetservername = get_config('block_panopto', 'automatic_operation_target_server'); } + $ltitooltypes = !empty($targetservername) + ? $DB->get_records('lti_types', ['tooldomain' => $targetservername], 'name') + : $DB->get_records('lti_types', null, 'name'); + $idmatches = []; foreach ($ltitooltypes as $type) { $type->config = lti_get_config( @@ -595,17 +601,20 @@ public static function build_content_item_selection_request($id, $course, moodle $customstr = $typeconfig['customparameters']; } - switch($pluginname) { + switch ($pluginname) { // We need to add the custom parameter that initiates the student submission behavior here. case 'mod_panoptosubmission': $submissioncustomparam = "panopto_assignment_submission_content_item=true\npanopto_student_submission_tool=true"; - if (empty($customstr)) { - $customstr = $submissioncustomparam; - } else { - $customstr .= "\n" . $submissioncustomparam; - } + $customstr = empty($customstr) ? $submissioncustomparam : $customstr . "\n" . $submissioncustomparam; + $customstr .= "\ngrading_not_supported=true"; + break; + case 'mod_panoptocourseembed': + case 'atto_panoptoltibutton': + case 'tiny_panoptoltibutton': + $customstr .= "\ngrading_not_supported=true"; break; default: + $customstr = ''; break; } diff --git a/lib/panopto_category_data.php b/lib/panopto_category_data.php index b7c2957..cb69b62 100644 --- a/lib/panopto_category_data.php +++ b/lib/panopto_category_data.php @@ -325,7 +325,7 @@ private function save_category_data_to_table($categorybranchdata, $usehtmloutput $ensuredbranch .= $updatedcategory->Name; // If the returned folder was the leaf course folder no need to save it. - if (strcmp($leafcoursesessiongroupid, $updatedcategory->Id) !== 0) { + if (strcmp($leafcoursesessiongroupid ?? '', $updatedcategory->Id) !== 0) { // The $updatedcategory->ExternalIds->string[0] is the format the PHP wsdl mapper returns our call data. // We also need to strip // off the externalId to get the true category Id. $row->category_id = str_replace($this->instancename . '\\', '', $updatedcategory->ExternalIds->string[0]); diff --git a/lib/panopto_data.php b/lib/panopto_data.php index 42392e5..5c20c7b 100644 --- a/lib/panopto_data.php +++ b/lib/panopto_data.php @@ -124,6 +124,12 @@ class panopto_data { */ public static $ccv2requiredpanoptoversion = '12.0.0'; + /** + * @var string $apiassignmentfolderspanoptoversion if the Panopto server is using this version then we can filter + * assignment folders. + */ + public static $apiassignmentfolderspanoptoversion = '13.14.0.00000'; + /** * Returns an array of possible values for the Panopto folder name style * @@ -906,7 +912,19 @@ public function get_creator_folders_list() { $this->ensure_session_manager(); - $ret = $this->sessionmanager->get_creator_folders_list(); + // We are checking if we can get extended folder or not here based on Panopto version. + // Extended folder will have information if folder is assignment or not. + $this->ensure_auth_manager(); + $activepanoptoserverversion = $this->authmanager->get_server_version(); + $canwegetextendedfolder = version_compare( + $activepanoptoserverversion, + self::$apiassignmentfolderspanoptoversion, + '>=' + ); + + $ret = $canwegetextendedfolder + ? $this->sessionmanager->get_extended_creator_folders_list() + : $this->sessionmanager->get_creator_folders_list(); return $ret; } @@ -974,7 +992,8 @@ public function sync_external_user($userid) { $userinfo->firstname, $userinfo->lastname, $userinfo->email, - $groupstosync + $groupstosync, + $userinfo->username ); } else { self::print_log(get_string('panopto_server_error', 'block_panopto', $this->servername)); @@ -1499,12 +1518,29 @@ public function get_course_options() { if (!empty($panoptofolders)) { + // We are checking if we can get extended folder or not here based on Panopto version. + // Extended folder will have information if folder is assignment or not. + $this->ensure_auth_manager(); + $canwegetextendedfolder = version_compare( + $this->authmanager->get_server_version(), + self::$apiassignmentfolderspanoptoversion, + '>=' + ); + foreach ($panoptofolders as $folderinfo) { - // Only add a folder to the course options if it is not already mapped to a course on moodle. - // Unless its the current course. - if (!$DB->get_records('block_panopto_foldermap', array('panopto_id' => $folderinfo->Id)) - || ($this->sessiongroupid === $folderinfo->Id)) { + // Filter folders based on the following criteria. + // 1/ Only add a folder to the course options if it is not already mapped to a course on moodle. + // 2/ Unless its the current course. + // 3/ If it is not assignment folder, but only after Panopto version 13.14.0.00000. + + $isassignmentfolder = $canwegetextendedfolder + ? $folderinfo->IsAssignmentFolder + : false; + + if ((!$DB->get_records('block_panopto_foldermap', array('panopto_id' => $folderinfo->Id)) + || ($this->sessiongroupid === $folderinfo->Id)) + && !$isassignmentfolder) { if ($this->sessiongroupid === $folderinfo->Id) { $containsmappedfolder = true; @@ -1695,6 +1731,92 @@ public static function is_server_alive($url = null) { return get_config('block_panopto', 'check_server_result'); } + /** + * Check to determine if folder is inheriting permissions + * + * @param string $folderid folder id + * @return bool + */ + public function is_folder_inheriting_permissions($folderid) { + $this->ensure_auth_manager(); + + // This call will log the user into Panopto using the SOAP API and it will also store the Panopto cookies. + $this->authmanager->log_on_with_external_provider(); + + // Only do this code if we have proper access to the target Panopto course folder. + $location = 'https://'. $this->servername . '/Panopto/api/v1/folders/'. $folderid . '/settings/access'; + + $curl = new \curl(); + $aspxauthcookie = ""; + foreach ($this->authmanager->panoptoauthcookies as $key => $value) { + if (strpos(strtolower($key), 'aspxauth') !== false) { + $aspxauthcookie = $value; + break; + } + } + + if (empty($aspxauthcookie)) { + self::print_log(get_string('copy_api_error_auth', 'block_panopto', $this->servername)); + return false; + } + + $options = [ + 'CURLOPT_VERBOSE' => false, + 'CURLOPT_RETURNTRANSFER' => true, + 'CURLOPT_HEADER' => false, + 'CURLOPT_HTTPHEADER' => array('Content-Type: application/json', + 'Cookie: .ASPXAUTH='.$aspxauthcookie) + ]; + + $sockettimeout = get_config('block_panopto', 'panopto_socket_timeout'); + $connectiontimeout = get_config('block_panopto', 'panopto_connection_timeout'); + + if (!!$sockettimeout) { + $options['CURLOPT_TIMEOUT'] = $sockettimeout; + } + + if (!!$connectiontimeout) { + $options['CURLOPT_CONNECTTIMEOUT'] = $connectiontimeout; + } + + $proxyhost = get_config('block_panopto', 'wsdl_proxy_host'); + $proxyport = get_config('block_panopto', 'wsdl_proxy_port'); + + if (!empty($proxyhost)) { + $options['CURLOPT_PROXY'] = $proxyhost; + } + + if (!empty($proxyport)) { + $options['CURLOPT_PROXYPORT'] = $proxyport; + } + + $response = json_decode($curl->get($location, null, $options)); + + if (!empty($response) && isset($response->IsInherited)) { + return $response->IsInherited; + } else { + self::print_log(get_string('copy_api_error_response', 'block_panopto', $response)); + return false; + } + } + + /** + * Get cm for course + * + * @param string $courseid course id + */ + public function get_cm_for_course($courseid) { + global $DB; + + $sql = "SELECT cm.id " . + "FROM {course_modules} cm " . + "JOIN {modules} md ON (md.id = cm.module) " . + "JOIN {lti} m ON (m.id = cm.instance) " . + "WHERE md.name = :name AND cm.course = :course"; + return $DB->get_records_sql($sql, + array('name' => 'lti', 'course' => $courseid)); + } + /** * Print log * diff --git a/lib/panopto_session_soap_client.php b/lib/panopto_session_soap_client.php index 1c6997e..5774e30 100644 --- a/lib/panopto_session_soap_client.php +++ b/lib/panopto_session_soap_client.php @@ -426,6 +426,95 @@ public function get_creator_folders_list() { } } + /** + * Attempts to get all extended folders the user has creator access to. + */ + public function get_extended_creator_folders_list() { + + if (!isset($this->sessionmanagementserviceget)) { + $this->sessionmanagementserviceget = new SessionManagementServiceGet($this->serviceparams); + } + + $resultsperpage = 1000; + $currentpage = 0; + $pagination = new SessionManagementStructPagination($resultsperpage, $currentpage); + $parentfolderid = null; + $publiconly = false; + $sortby = SessionManagementEnumFolderSortField::VALUE_NAME; + $sortincreasing = true; + $wildcardsearchnameonly = false; + $unmappedonly = true; + + $folderlistrequest = new SessionManagementStructListFoldersRequest( + $pagination, + $parentfolderid, + $publiconly, + $sortby, + $sortincreasing, + $wildcardsearchnameonly, + $unmappedonly + ); + $searchquery = null; + + $folderlistparams = new SessionManagementStructGetExtendedCreatorFoldersList( + $this->authparam, + $folderlistrequest, + $searchquery + ); + + if ($this->sessionmanagementserviceget->GetExtendedCreatorFoldersList($folderlistparams)) { + $retobj = $this->sessionmanagementserviceget->getResult(); + $totalresults = $retobj->GetExtendedCreatorFoldersListResult->TotalNumberResults; + + $folderlist = $retobj->GetExtendedCreatorFoldersListResult->Results->ExtendedFolder; + + if ($totalresults > $resultsperpage) { + + $folderstoget = $totalresults - $resultsperpage; + ++$currentpage; + while ($folderstoget > 0) { + $pagination = new SessionManagementStructPagination($resultsperpage, $currentpage); + + $folderlistrequest = new SessionManagementStructListFoldersRequest( + $pagination, + $parentfolderid, + $publiconly, + $sortby, + $sortincreasing, + $wildcardsearchnameonly + ); + + $folderlistparams = new SessionManagementStructGetExtendedCreatorFoldersList( + $this->authparam, + $folderlistrequest, + $searchquery + ); + + if ($this->sessionmanagementserviceget->GetExtendedCreatorFoldersList($folderlistparams)) { + $retobj = $this->sessionmanagementserviceget->getResult(); + $folderlist = array_merge($folderlist, $retobj->GetExtendedCreatorFoldersListResult->Results->ExtendedFolder); + } else { + return $this->handle_error( + $this->sessionmanagementserviceget->getLastError()['SessionManagementServiceGet::GetCreatorFoldersList'] + ); + } + + ++$currentpage; + $folderstoget -= $resultsperpage; + } + } else if ($totalresults === 0) { + // In this case folderlist will be null but that is handled poorly in the UI. + $folderlist = array(); + } + + return $folderlist; + } else { + return $this->handle_error( + $this->sessionmanagementserviceget->getLastError()['SessionManagementServiceGet::GetCreatorFoldersList'] + ); + } + } + /** * Attempts to get all folders the user has access to. */ diff --git a/lib/panopto_timeout_soap_client.php b/lib/panopto_timeout_soap_client.php index 1d24b11..603f1c8 100644 --- a/lib/panopto_timeout_soap_client.php +++ b/lib/panopto_timeout_soap_client.php @@ -121,7 +121,7 @@ public function getpanoptocookies() { * @param int $version the SOAP version * @param bool $one_way determine if response is expected or not */ - public function __doRequest($request, $location, $action, $version, $one_way = false) { + public function __doRequest($request, $location, $action, $version, $one_way = false): ?string { if (empty($this->socket_timeout) && empty($this->connect_timeout)) { // Call via parent because we require no timeout. $response = parent::__doRequest($request, $location, $action, $version, $one_way); @@ -160,6 +160,9 @@ public function __doRequest($request, $location, $action, $version, $one_way = f $options['CURLOPT_PROXYPORT'] = $this->proxy_port; } + // Depending on Moodle settings Moodle will not include connect headers in the header size. This will break all curl calls from here. + $options['CURLOPT_SUPPRESS_CONNECT_HEADERS'] = 0; + $response = $curl->post($location, $request, $options); // Get cookies. diff --git a/lib/panopto_user_soap_client.php b/lib/panopto_user_soap_client.php index cc896c1..0d706eb 100644 --- a/lib/panopto_user_soap_client.php +++ b/lib/panopto_user_soap_client.php @@ -100,9 +100,14 @@ public function __construct($servername, $apiuseruserkey, $apiuserauthcode) { * @param string $lastname user last name * @param string $email user email address * @param array $externalgroupids array of group ids the user needs to be in - * @param boolean $sendemailnotifications whether user gets emails from Panopto updates + * @param string $username panopto username */ - public function sync_external_user($firstname, $lastname, $email, $externalgroupids, $sendemailnotifications = false) { + public function sync_external_user($firstname, $lastname, $email, $externalgroupids, $username = "") { + + // Get user from panopto, and send notifications status. + $instancename = \get_config('block_panopto', 'instance_name'); + $panoptouser = $this->get_user_by_key($instancename . '\\' . $username); + $sendemailnotifications = $panoptouser->EmailSessionNotifications ?? false; if (!isset($this->usermanagementservicesync)) { $this->usermanagementservicesync = new UserManagementServiceSync($this->serviceparams); diff --git a/version.php b/version.php index db931d9..82c4763 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ // Plugin version should normally be the same as the internal version. // If an admin wants to install with an older version number, however, set that here. -$plugin->version = 2023031400; +$plugin->version = 2023083100; // Requires this Moodle version - 2.7. $plugin->requires = 2014051200;