Source of file PermissionInfoFromPrincipal.php

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

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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
<?php

namespace AdobeConnectClient\Commands;

use AdobeConnectClient\Command;
use AdobeConnectClient\Entities\Permission;
use AdobeConnectClient\Converter\Converter;
use AdobeConnectClient\Helpers\StatusValidate;
use AdobeConnectClient\Helpers\SetEntityAttributes as FillObject;

/**
 * Get the Principal's permission in a SCO, Principal or Account
 *
 * More info see {@link https://helpx.adobe.com/adobe-connect/webservices/permissions-info.html}
 */
class PermissionInfoFromPrincipal extends Command
{
    /**
     * @var int
     */
    protected $aclId;

    /**
     * @var int
     */
    protected $principalId;

    /**
     * @param int $aclId
     * @param int $principalId
     */
    public function __construct($aclId, $principalId)
    {
        $this->aclId = (int) $aclId;
        $this->principalId = (int) $principalId;
    }

    /**
     * @inheritdoc
     *
     * @return Permission
     */
    protected function process()
    {
        $response = Converter::convert(
            $this->client->doGet([
                'action' => 'permissions-info',
                'acl-id' => $this->aclId,
                'principal-id' => $this->principalId,
                'session' => $this->client->getSession()
            ])
        );
        StatusValidate::validate($response['status']);
        $permission = new Permission();
        FillObject::setAttributes($permission, $response['permission']);
        return $permission;
    }
}