AbstractParentalControlService
On this page
- AbstractParentalControlService ⇐
Abstract
- AbstractParentalControlService()
- DEFAULT_PIN_CODE :
string
- DEFAULT_PIN_CODE :
string
- init() ⇒
Promise
- unlockStream(pinCode, options) ⇒
Promise.<integer>
- isPinCodeSettled() ⇒
Promise.<boolean>
- isAdultCodeSet() ⇒
Promise.<boolean>
- checkPinCode(pinCode) ⇒
Promise.<integer>
- checkAdultCode(pinCode) ⇒
Promise.<integer>
- setPinCode(oldPinCode, newPinCode) ⇒
Promise.<integer>
- setAdultCode(oldPinCode, newPinCode) ⇒
Promise.<integer>
- getParentalControlStatus([options]) ⇒
Promise.<boolean>
- setParentalControlStatus(pinCode, enable) ⇒
Promise.<Boolean, Error>
- getAdultControlStatus([options]) ⇒
Promise.<boolean>
- setAdultControlStatus(pinCode, enable) ⇒
Promise.<Boolean, Error>
- getMoralityLevel([options]) ⇒
Promise.<integer>
- setMoralityLevel(pinCode, level) ⇒
Promise.<integer>
- isBlocked(model) ⇒
Promise.<Boolean, Error>
- isBlockedSync(model) ⇒
*
- resetPinCode() ⇒
Promise.<Boolean, Error>
- resetAdultCode() ⇒
Promise.<Boolean, Error>
- isUnlockedAdultForDuration() ⇒
boolean
- isUnlockedChannelForDuration(channelId) ⇒
boolean
- validateUnlockAdult(reset) ⇒
undefined
- validateUnlockChannel(channelId, reset) ⇒
undefined
- _unlockStream(pinCode) ⇒
Promise.<integer>
- _isPinCodeSettled() ⇒
Promise.<boolean>
- _isAdultCodeSet() ⇒
Promise.<boolean>
- _checkPinCode(pinCode) ⇒
Promise.<integer>
- _checkAdultCode(pinCode) ⇒
Promise.<integer>
- _setPinCode(oldPinCode, newPinCode) ⇒
Promise.<integer>
- _setAdultCode(oldPinCode, newPinCode) ⇒
Promise.<integer>
- _getParentalControlStatus() ⇒
Promise.<integer>
- _setParentalControlStatus(pinCode, enable) ⇒
Promise.<Boolean, Error>
- _getAdultControlStatus() ⇒
Promise.<integer>
- _setAdultControlStatus(pinCode, enable) ⇒
Promise.<Boolean, Error>
- _getMoralityLevel() ⇒
Promise.<integer>
- _setMoralityLevel(pinCode, level) ⇒
Promise.<integer>
- _resetPinCode() ⇒
Promise.<Boolean>
- _resetAdultCode() ⇒
Promise.<Boolean>
- _isBlockedSync(model, currentMoralityLevel) ⇒
*
- _onPinCodeChanged() ⇒
Promise
- _onAdultCodeChanged() ⇒
Promise
- _onParentalControlStatusChanged(status) ⇒
Promise
- _onAdultControlStatusChanged(status) ⇒
Promise
- _onMoralityLevelChanged(level) ⇒
Promise
- _onStreamUnlock() ⇒
Promise
- “pinCodeChanged”
- “parentalControlStatusChanged” (status)
- “adultControlStatusChanged” (status)
- “moralityLevelChanged” (level)
- “streamUnlock”
- “resetParentalCode” (RESET_PARENTAL_CODE)
- “resetAdultCode” (RESET_ADULT_CODE)
AbstractParentalControlService ⇐ Abstract
Kind: global abstract class
Extends: Abstract
Mixes: MServiceCache
Service:
Properties
Name | Type | Description |
---|---|---|
pinCodeIsSettled | boolean | If the pin code is settled, true by default - FOR TESTING PURPOSE ONLY ! |
adultCodeIsSet | boolean | If the adult code is set, true by default - FOR TESTING PURPOSE ONLY ! |
adultControlEnabledByDefault | boolean | 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 |
adultUnlockDuration | Number | time in ms we keep adult content unlocked |
channelUnlockDuration | Number | time in ms we keep channel content unlocked |
_lastAdultUnlockTime | Number | the last valid parental pinCode timestamp for adult content |
_unlockTimeChannelMap | Object | an Object with channel id as key , and timestamp (when channel has been unlocked) as value |
- AbstractParentalControlService ⇐
Abstract
- new AbstractParentalControlService()
- instance
- .DEFAULT_PIN_CODE :
string
- .DEFAULT_PIN_CODE :
string
- .init() ⇒
Promise
- .unlockStream(pinCode, options) ⇒
Promise.<integer>
- .isPinCodeSettled() ⇒
Promise.<boolean>
- .isAdultCodeSet() ⇒
Promise.<boolean>
- .checkPinCode(pinCode) ⇒
Promise.<integer>
- .checkAdultCode(pinCode) ⇒
Promise.<integer>
- .setPinCode(oldPinCode, newPinCode) ⇒
Promise.<integer>
- .setAdultCode(oldPinCode, newPinCode) ⇒
Promise.<integer>
- .getParentalControlStatus([options]) ⇒
Promise.<boolean>
- .setParentalControlStatus(pinCode, enable) ⇒
Promise.<Boolean, Error>
- .getAdultControlStatus([options]) ⇒
Promise.<boolean>
- .setAdultControlStatus(pinCode, enable) ⇒
Promise.<Boolean, Error>
- .getMoralityLevel([options]) ⇒
Promise.<integer>
- .setMoralityLevel(pinCode, level) ⇒
Promise.<integer>
- .isBlocked(model) ⇒
Promise.<Boolean, Error>
- .isBlockedSync(model) ⇒
*
- .resetPinCode() ⇒
Promise.<Boolean, Error>
- .resetAdultCode() ⇒
Promise.<Boolean, Error>
- .isUnlockedAdultForDuration() ⇒
boolean
- .isUnlockedChannelForDuration(channelId) ⇒
boolean
- .validateUnlockAdult(reset) ⇒
undefined
- .validateUnlockChannel(channelId, reset) ⇒
undefined
- ._unlockStream(pinCode) ⇒
Promise.<integer>
- ._isPinCodeSettled() ⇒
Promise.<boolean>
- ._isAdultCodeSet() ⇒
Promise.<boolean>
- ._checkPinCode(pinCode) ⇒
Promise.<integer>
- ._checkAdultCode(pinCode) ⇒
Promise.<integer>
- ._setPinCode(oldPinCode, newPinCode) ⇒
Promise.<integer>
- ._setAdultCode(oldPinCode, newPinCode) ⇒
Promise.<integer>
- ._getParentalControlStatus() ⇒
Promise.<integer>
- ._setParentalControlStatus(pinCode, enable) ⇒
Promise.<Boolean, Error>
- ._getAdultControlStatus() ⇒
Promise.<integer>
- ._setAdultControlStatus(pinCode, enable) ⇒
Promise.<Boolean, Error>
- ._getMoralityLevel() ⇒
Promise.<integer>
- ._setMoralityLevel(pinCode, level) ⇒
Promise.<integer>
- ._resetPinCode() ⇒
Promise.<Boolean>
- ._resetAdultCode() ⇒
Promise.<Boolean>
- ._isBlockedSync(model, currentMoralityLevel) ⇒
*
- ._onPinCodeChanged() ⇒
Promise
- ._onAdultCodeChanged() ⇒
Promise
- ._onParentalControlStatusChanged(status) ⇒
Promise
- ._onAdultControlStatusChanged(status) ⇒
Promise
- ._onMoralityLevelChanged(level) ⇒
Promise
- ._onStreamUnlock() ⇒
Promise
- .DEFAULT_PIN_CODE :
- static
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
Param | Type | Description |
---|---|---|
pinCode | string | The parental control PIN |
options | object | 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
Param | Type | Description |
---|---|---|
pinCode | string | 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
Param | Type | Description |
---|---|---|
pinCode | string | 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
Param | Type | Description |
---|---|---|
oldPinCode | string | The current parental control PIN. |
newPinCode | string | 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
Param | Type | Description |
---|---|---|
oldPinCode | string | The current adult control PIN. |
newPinCode | string | the new value for the adult control PIN. |
getParentalControlStatus([options]) ⇒ Promise.<boolean>
Get a parental control status
Kind: instance method of AbstractParentalControlService
Param | Type | Description |
---|---|---|
[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
Param | Type | Description |
---|---|---|
pinCode | string | the parental control PIN |
enable | Boolean | indicating whether parental control should be enabled. |
getAdultControlStatus([options]) ⇒ Promise.<boolean>
Get the adult control status
Kind: instance method of AbstractParentalControlService
Param | Type | Description |
---|---|---|
[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
Param | Type | Description |
---|---|---|
pinCode | string | the adult control PIN |
enable | Boolean | 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
Param | Type | Description |
---|---|---|
[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
Param | Type | Description |
---|---|---|
pinCode | string | parental control PIN |
level | number |
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
Param | Type | Description |
---|---|---|
model | BusinessModel | 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
Param | Type |
---|---|
model | BusinessModel |
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
Param | Type | Description |
---|---|---|
channelId | String | 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
Param | Type | Description |
---|---|---|
reset | Boolean | 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
Param | Type | Description |
---|---|---|
channelId | String | id of the channel |
reset | Boolean | if set to true, reset the channel |
_unlockStream(pinCode) ⇒ Promise.<integer>
Kind: instance abstract method of AbstractParentalControlService
Param | Type | Description |
---|---|---|
pinCode | string | 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
Param | Type | Description |
---|---|---|
pinCode | string | parental control PIN |
_checkAdultCode(pinCode) ⇒ Promise.<integer>
Kind: instance abstract method of AbstractParentalControlService
Param | Type | Description |
---|---|---|
pinCode | string | adult control PIN |
_setPinCode(oldPinCode, newPinCode) ⇒ Promise.<integer>
Kind: instance abstract method of AbstractParentalControlService
Param | Type | Description |
---|---|---|
oldPinCode | string | parental control PIN |
newPinCode | string | parental control PIN |
_setAdultCode(oldPinCode, newPinCode) ⇒ Promise.<integer>
Kind: instance abstract method of AbstractParentalControlService
Param | Type | Description |
---|---|---|
oldPinCode | string | adult control PIN |
newPinCode | string | adult control PIN |
_getParentalControlStatus() ⇒ Promise.<integer>
Kind: instance abstract method of AbstractParentalControlService
_setParentalControlStatus(pinCode, enable) ⇒ Promise.<Boolean, Error>
Kind: instance abstract method of AbstractParentalControlService
Param | Type | Description |
---|---|---|
pinCode | string | the parental control PIN |
enable | Boolean | 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
Param | Type | Description |
---|---|---|
pinCode | string | the adult control PIN |
enable | Boolean | 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
Param | Type | Description |
---|---|---|
pinCode | string | the parental control PIN |
level | number |
_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
Param | Type | Description |
---|---|---|
model | BusinessModel | |
currentMoralityLevel | number | 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
Param | Type | Description |
---|---|---|
status | Boolean | enable/disable |
_onAdultControlStatusChanged(status) ⇒ Promise
Fired when the adult control status has been changed
Kind: instance method of AbstractParentalControlService
Access: protected
Param | Type | Description |
---|---|---|
status | Boolean | enable/disable |
_onMoralityLevelChanged(level) ⇒ Promise
Fired when the morality level has been changed
Kind: instance method of AbstractParentalControlService
Access: protected
Param | Type |
---|---|
level | number |
_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
Param | Type | Description |
---|---|---|
status | Boolean | enable/disable |
“adultControlStatusChanged” (status)
Fired when the adult control status has been changed
Kind: event emitted by AbstractParentalControlService
Param | Type | Description |
---|---|---|
status | Boolean | enable/disable |
“moralityLevelChanged” (level)
Fired when the morality level has been changed
Kind: event emitted by AbstractParentalControlService
Param | Type |
---|---|
level | number |
“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
Param | Type | Description |
---|---|---|
RESET_PARENTAL_CODE | string | Event label |
“resetAdultCode” (RESET_ADULT_CODE)
Fired when the adult code has been reset
Kind: event emitted by AbstractParentalControlService
Param | Type | Description |
---|---|---|
RESET_ADULT_CODE | string | Event label |