Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLAT-9622:Add custom validate for insert on kalturaConfMaps #8059

Merged
merged 1 commit into from Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion api_v3/lib/KalturaErrors.php
Expand Up @@ -721,6 +721,7 @@ class KalturaErrors extends APIErrors
const CONF_CONTORL_ERROR = "CONF_CONTORL_ERROR;ERR;Conf control error - [@ERR@]";
const MAP_DOES_NOT_EXIST = "MAP_DOES_NOT_EXIST;;Map does not exist";
const MAP_ALREADY_EXIST = "MAP_ALREADY_EXIST;NAME,HOST;Map already exist for this map name {@NAME@} and host {@HOST@}";

const MAP_CANNOT_BE_CREATED_ON_FILE_SYSTEM = "MAP_CANNOT_BE_CREATED_ON_FILE_SYSTEM;;Map cannnot be created on file system";
const HOST_NAME_CONTAINS_ASTRIX = "HOST_NAME_CONTAINS_ASTRIX;HOST_NAME;Host name contains *, use # instead {@HOST_NAME@}";
}

12 changes: 12 additions & 0 deletions plugins/conf_maps/lib/api/KalturaConfMaps.php
Expand Up @@ -91,6 +91,18 @@ public function getMapBetweenObjects()
return array_merge(parent::getMapBetweenObjects(), self::$map_between_objects);
}

public function validateForInsert($propertiesToSkip = array())
{
if(strstr($this->relatedHost,'*'))
{
throw new KalturaAPIException(KalturaErrors::HOST_NAME_CONTAINS_ASTRIX ,$this->relatedHost );
}
if($this->sourceLocation == KalturaConfMapsSourceLocation::FS)
{
throw new KalturaAPIException(KalturaErrors::MAP_CANNOT_BE_CREATED_ON_FILE_SYSTEM);
}
parent::validateForInsert($this);
}

public function validateContent()
{
Expand Down