AbstractParentalControlService

AbstractParentalControlService ⇐ Abstract

Kind: global abstract class
Extends: Abstract
Mixes: MServiceCache
Service:
Properties

NameTypeDescription
pinCodeIsSettledboolean

If the pin code is settled, true by default - FOR TESTING PURPOSE ONLY !

adultCodeIsSetboolean

If the adult code is set, true by default - FOR TESTING PURPOSE ONLY !

adultControlEnabledByDefaultboolean

If the adult control should be enabled by default, false by default for when the whole adult setting is deactivated - To be configured for projects

adultUnlockDurationNumber

time in ms we keep adult content unlocked

channelUnlockDurationNumber

time in ms we keep channel content unlocked

_lastAdultUnlockTimeNumber

the last valid parental pinCode timestamp for adult content

_unlockTimeChannelMapObject

an Object with channel id as key , and timestamp (when channel has been unlocked) as value

AbstractParentalControlService()

A service to help in parental control management

DEFAULT_PIN_CODE : string

Kind: instance constant of AbstractParentalControlService

DEFAULT_PIN_CODE : string

Kind: instance constant of AbstractParentalControlService

init() ⇒ Promise

Init the service

Kind: instance method of AbstractParentalControlService

unlockStream(pinCode, options) ⇒ Promise.<integer>

Unlock a stream that was locked due to a morality level upon the current one.

Kind: instance method of AbstractParentalControlService
Returns: Promise.<integer> - A promise returning an integer value as: PIN_CODE_IS_CORRECT, PIN_CODE_IS_INCORRECT or PIN_CODE_IS_LOCKED
See: PinCodeStatus

ParamTypeDescription
pinCodestring

The parental control PIN

optionsobject

Additional options

isPinCodeSettled() ⇒ Promise.<boolean>

Make sur that the pin code has been created For some operators, when the client forget its code, he call the customer service that will unset the pin code (ie, it does not reset the pin code to a value, instead it invalidates the current pin code) In such case, you need to check if the pin code is settled, before checking the pin code

Kind: instance method of AbstractParentalControlService
Returns: Promise.<boolean> - true if the pin code is settled

isAdultCodeSet() ⇒ Promise.<boolean>

Make sur that the adult code has been created For some operators, when the client forget their code, he calls the customer service that will unset the pin code (ie, it does not reset the adult code to a value, instead it invalidates the current adult code) In such case, you need to check if the pin code is sett, before checking the pin code

Kind: instance method of AbstractParentalControlService
Returns: Promise.<boolean> - true if the pin code is set

checkPinCode(pinCode) ⇒ Promise.<integer>

Verify that the PIN specified by pinCode is the correct parental control PIN.

Kind: instance method of AbstractParentalControlService
Returns: Promise.<integer> - A promise returning an integer value as: PIN_CODE_IS_CORRECT, PIN_CODE_IS_INCORRECT or PIN_CODE_IS_LOCKED
See: PinCodeStatus

ParamTypeDescription
pinCodestring

The parental control PIN to be verified.

checkAdultCode(pinCode) ⇒ Promise.<integer>

Verify that the PIN specified by pinCode is the correct adult control PIN.

Kind: instance method of AbstractParentalControlService
Returns: Promise.<integer> - A promise returning an integer value as: PIN_CODE_IS_CORRECT, PIN_CODE_IS_INCORRECT or PIN_CODE_IS_LOCKED
See: PinCodeStatus

ParamTypeDescription
pinCodestring

The adult control PIN to be verified.

setPinCode(oldPinCode, newPinCode) ⇒ Promise.<integer>

Set the parental control PIN

Kind: instance method of AbstractParentalControlService
Returns: Promise.<integer> - A promise returning an integer value as: PIN_CODE_IS_CORRECT, PIN_CODE_IS_INCORRECT or PIN_CODE_IS_LOCKED
See: PinCodeStatus

ParamTypeDescription
oldPinCodestring

The current parental control PIN.

newPinCodestring

the new value for the parental control PIN.

setAdultCode(oldPinCode, newPinCode) ⇒ Promise.<integer>

Set the adult control PIN

Kind: instance method of AbstractParentalControlService
Returns: Promise.<integer> - A promise returning an integer value as: PIN_CODE_IS_CORRECT, PIN_CODE_IS_INCORRECT or PIN_CODE_IS_LOCKED
See: PinCodeStatus

ParamTypeDescription
oldPinCodestring

The current adult control PIN.

newPinCodestring

the new value for the adult control PIN.

getParentalControlStatus([options]) ⇒ Promise.<boolean>

Get a parental control status

Kind: instance method of AbstractParentalControlService

ParamTypeDescription
[options]Object

Additional options

