uba_user_ns

@unitybase/uba~ uba_user_ns

Users

Constructor

new uba_user_ns()

Mixes In:
mStorage    unity   

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:
  1. ctx (ubMethodParams)
Mixes In:
mStorage.addNew   

delete(ctx) api

Delete data
Arguments:
  1. ctx (ubMethodParams)
    Properties
    1. mParams.execParams.ID (number)  element ID to be deleted
Mixes In:
mStorage.delete   

insert(ctx) api

Insert new row to the entity.
Arguments:
  1. ctx (ubMethodParams)
    Properties
    1. mParams.execParams (Object|TubList)  Object keys is entity attributes names, key values is a value to be inserted
Mixes In:
mStorage.insert   

select(ctx) api

Read entity data
Arguments:
  1. ctx (ubMethodParams)
    Properties
    1. mParams (UBQL)  ORM query in UBQL format
Mixes In:
mStorage.select   

update(ctx) api

Update data
Arguments:
  1. ctx (ubMethodParams)
    Properties
    1. mParams.execParams (Object|TubList)  Object keys is entity attributes names, key values is a value to be inserted
      Properties
      1. ID (number)  element ID to be updated
Mixes In:
mStorage.update   

changeLanguage(ctxt) api

Change (or set) current user language. After call to this method UI must logout user and reload itself.
Arguments:
  1. ctxt (ubMethodParams)
    Properties
    1. mParams.newLang (String)  new user language

changePassword(userID, userName, password, needChangePasswordopt, oldPwdopt)

Change user password
Arguments:
  1. userID (Number)
  2. userName (String)  Either userName or userID must be specified
  3. password (String)
  4. [needChangePassword=false] (Boolean)  If true the password will by expired
  5. [oldPwd] (String)  Optional for optimisation

publicRegistration(fake, req, resp) api

Two-step new user public registration rest endpoint. Optionaly can use google Re-captcha. To enable re-captcha on server side provide a valid re-captcha SECRET in serverConfig.application.customSettings.reCAPTCHA.secretKey application config.

1-st step: web page pass a registration parameters as JSON:

 POST /rest/uba_user/publicRegistration
 {email: "<email>", phone: "", utmSource: '', utmCampaign: '', recaptca: "googleRecaptchaValue"}

Server will:

  • create a new uba_user (in pending state isPending===true) and generate a password for user
  • generate OTP, and put a optional utmSource and utmCampaign parameters to the OTP uData
  • create a e-mail using using report code, provided by uba.user.publicRegistrationReportCode ubs_setting key. Report take a parameters {login, password, activateUrl, appConfig}
  • schedule a confirmation e-mail for user

2-nd step: user follow the link from e-mail

 GET /rest/uba_user/publicRegistration?otp=<one time pwd value>&login=<user_login>

Server will:

  • check the provided OTP and if it is valud
  • remove a pending from uba_user row
  • fire a registration event for Session

Access to endpoint is restricted by default. To enable public registration developer should grant ELS access for uba_user.publicRegistration method to Anonymous role.

Arguments:
  1. fake
  2. req (THTTPRequest)
  3. resp (THTTPResponse)