/** * @return CapabilityAcl */ public function getAclCapability() { return CapabilityAcl::cast($this->aclCapability); }
/** * @depends testSetAclCapabilitySetsProperty */ public function testGetAclCapabilityReturnsPropertyValue() { $aclCapability = CapabilityAcl::cast(CapabilityAcl::DISCOVER); $this->repositoryCapabilities->setAclCapability($aclCapability); $this->assertSame($aclCapability, $this->repositoryCapabilities->getAclCapability()); }
public function testConvertRepositoryCapabilitiesConvertsArrayToRepositoryCapabilitiesObject() { $expectedCapabilities = new RepositoryCapabilities(); $expectedCapabilities->setSupportsUnfiling(true); $expectedCapabilities->setSupportsPwcUpdatable(true); $expectedCapabilities->setSupportsMultifiling(true); $expectedCapabilities->setSupportsGetFolderTree(true); $expectedCapabilities->setSupportsGetDescendants(true); $expectedCapabilities->setAclCapability(CapabilityAcl::cast(CapabilityAcl::MANAGE)); $expectedCapabilities->setChangesCapability(CapabilityChanges::cast(CapabilityChanges::PROPERTIES)); $expectedCapabilities->setContentStreamUpdatesCapability(CapabilityContentStreamUpdates::cast(CapabilityContentStreamUpdates::ANYTIME)); $creatablePropertyTypes = new CreatablePropertyTypes(); $creatablePropertyTypes->setCanCreate(array(PropertyType::cast(PropertyType::DATETIME), PropertyType::cast(PropertyType::ID), PropertyType::cast(PropertyType::HTML))); $creatablePropertyTypes->setExtensions($this->cmisExtensionsDummy); $expectedCapabilities->setCreatablePropertyTypes($creatablePropertyTypes); $expectedCapabilities->setQueryCapability(CapabilityQuery::cast(CapabilityQuery::BOTHCOMBINED)); $newTypeSettableAttributes = new NewTypeSettableAttributes(); $newTypeSettableAttributes->setCanSetId(true); $newTypeSettableAttributes->setExtensions($this->cmisExtensionsDummy); $expectedCapabilities->setNewTypeSettableAttributes($newTypeSettableAttributes); $expectedCapabilities->setJoinCapability(CapabilityJoin::cast(CapabilityJoin::NONE)); $expectedCapabilities->setRenditionsCapability(CapabilityRenditions::cast(CapabilityRenditions::NONE)); $expectedCapabilities->setOrderByCapability(CapabilityOrderBy::cast(CapabilityOrderBy::NONE)); $expectedCapabilities->setExtensions($this->cmisExtensionsDummy); $repositoryInfoArray = current($this->getResponseFixtureContentAsArray('Cmis/v1.1/BrowserBinding/getRepositoryInfo-full-response.log')); $result = $this->jsonConverter->convertRepositoryCapabilities($repositoryInfoArray[JSONConstants::JSON_REPINFO_CAPABILITIES]); $this->assertEquals($expectedCapabilities, $result); return $result; }
/** * @param array|null $data * @return RepositoryCapabilities|null */ public function convertRepositoryCapabilities(array $data = null) { if (empty($data)) { return null; } if (isset($data[JSONConstants::JSON_CAP_CONTENT_STREAM_UPDATABILITY])) { $data[JSONConstants::JSON_CAP_CONTENT_STREAM_UPDATABILITY] = CapabilityContentStreamUpdates::cast($data[JSONConstants::JSON_CAP_CONTENT_STREAM_UPDATABILITY]); } if (isset($data[JSONConstants::JSON_CAP_CHANGES])) { $data[JSONConstants::JSON_CAP_CHANGES] = CapabilityChanges::cast($data[JSONConstants::JSON_CAP_CHANGES]); } if (isset($data[JSONConstants::JSON_CAP_RENDITIONS])) { $data[JSONConstants::JSON_CAP_RENDITIONS] = CapabilityRenditions::cast($data[JSONConstants::JSON_CAP_RENDITIONS]); } if (isset($data[JSONConstants::JSON_CAP_ORDER_BY])) { $data[JSONConstants::JSON_CAP_ORDER_BY] = CapabilityOrderBy::cast($data[JSONConstants::JSON_CAP_ORDER_BY]); } if (isset($data[JSONConstants::JSON_CAP_QUERY])) { $data[JSONConstants::JSON_CAP_QUERY] = CapabilityQuery::cast($data[JSONConstants::JSON_CAP_QUERY]); } if (isset($data[JSONConstants::JSON_CAP_JOIN])) { $data[JSONConstants::JSON_CAP_JOIN] = CapabilityJoin::cast($data[JSONConstants::JSON_CAP_JOIN]); } if (isset($data[JSONConstants::JSON_CAP_ACL])) { $data[JSONConstants::JSON_CAP_ACL] = CapabilityAcl::cast($data[JSONConstants::JSON_CAP_ACL]); } if (isset($data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES])) { $data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES] = $this->convertCreatablePropertyTypes($data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES]); if ($data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES] === null) { unset($data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES]); } } if (isset($data[JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES])) { $data[JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES] = $this->convertNewTypeSettableAttributes($data[JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES]); if ($data[JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES] === null) { unset($data[JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES]); } } $repositoryCapabilities = new RepositoryCapabilities(); $repositoryCapabilities->setExtensions($this->convertExtension($data, JSONConstants::getCapabilityKeys())); $repositoryCapabilities->populate($data, array_merge(array_combine(JSONConstants::getCapabilityKeys(), JSONConstants::getCapabilityKeys()), array(JSONConstants::JSON_CAP_CONTENT_STREAM_UPDATABILITY => 'contentStreamUpdatesCapability', JSONConstants::JSON_CAP_CHANGES => 'changesCapability', JSONConstants::JSON_CAP_RENDITIONS => 'renditionsCapability', JSONConstants::JSON_CAP_GET_DESCENDANTS => 'supportsGetDescendants', JSONConstants::JSON_CAP_GET_FOLDER_TREE => 'supportsGetFolderTree', JSONConstants::JSON_CAP_MULTIFILING => 'supportsMultifiling', JSONConstants::JSON_CAP_UNFILING => 'supportsUnfiling', JSONConstants::JSON_CAP_VERSION_SPECIFIC_FILING => 'supportsVersionSpecificFiling', JSONConstants::JSON_CAP_PWC_SEARCHABLE => 'supportsPwcSearchable', JSONConstants::JSON_CAP_PWC_UPDATABLE => 'supportsPwcUpdatable', JSONConstants::JSON_CAP_ALL_VERSIONS_SEARCHABLE => 'supportsAllVersionsSearchable', JSONConstants::JSON_CAP_ORDER_BY => 'orderByCapability', JSONConstants::JSON_CAP_QUERY => 'queryCapability', JSONConstants::JSON_CAP_JOIN => 'joinCapability', JSONConstants::JSON_CAP_ACL => 'aclCapability', JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES => 'creatablePropertyTypes', JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES => 'newTypeSettableAttributes')), true); return $repositoryCapabilities; }