setParentalControlStatus(pinCode, enable) ⇒ Promise.<Boolean, Error>

Set a parental control status

Kind: instance method of AbstractParentalControlService
Returns: Promise.<Boolean, Error> - A promise resolved with true if enabled

ParamTypeDescription
pinCodestring

the parental control PIN

enableBoolean

indicating whether parental control should be enabled.

getAdultControlStatus([options]) ⇒ Promise.<boolean>

Get the adult control status

Kind: instance method of AbstractParentalControlService

ParamTypeDescription
[options]Object

Additional options

setAdultControlStatus(pinCode, enable) ⇒ Promise.<Boolean, Error>

Set the adult control status

Kind: instance method of AbstractParentalControlService
Returns: Promise.<Boolean, Error> - A promise resolved with true if enabled

ParamTypeDescription
pinCodestring

the adult control PIN

enableBoolean

indicating whether adult control should be enabled.

getMoralityLevel([options]) ⇒ Promise.<integer>

Get the age restriction. This is a value between 0 and 21 years old (@see AbstractParentalRatingLocal)

Kind: instance method of AbstractParentalControlService

ParamTypeDescription
[options]Object

Additional options

setMoralityLevel(pinCode, level) ⇒ Promise.<integer>

Set the age restriction. This is a value between 0 and 21 years old (@see AbstractParentalRatingLocal)

Kind: instance method of AbstractParentalControlService
Returns: Promise.<integer> - A promise returning an integer value as: PIN_CODE_IS_CORRECT, PIN_CODE_IS_INCORRECT or PIN_CODE_IS_LOCKED
See: PinCodeStatus

ParamTypeDescription
pinCodestring

parental control PIN

levelnumber

isBlocked(model) ⇒ Promise.<Boolean, Error>

Return true if the program is blocked due to it’s parental rating

Kind: instance method of AbstractParentalControlService
Returns: Promise.<Boolean, Error> - True if the program is blocked

ParamTypeDescription
modelBusinessModel

The model to check parental rating on

isBlockedSync(model) ⇒ *

Return true if the model is blocked due to it’s parental rating

Kind: instance method of AbstractParentalControlService

ParamType
modelBusinessModel

resetPinCode() ⇒ Promise.<Boolean, Error>

Used to reset the parental Pin code to his initial value

Kind: instance method of AbstractParentalControlService
Returns: Promise.<Boolean, Error> - A promise (true, error)

resetAdultCode() ⇒ Promise.<Boolean, Error>

Used to reset the adult Pin code to its initial value

Kind: instance method of AbstractParentalControlService
Returns: Promise.<Boolean, Error> - A promise (true, error)

isUnlockedAdultForDuration() ⇒ boolean

Return true if the adult content is unlock for this.adultUnlockDuration

Kind: instance method of AbstractParentalControlService
Returns: boolean - return true if adult is unlocked
Access: public

isUnlockedChannelForDuration(channelId) ⇒ boolean

Return true if the blockedChannel content is unlock for this.channelBlockedUnlockDuration

Kind: instance method of AbstractParentalControlService
Returns: boolean - return true if channel is unlocked
Access: public

ParamTypeDescription
channelIdString

id of the channel

validateUnlockAdult(reset) ⇒ undefined

ValidateUnlockAdult reset the last unlock time for adult content to Date.now()

Kind: instance method of AbstractParentalControlService
Returns: undefined - returns nothing just set _lastAdultUnlockTime value
Access: public

ParamTypeDescription
resetBoolean

true if we want to reset _lastAdultUnlockTime

validateUnlockChannel(channelId, reset) ⇒ undefined

ValidateUnlockAdult reset the last unlock time for given channelId to Date.now()

Kind: instance method of AbstractParentalControlService
Returns: undefined - just setter of _unlockTimeChannelMap property
Access: public

ParamTypeDescription
channelIdString

id of the channel

resetBoolean

if set to true, reset the channel

_unlockStream(pinCode) ⇒ Promise.<integer>

Kind: instance abstract method of AbstractParentalControlService

ParamTypeDescription
pinCodestring

parental control PIN

_isPinCodeSettled() ⇒ Promise.<boolean>

You may override these methods, depending on the way the customer service of your operator reset a lost pin code These method comes with a default implementation that returns true

Kind: instance method of AbstractParentalControlService
Returns: Promise.<boolean> - true if the pin code is settled
Access: protected

_isAdultCodeSet() ⇒ Promise.<boolean>

You may override this method, depending on the way the customer service of your operator reset a lost adult code This method comes with a default implementation that returns true

Kind: instance method of AbstractParentalControlService
Returns: Promise.<boolean> - true if the adult code is set
Access: protected

_checkPinCode(pinCode) ⇒ Promise.<integer>

