Chinese Documentation : Model property reference

Icon

This reference information is being moved to the API documentation. Until that is complete, it is provided here.

Application model properties

The application model represents the metadata for a client application that has its own identity and associated configuration with the LoopBack server.

Basic properties

Each application has the basic properties described in the following table.

PropertyTypeRequired?Description
id String Automatically generated ID
nameStringYesName of the application 
descriptionStringNoDescription of the application
iconString URL of the icon
statusString Status of the application, such as production/sandbox/disabled
createdDate Timestamp of the record being created
modifiedDate Timestamp of the record being modified
ownerString User ID of the developer who registers the application

collaborators

[String] 

Array of user IDs who have permissions to work on this application.

NOTE: Currently this property does not do anything; the feature is not yet implemented.

Authorization properties

The following table describes application oAuth 2.0 settings.

PropertyTypeDescription
urlStringThe application URL
callbackUrls[String]An array of pre-registered callback URLs for oAuth 2.0
permissions Array of oAuth 2.0 scopes that can be requested by the application

Security properties

The following keys are automatically generated by the application creation process. They can be reset upon request.

PropertyTypeDescription
 clientKey  Secret for mobile clients
 javaScriptKey  Secret for JavaScript clients
restApiKey Secret for REST APIs
windowsKey Secret for Windows applications
masterKey Secret for REST APIS. It bypasses model level permissions 

Push notification properties

The application can be configured to support multiple methods of push notifications.  All push properties are defined within the "pushSettings" key.  Within this:

  • apns key contains properties for Apple Push Notification Service for iOS devices
  • gcm key contains properties for Google Cloud Messaging for Android devices.

Properties for apns:

PropertyTypeDescription
 certData  
keyData  
productionBoolean 
pushOptionsObject
  • port: Number (default is 2195)
feedbackOptionsObject
  • batchFeedback: Boolean
  • interval: Number
  • port: Number (default is 2196)

Properties for gcm:

PropertyTypeDescription
 serverApiKey  

For example, from the loopback-push-notification-example application:

angular.js
  $scope.create = function () {
    $http.post('/api/applications',
      {
        name: $scope.name,
        description: $scope.description,
        pushSettings: {
          apns: {
            certData: $scope.certData,
            keyData: $scope.keyData
          },
          gcm: {
            serverApiKey: $scope.gcmKey
          }
        }
      })
      .success(function (data, status, headers) {
        // console.log(data, status);
        $scope.id = 'Application Id: ' + data.id;
        $scope.restApiKey = 'Application Key: ' + data.restApiKey;
      });
  };

Authentication scheme properties

PropertyTypeDescription
 authenticationEnabled  
 anonymousAllowed  
authenticationSchemes  
schemeStringName of the authentication scheme, such as local, facebook, google, twitter, linkedin, github
credential Scheme-specific credentials

ACL model

Properties

The following table describes the properties of the ACL object:

PropertyTypeDescription
modelStringName of the model
propertyString

name of the property, method, scope, or relation

 accessTypeString Type of access: READ, WRITE, or EXECUTE
 permissionString

 Type of permission: ALLOW, or DENY

principalTypeString

Type of principal, for example application, user, role

principalIdString 

Role model

The following table describes the properties of the role model:

PropertyTypeDescription
idStringRole ID
nameStringRole name
descriptionStringDescription of the role
createdDateTimestamp of creation date
modifiedDateTimestamp of modification date

LoopBack defines some special roles:

IdentifierNameDescription
Role.OWNER$ownerOwner of the object
Role.RELATED$relatedAny user with a relationship to the object
Role.AUTHENTICATED$authenticatedAuthenticated user
Role.UNAUTHENTICATED$unauthenticatedUnauthenticated user
Role.EVERYONE$everyoneEveryone

Scope model

REVIEW COMMENT from $paramName
Is this correct? How can we get these into the JSDocs, assuming we should?

The following table describes the properties of the Scope model:

PropertyTypeDescription
nameStringScope name; required
descriptionStringDescription of the scope

RoleMapping

A RoleMapping entry maps one or more principals to one role.  A RoleMapping entry belongs to one role, based on the roleId property.

The following table describes the properties of the roleMapping model:

PropertyTypeDescription
idStringID
roleIdStringRole ID
principalTypeStringPrincipal type, such as user, application, or role
principalIdStringPrincipal ID