templates/sync-function/authorization-module.js
function appendToAuthorizationList(allAuthorizations, authorizationsToAdd) {
    if (!utils.isValueNullOrUndefined(authorizationsToAdd)) {
      if (Array.isArray(authorizationsToAdd)) {
        for (var i = 0; i < authorizationsToAdd.length; i++) {
          var authorization = authorizationsToAdd[i];
          if (allAuthorizations.indexOf(authorization) < 0) {
            allAuthorizations.push(authorization);
          }
        }
      } else if (allAuthorizations.indexOf(authorizationsToAdd) < 0) {
        allAuthorizations.push(authorizationsToAdd);
      }
    }
  }
function appendToAuthorizationList(allAuthorizations, authorizationsToAdd) {
    if (!utils.isValueNullOrUndefined(authorizationsToAdd)) {
      if (Array.isArray(authorizationsToAdd)) {
        for (var i = 0; i < authorizationsToAdd.length; i++) {
          var authorization = authorizationsToAdd[i];
          if (allAuthorizations.indexOf(authorization) < 0) {
            allAuthorizations.push(authorization);
          }
        }
      } else if (allAuthorizations.indexOf(authorizationsToAdd) < 0) {
        allAuthorizations.push(authorizationsToAdd);
      }
    }
  }
A document definition may define its authorizations (channels, roles or users) for each operation type (view, add, replace, delete or write) as either a string or an array of strings. In either case, add them to the list if they are not already present.