Welcome to the Panopto Community

Please note: All new registrants to the Panopto Community Forum must be approved by a forum moderator or admin. As such, if you navigate to a feature that is members-only, you may receive an error page if your registration has not yet been approved. We apologize for any inconvenience and are approving new members as quickly as possible.

How to change ownership after uploading using sessionUpload?

edited October 21 in API

Hi.

I have a case where I have managed to:

  1. Make a folder using an admin account using the API.
  2. Set the permissions in that folder to inherit the top folder (personal folder) permission making the ownership of the folder go to the user
  3. Upload videos using the API to the new folder

But when the user is trying to share the video the Admin account will need to "allow" them to share it as they are somehow the owner of the files. Is there a method to use the API to make a process where I change the ownership of the videos?



Edit 21.10.24

Okay, while searching a bit I found this: ISessionManagement.UpdateSessionOwner from the soap API.

I made some code to connect myself to the soap API:

def legacylogin(self):
self.auth
url = f"https://{self.server}/Panopto/api/v1/auth/legacyLogin"
return self.session.get(url=url)

auth = Panopto.legacylogin()

# Extract the .ASPXAUTH cookie
aspxauth_cookie = auth.cookies['.ASPXAUTH']

# Define a custom Requests auth class to include the .ASPXAUTH cookie in the headers
class PanoptoAuth(AuthBase):
def __init__(self, token):
self.token = token

def __call__(self, r):
r.headers['Cookie'] = f'.ASPXAUTH={self.token}'
return r

# Create a requests session and attach the custom auth handler
session = requests.Session()
session.auth = PanoptoAuth(aspxauth_cookie)

# Create a Zeep transport using the custom session
transport = Transport(session=session)

# Initialize the SOAP client with the WSDL and custom transport
client = Client(f"https://{PANOPTO_SERVER_HOST}/Panopto/PublicAPI/4.6/SessionManagement.svc?wsdl", transport=transport)

# video_id // user_id
owner = client.service.UpdateSessionOwner(sessionIds="", newOwnerUserKey="")

This code uses the token I get from using the legacylogin to send stuff to soap. but when running I'm getting problems with finding out the "newOwnerUserKey". I am guessing it is the user_id to the user?

The "sessionIds" is either one of these that I find on the videos:

Am I using this right? or is this only made for Folders? And how do I find out what to send as "newOwnerUserKey" and "sessionIds"?

Tagged:

Answers

  • Kevin BaumKevin Baum Panopto Employee

    Hi Lukas,

    The newOwnerUserKey should be the full user name of the user that is the new owner, including the ID Provider name ([IDProviderInstanceName]\[UserName]). If the user is not an SSO user, then you can just send their UserName as the newOwnerUserKey.

    The sessionIds should be a list of one or more IDs for the session(s) that will be moved to the new owner. You'll want to find the Delivery ID for each session, which you can find by searching for a session using Panopto's API, or on the Manage screen of the Session information, in the screenshot you linked above.

    I hope that this helps. Please let me know if you have any other questions.

    Thanks,

    Kevin

Sign In or Register to comment.