Created
October 31, 2017 15:05
-
-
Save zoharbabin/2aa98d95c8e807c9ff80720a9a7b91b6 to your computer and use it in GitHub Desktop.
Create Kaltura Sub-Accounts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (count($argv)<6){ | |
echo __FILE__ . ' <partner email> <partner passwd> <partner name> <service_url> <parent partner ID> '."\n"; | |
exit (1); | |
} | |
require_once('/opt/kaltura/web/content/clientlibs/php5/KalturaClient.php'); | |
$templatePartnerId = null; //enter the id of the account to copy content/settings from as template | |
$config = new KalturaConfiguration(); | |
$config->serviceUrl = $argv[4]; | |
$client = new KalturaClient($config); | |
$email=$argv[1]; | |
$name=$argv[3]; | |
$cmsPassword=$argv[2]; | |
$type = KalturaSessionType::ADMIN; | |
$parentPartnerId=$argv[5]; | |
$ks = $client->user->loginByLoginId($email, $cmsPassword, $parentPartnerId, null, null, null); | |
$client->setKs($ks); | |
$partner = new KalturaPartner(); | |
$partner->website=" "; | |
$partner->adminName=$name; | |
$partner->name=$name; | |
$partner->type = KalturaPartnerType::ADMIN_CONSOLE; | |
$partner->partnerParentId=$parentPartnerId; | |
$partner->description=" "; //cannot be empty or null | |
$partner->adminEmail=$email; | |
try{ | |
$results = $client->partner->register($partner, $cmsPassword, $templatePartnerId); | |
}catch (KalturaException $ex){ | |
$message=$ex->getMessage(); | |
$error_code=$ex->getCode(); | |
echo "Failed with message: $message, error code: $error_code\n"; | |
exit(2); | |
} | |
echo('New Partner ID is: '. $results->id."\n"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment