Skip to content Skip to sidebar Skip to footer

Extend Built-in User Model To Support More Properties And Behaviors In Loopback

I want a model to represent a profile in my loopback app. But, the built-in User model found in loopback only have the following properties username password realm emailVerified

Solution 1:

It was better if you have added your code for better answer according to your question but you can check this site which talks about customizing the built-in user model and also this. I hope this answers your question.

Solution 2:

Create a new model common/models/user.json

{
  "name": "user",
  "base": "User",
  "idInjection": true,
  "properties": {
      "firstName"{
         "type":"string",
         "required":true
       }
   }
  "restrictResetPasswordTokenScope": true,
  "emailVerificationRequired": true,
  "validations": [],
  "relations": {},
  "acls": [
    {
      "principalType": "ROLE",
      "principalId": "$everyone",
      "accessType": "READ",
      "permission": "ALLOW"
    }
  ],
  "methods": []
}

Add this to model-config.json

"user":"dataSource":"yourDataSource"}

Hope this works for you

Post a Comment for "Extend Built-in User Model To Support More Properties And Behaviors In Loopback"