1<?php
2// ===================================================================================================
3//                           _  __     _ _
4//                          | |/ /__ _| | |_ _  _ _ _ __ _
5//                          | ' </ _` | |  _| || | '_/ _` |
6//                          |_|\_\__,_|_|\__|\_,_|_| \__,_|
7//
8// This file is part of the Kaltura Collaborative Media Suite which allows users
9// to do with audio, video, and animation what Wiki platfroms allow them to do with
10// text.
11//
12// Copyright (C) 2006-2017  Kaltura Inc.
13//
14// This program is free software: you can redistribute it and/or modify
15// it under the terms of the GNU Affero General Public License as
16// published by the Free Software Foundation, either version 3 of the
17// License, or (at your option) any later version.
18//
19// This program is distributed in the hope that it will be useful,
20// but WITHOUT ANY WARRANTY; without even the implied warranty of
21// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22// GNU Affero General Public License for more details.
23//
24// You should have received a copy of the GNU Affero General Public License
25// along with this program.  If not, see <http://www.gnu.org/licenses/>.
26//
27// @ignore
28// ===================================================================================================
29
30
31/**
32 * @namespace
33 */
34namespace Kaltura\Client\Service;
35
36/**
37 * Add & Manage Access Controls
38 * @package Kaltura
39 * @subpackage Client
40 */
41class AccessControlService extends \Kaltura\Client\ServiceBase
42{
43	function __construct(\Kaltura\Client\Client $client = null)
44	{
45		parent::__construct($client);
46	}
47
48	/**
49	 * Add new Access Control Profile
50	 *
51	 * @return \Kaltura\Client\Type\AccessControl
52	 */
53	function add(\Kaltura\Client\Type\AccessControl $accessControl)
54	{
55		$kparams = array();
56		$this->client->addParam($kparams, "accessControl", $accessControl->toParams());
57		$this->client->queueServiceActionCall("accesscontrol", "add", "KalturaAccessControl", $kparams);
58		if ($this->client->isMultiRequest())
59			return $this->client->getMultiRequestResult();
60		$resultXml = $this->client->doQueue();
61		$resultXmlObject = new \SimpleXMLElement($resultXml);
62		$this->client->checkIfError($resultXmlObject->result);
63		$resultObject = \Kaltura\Client\ParseUtils::unmarshalObject($resultXmlObject->result, "KalturaAccessControl");
64		$this->client->validateObjectType($resultObject, "\\Kaltura\\Client\\Type\\AccessControl");
65		return $resultObject;
66	}
67
68	/**
69	 * Delete Access Control Profile by id
70	 *
71	 */
72	function delete($id)
73	{
74		$kparams = array();
75		$this->client->addParam($kparams, "id", $id);
76		$this->client->queueServiceActionCall("accesscontrol", "delete", null, $kparams);
77		if ($this->client->isMultiRequest())
78			return $this->client->getMultiRequestResult();
79		$resultXml = $this->client->doQueue();
80		$resultXmlObject = new \SimpleXMLElement($resultXml);
81		$this->client->checkIfError($resultXmlObject->result);
82	}
83
84	/**
85	 * Get Access Control Profile by id
86	 *
87	 * @return \Kaltura\Client\Type\AccessControl
88	 */
89	function get($id)
90	{
91		$kparams = array();
92		$this->client->addParam($kparams, "id", $id);
93		$this->client->queueServiceActionCall("accesscontrol", "get", "KalturaAccessControl", $kparams);
94		if ($this->client->isMultiRequest())
95			return $this->client->getMultiRequestResult();
96		$resultXml = $this->client->doQueue();
97		$resultXmlObject = new \SimpleXMLElement($resultXml);
98		$this->client->checkIfError($resultXmlObject->result);
99		$resultObject = \Kaltura\Client\ParseUtils::unmarshalObject($resultXmlObject->result, "KalturaAccessControl");
100		$this->client->validateObjectType($resultObject, "\\Kaltura\\Client\\Type\\AccessControl");
101		return $resultObject;
102	}
103
104	/**
105	 * List Access Control Profiles by filter and pager
106	 *
107	 * @return \Kaltura\Client\Type\AccessControlListResponse
108	 */
109	function listAction(\Kaltura\Client\Type\AccessControlFilter $filter = null, \Kaltura\Client\Type\FilterPager $pager = null)
110	{
111		$kparams = array();
112		if ($filter !== null)
113			$this->client->addParam($kparams, "filter", $filter->toParams());
114		if ($pager !== null)
115			$this->client->addParam($kparams, "pager", $pager->toParams());
116		$this->client->queueServiceActionCall("accesscontrol", "list", "KalturaAccessControlListResponse", $kparams);
117		if ($this->client->isMultiRequest())
118			return $this->client->getMultiRequestResult();
119		$resultXml = $this->client->doQueue();
120		$resultXmlObject = new \SimpleXMLElement($resultXml);
121		$this->client->checkIfError($resultXmlObject->result);
122		$resultObject = \Kaltura\Client\ParseUtils::unmarshalObject($resultXmlObject->result, "KalturaAccessControlListResponse");
123		$this->client->validateObjectType($resultObject, "\\Kaltura\\Client\\Type\\AccessControlListResponse");
124		return $resultObject;
125	}
126
127	/**
128	 * Update Access Control Profile by id
129	 *
130	 * @return \Kaltura\Client\Type\AccessControl
131	 */
132	function update($id, \Kaltura\Client\Type\AccessControl $accessControl)
133	{
134		$kparams = array();
135		$this->client->addParam($kparams, "id", $id);
136		$this->client->addParam($kparams, "accessControl", $accessControl->toParams());
137		$this->client->queueServiceActionCall("accesscontrol", "update", "KalturaAccessControl", $kparams);
138		if ($this->client->isMultiRequest())
139			return $this->client->getMultiRequestResult();
140		$resultXml = $this->client->doQueue();
141		$resultXmlObject = new \SimpleXMLElement($resultXml);
142		$this->client->checkIfError($resultXmlObject->result);
143		$resultObject = \Kaltura\Client\ParseUtils::unmarshalObject($resultXmlObject->result, "KalturaAccessControl");
144		$this->client->validateObjectType($resultObject, "\\Kaltura\\Client\\Type\\AccessControl");
145		return $resultObject;
146	}
147}
148