Failed to execute template. Cause: [Access denied when checking [script] access to [xwiki:Collaboratory.UX.HbpSkin.WebHome] for user [xwiki:XWiki.Admin]]. Click on this message for details.

DriveParentCollab - HBP Wiki

IAM21 instance, do not create collab nor modify a team, your changes will be lost


DriveParentCollab

Version 8.1 by bougault on 2022/01/05 15:51

(function() {
  window.addEventListener("DOMContentLoaded", function() {
    const openCollabButton = document.getElementById("opencollab");
    openCollabButton.addEventListener("click", findCollab);
  });
  function findCollab() {
    const driveURL = document.getElementById("driveURL");
    const driveId = getDriveId(driveURL.value);
    if(driveId) {
      console.log('Perform request with id:', driveId);
      fetch(`/rest/v1/collabs?driveId=${driveId}`)
        .then(res => res.json())
        .then(json => {
           console.log(json);
           const { link } = json;
           window.location.pathname = link;
      })
    }
  }
  function getDriveId(driveURL) {
    const url = new URL(driveURL);
    const re = /\/(library|lib)\/([^/]*)\/.*/;
    const id = re.exec(url.pathname)[2];
      return id;
  }
})();