Source of file RecordingPasscode.php

Size: 1,549 Bytes - Last Modified: 2018-11-03T09:50:48-04:00

G:/AdobeConnectClient/src/Commands/RecordingPasscode.php

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
<?php

namespace AdobeConnectClient\Commands;

use AdobeConnectClient\Command;
use AdobeConnectClient\Entities\Permission;
use AdobeConnectClient\Parameter;

/**
 * Set the passcode on a Recording and turned into public.
 *
 * Obs: to set the passcode on a Meeting use the aclFieldUpdate method with the
 * meeting-passcode as the fieldId and the passcode as the value.
 */
class RecordingPasscode extends Command
{
    /**
     * @var int
     */
    protected $scoId;

    /**
     * @var string
     */
    protected $passcode;

    /**
     * @param int $scoId
     * @param string $passcode
     */
    public function __construct($scoId, $passcode)
    {
        $this->scoId = (int) $scoId;
        $this->passcode = (string) $passcode;
    }

    /**
     * @inheritdoc
     *
     * @return bool
     */
    protected function process()
    {
        $permission = new Permission();
        $permission->setAclId($this->scoId);
        $permission->setPrincipalId(Permission::RECORDING_PUBLIC);
        $permission->setPermissionId(Permission::MEETING_PRINCIPAL_PUBLIC_ACCESS);
        $this->client->permissionUpdate($permission);

        $parameters = Parameter::instance()
            ->set('isMtgPasscodeReq', true)
            ->set('permissionId', Permission::RECORDING_PUBLIC)
            ->set('principalId', Permission::MEETING_PRINCIPAL_PUBLIC_ACCESS);

        return $this->client->aclFieldUpdate(
            $this->scoId,
            'meetingPasscode',
            $this->passcode,
            $parameters
        );
    }
}