public static function fromUserArray($arr) { $newArr = new KalturaUserArray(); foreach ($arr as $obj) { $nObj = new KalturaUser(); $nObj->fromObject($obj); $newArr[] = $nObj; } return $newArr; }
public static function fromDbArray(array $arr, KalturaDetachedResponseProfile $responseProfile = null) { $newArr = new KalturaUserArray(); foreach ($arr as $obj) { $nObj = new KalturaUser(); $nObj->fromObject($obj, $responseProfile); $newArr[] = $nObj; } return $newArr; }
function update($userId, KalturaUser $user) { $kparams = array(); $this->client->addParam($kparams, "userId", $userId); $this->client->addParam($kparams, "user", $user->toParams()); $this->client->queueServiceActionCall("user", "update", $kparams); if ($this->client->isMultiRequest()) { return null; } $resultObject = $this->client->doQueue(); $this->client->throwExceptionIfError($resultObject); $this->client->validateObjectType($resultObject, "KalturaUser"); return $resultObject; }
/** * Disallow user to login with an id/password. * Passing either a loginId or a userId is allowed. * * @action disableLogin * * @param string $userId * @param string $loginId * * @return KalturaUser * * @throws KalturaErrors::USER_LOGIN_ALREADY_DISABLED * @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL * @throws KalturaErrors::USER_NOT_FOUND * @throws KalturaErrors::CANNOT_DISABLE_LOGIN_FOR_ADMIN_USER * */ public function disableLoginAction($userId = null, $loginId = null) { if (!$loginId && !userId) { throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL, 'userId'); } $user = null; try { if ($loginId) { $loginData = UserLoginDataPeer::getByEmail($loginId); if (!$loginData) { throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND); } $user = kuserPeer::getByLoginDataAndPartner($loginData->getId(), $this->getPartnerId()); } else { $user = kuserPeer::getKuserByPartnerAndUid($this->getPArtnerId(), $userId); } if (!$user) { throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND); } $user->disableLogin(); } catch (Exception $e) { $code = $e->getCode(); if ($code == kUserException::USER_LOGIN_ALREADY_DISABLED) { throw new KalturaAPIException(KalturaErrors::USER_LOGIN_ALREADY_DISABLED); } if ($code == kUserException::CANNOT_DISABLE_LOGIN_FOR_ADMIN_USER) { throw new KalturaAPIException(KalturaErrors::CANNOT_DISABLE_LOGIN_FOR_ADMIN_USER); } throw $e; } $apiUser = new KalturaUser(); $apiUser->fromObject($user); return $apiUser; }
function update($id, KalturaUser $user) { $kparams = array(); $this->client->addParam($kparams, "id", $id); $this->client->addParam($kparams, "user", $user->toParams()); $resultObject = $this->client->callService("user", "update", $kparams); $this->client->throwExceptionIfError($resultObject); $this->client->validateObjectType($resultObject, "KalturaUser"); return $resultObject; }