Extends
Members
attrs
static
Attributes defined in metadata. This property not exist in real life and added just for help
entity: UBEntity
Reference to entity metadata
Methods
addNew(ctx)
api
Create record with filled default values and return it to caller.
Newly created record is not inserted to database. For inserting record to the database insert
method should be called
Arguments:
-
ctx
(ubMethodParams)
- Mixes In:
-
mStorage.addNew   
delete(ctx)
api
Delete data
Arguments:
-
ctx
(ubMethodParams)
Properties
-
mParams.execParams.ID
(number)
 element ID to be deleted
- Mixes In:
-
mStorage.delete   
insert(ctx)
api
Insert new row to the entity.
Arguments:
-
ctx
(ubMethodParams)
Properties
- Mixes In:
-
mStorage.insert   
select(ctx)
api
Read entity data
Arguments:
-
ctx
(ubMethodParams)
Properties
-
mParams
(UBQL)
 ORM query in UBQL format
- Mixes In:
-
mStorage.select   
update(ctx)
api
Update data
Arguments:
-
ctx
(ubMethodParams)
Properties
- Mixes In:
-
mStorage.update   
auth(otp, otpKind, fCheckUDataopt, checkDataopt, callopt) → Boolean
Switch session to user from OTP or execute callback in session of user from OTP
Arguments:
-
otp
(string)
-
otpKind
(string)
-
[fCheckUData]
(function)
 function for check OTP from uData
-
[checkData]
(Object)
 value for check OTP from uData
-
[call]
(function)
 This function will be called in user's session. If defined then restore original user session after call it.
- Deprecated:
- use authAndExecute instead
authAndExecute(otp, otpKind, callBack) → Boolean
Check given otp, and in case it is correct run callback
Arguments:
-
otp
(string)
-
otpKind
(string)
-
callBack
(function)
 This function will be called in user's session with uData parameter from otp if otp is correct.
Example
// generation otp
var userID = 100000000122,
uData = {size: {width: 100, height: 50}};
var otp = uba_otp.generateOtp('EMail', userID, uData);
// send this otp via EMail
//............................
// after receiving this otp
var isOtpCorrect = uba_otp.authAndExecute('EMail', otp, function(uData){
var params = JSON.parse(uData);
console.log('user ID is', Session.userID);//'user ID is 100000000122';
console.log('width is', params.width);//'width is 100';
}));
addNew(ctx) api
Create record with filled default values and return it to caller.
Newly created record is not inserted to database. For inserting record to the database
insert
method should be called
Arguments:
-
ctx
(ubMethodParams)
- Mixes In:
- mStorage.addNew   
delete(ctx) api
Delete data
Arguments:
-
ctx
(ubMethodParams)
Properties
-
mParams.execParams.ID
(number)
 element ID to be deleted
-
- Mixes In:
- mStorage.delete   
insert(ctx) api
Insert new row to the entity.
Arguments:
-
ctx
(ubMethodParams)
Properties
- Mixes In:
- mStorage.insert   
select(ctx) api
Read entity data
Arguments:
-
ctx
(ubMethodParams)
Properties
-
mParams
(UBQL)
 ORM query in UBQL format
-
- Mixes In:
- mStorage.select   
update(ctx) api
Update data
Arguments:
-
ctx
(ubMethodParams)
Properties
- Mixes In:
- mStorage.update   
auth(otp, otpKind, fCheckUDataopt, checkDataopt, callopt) → Boolean
Switch session to user from OTP or execute callback in session of user from OTP
Arguments:
-
otp
(string)
-
otpKind
(string)
-
[fCheckUData]
(function)
 function for check OTP from uData -
[checkData]
(Object)
 value for check OTP from uData -
[call]
(function)
 This function will be called in user's session. If defined then restore original user session after call it.
- Deprecated:
- use authAndExecute instead
authAndExecute(otp, otpKind, callBack) → Boolean
Check given otp, and in case it is correct run callback
Arguments:
-
otp
(string)
-
otpKind
(string)
-
callBack
(function)
 This function will be called in user's session with uData parameter from otp if otp is correct.
Example
// generation otp
var userID = 100000000122,
uData = {size: {width: 100, height: 50}};
var otp = uba_otp.generateOtp('EMail', userID, uData);
// send this otp via EMail
//............................
// after receiving this otp
var isOtpCorrect = uba_otp.authAndExecute('EMail', otp, function(uData){
var params = JSON.parse(uData);
console.log('user ID is', Session.userID);//'user ID is 100000000122';
console.log('width is', params.width);//'width is 100';
}));