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-10283:Adding new KalturaUserEntryType called registration #8919

Merged
merged 2 commits into from
Nov 19, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions plugins/content/registration/RegistrationPlugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
/**
* Plugin enabling the storage of entries that relates to a user for registration
* @package plugins.registration
*/
class RegistrationPlugin extends KalturaPlugin implements IKalturaPermissions, IKalturaEnumerator, IKalturaObjectLoader
{
const PLUGIN_NAME = 'registration';

/* (non-PHPdoc)
* @see IKalturaPlugin::getPluginName()
*/
public static function getPluginName()
{
return self::PLUGIN_NAME;
}

/* (non-PHPdoc)
* @see IKalturaPermissions::isAllowedPartner()
*/
public static function isAllowedPartner($partnerId)
{
return true;
}

/* (non-PHPdoc)
* @see IKalturaEnumerator::getEnums()
*/
public static function getEnums($baseEnumName = null)
{
if (is_null($baseEnumName) || $baseEnumName === 'UserEntryType')
{
return array('RegistrationUserEntryType');
}
return array();
}

public static function getRegistrationUserEntryTypeCoreValue ($valueName)
{
$value = self::getApiValue($valueName);
return kPluginableEnumsManager::apiToCore('UserEntryType', $value);
}

/**
* @return string external API value of dynamic enum.
*/
public static function getApiValue($valueName)
{
return self::getPluginName() . IKalturaEnumerator::PLUGIN_VALUE_DELIMITER . $valueName;
}

public static function loadObject($baseClass, $enumValue, array $constructorArgs = null)
{
if ( ($baseClass === 'KalturaUserEntry') && ($enumValue == self::getRegistrationUserEntryTypeCoreValue(RegistrationUserEntryType::REGISTRATION)))
{
return new KalturaRegistrationUserEntry();
}
if ( ($baseClass === 'UserEntry') && ($enumValue == self::getRegistrationUserEntryTypeCoreValue(RegistrationUserEntryType::REGISTRATION)))
{
return new RegistrationUserEntry();
}
return null;
}

public static function getObjectClass($baseClass, $enumValue)
{
if ($baseClass === 'UserEntry' && $enumValue == self::getRegistrationUserEntryTypeCoreValue(RegistrationUserEntryType::REGISTRATION))
{
return RegistrationUserEntry::REGISTRATION_OM_CLASS;
}
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* @package plugins.registration
* @subpackage api
*/
class KalturaRegistrationUserEntry extends KalturaUserEntry
{
/* (non-PHPdoc)
* @see KalturaObject::toObject()
*/
public function toObject($dbObject = null, $propertiesToSkip = array())
{
if(is_null($dbObject))
{
$dbObject = new RegistrationUserEntry();
}
return parent::toObject($dbObject, $propertiesToSkip);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* @package plugins.registration
* @subpackage api.filters
*/
class KalturaRegistrationUserEntryFilter extends KalturaUserEntryFilter
{
public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
{
$this->typeEqual = RegistrationPlugin::getApiValue(RegistrationUserEntryType::REGISTRATION);
$response = parent::getListResponse($pager, $responseProfile);
return $response;
}
}
15 changes: 15 additions & 0 deletions plugins/content/registration/lib/model/RegistrationUserEntry.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* @package plugins.registration
* @subpackage model
*/
class RegistrationUserEntry extends UserEntry
{
const REGISTRATION_OM_CLASS = 'RegistrationUserEntry';

public function __construct()
{
$this->setType(RegistrationPlugin::getRegistrationUserEntryTypeCoreValue(RegistrationUserEntryType::REGISTRATION));
parent::__construct();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* @package plugins.registration
* @subpackage model.enum
*/
class RegistrationUserEntryType implements IKalturaPluginEnum, UserEntryType
{
const REGISTRATION = 'REGISTRATION';

/* (non-PHPdoc)
* @see IKalturaPluginEnum::getAdditionalValues()
*/
public static function getAdditionalValues()
{
return array(
'REGISTRATION' => self::REGISTRATION,
);
}

/* (non-PHPdoc)
* @see IKalturaPluginEnum::getAdditionalDescriptions()
*/
public static function getAdditionalDescriptions()
{
return array(
self::REGISTRATION => 'Registration User Entry Type',
);
}
}
9 changes: 9 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# Orion 15.11.0 #
## Adding new KalturaUserEntryType called registration ##
- Issue Type: Task
- Issue ID: PLAT-10283

### configuration ###
Add Registration to your plugins.ini

### Deployment scripts ###
php /opt/kaltura/app/deployment/base/scripts/installPlugins.php

## Configurations Maps Modifications ##
- Issue Type: Task
Expand Down