Kind: instance abstract method of AbstractParentalControlService

ParamTypeDescription
pinCodestring

parental control PIN

_checkAdultCode(pinCode) ⇒ Promise.<integer>

Kind: instance abstract method of AbstractParentalControlService

ParamTypeDescription
pinCodestring

adult control PIN

_setPinCode(oldPinCode, newPinCode) ⇒ Promise.<integer>

Kind: instance abstract method of AbstractParentalControlService

ParamTypeDescription
oldPinCodestring

parental control PIN

newPinCodestring

parental control PIN

_setAdultCode(oldPinCode, newPinCode) ⇒ Promise.<integer>

Kind: instance abstract method of AbstractParentalControlService

ParamTypeDescription
oldPinCodestring

adult control PIN

newPinCodestring

adult control PIN

_getParentalControlStatus() ⇒ Promise.<integer>

Kind: instance abstract method of AbstractParentalControlService

_setParentalControlStatus(pinCode, enable) ⇒ Promise.<Boolean, Error>

Kind: instance abstract method of AbstractParentalControlService

ParamTypeDescription
pinCodestring

the parental control PIN

enableBoolean

indicating whether parental control should be enabled.

_getAdultControlStatus() ⇒ Promise.<integer>

Kind: instance abstract method of AbstractParentalControlService

_setAdultControlStatus(pinCode, enable) ⇒ Promise.<Boolean, Error>

Kind: instance abstract method of AbstractParentalControlService

ParamTypeDescription
pinCodestring

the adult control PIN

enableBoolean

indicating whether adult control should be enabled.

_getMoralityLevel() ⇒ Promise.<integer>

Kind: instance abstract method of AbstractParentalControlService

_setMoralityLevel(pinCode, level) ⇒ Promise.<integer>

Kind: instance abstract method of AbstractParentalControlService

ParamTypeDescription
pinCodestring

the parental control PIN

levelnumber

_resetPinCode() ⇒ Promise.<Boolean>

Kind: instance abstract method of AbstractParentalControlService

_resetAdultCode() ⇒ Promise.<Boolean>

Kind: instance abstract method of AbstractParentalControlService

_isBlockedSync(model, currentMoralityLevel) ⇒ *

Return true if the model is blocked due to it’s parental rating You must implement these method, dependending on your parental rating scheme

Kind: instance method of AbstractParentalControlService
Access: protected

ParamTypeDescription
modelBusinessModel
currentMoralityLevelnumber

the current morality level

_onPinCodeChanged() ⇒ Promise

Fired when the pinCode has been changed

Kind: instance method of AbstractParentalControlService
Access: protected

_onAdultCodeChanged() ⇒ Promise

Fired when the adultCode has been changed

Kind: instance method of AbstractParentalControlService
Access: protected

_onParentalControlStatusChanged(status) ⇒ Promise

Fired when the parental control status has been changed

Kind: instance method of AbstractParentalControlService
Access: protected

ParamTypeDescription
statusBoolean

enable/disable

_onAdultControlStatusChanged(status) ⇒ Promise

Fired when the adult control status has been changed

Kind: instance method of AbstractParentalControlService
Access: protected

ParamTypeDescription
statusBoolean

enable/disable

_onMoralityLevelChanged(level) ⇒ Promise

Fired when the morality level has been changed

Kind: instance method of AbstractParentalControlService
Access: protected

ParamType
levelnumber

_onStreamUnlock() ⇒ Promise

Fired when the stream has been unlocked

Kind: instance method of AbstractParentalControlService
Access: protected

“pinCodeChanged”

Fired when the pinCode has been changed

Kind: event emitted by AbstractParentalControlService

“parentalControlStatusChanged” (status)

Fired when the parental control status has been changed

Kind: event emitted by AbstractParentalControlService

ParamTypeDescription
statusBoolean

enable/disable

“adultControlStatusChanged” (status)

Fired when the adult control status has been changed

Kind: event emitted by AbstractParentalControlService

ParamTypeDescription
statusBoolean

enable/disable

“moralityLevelChanged” (level)

Fired when the morality level has been changed

Kind: event emitted by AbstractParentalControlService

ParamType
levelnumber

“streamUnlock”

Fired when the stream has been unlocked

Kind: event emitted by AbstractParentalControlService

“resetParentalCode” (RESET_PARENTAL_CODE)

Fired when the parental code has been reset

Kind: event emitted by AbstractParentalControlService

ParamTypeDescription
RESET_PARENTAL_CODEstring

Event label

“resetAdultCode” (RESET_ADULT_CODE)

Fired when the adult code has been reset

Kind: event emitted by AbstractParentalControlService

ParamTypeDescription
RESET_ADULT_CODEstring

Event label