services/ThingService.js
function createAccessPolicy(thingId) {
  const thingPolicy = {
    id: thingId + "-" + thingId + "-cru-policy",
    effect: "allow",
    actions: ["dcd:actions:create", "dcd:actions:read", "dcd:actions:update"],
    subjects: ["dcd:things:" + thingId],
    resources: [
      "dcd:things:" + thingId,
      "dcd:things:" + thingId + ":properties",
      "dcd:things:" + thingId + ":properties:<.*>"
    ]
  };
  logger.debug("Thing policy: " + JSON.stringify(thingPolicy));
  return policies.create(thingPolicy);
}
function createAccessPolicy(thingId) {
  const thingPolicy = {
    id: thingId + "-" + thingId + "-cru-policy",
    effect: "allow",
    actions: ["dcd:actions:create", "dcd:actions:read", "dcd:actions:update"],
    subjects: ["dcd:things:" + thingId],
    resources: [
      "dcd:things:" + thingId,
      "dcd:things:" + thingId + ":properties",
      "dcd:things:" + thingId + ":properties:<.*>"
    ]
  };
  logger.debug("Thing policy: " + JSON.stringify(thingPolicy));
  return policies.create(thingPolicy);
}
function createAccessPolicy ( thingId ) { const thingPolicy = { id : thingId + "-" + thingId + "-cru-policy" , effect : "allow" , actions : [ "dcd:actions:create" , "dcd:actions:read" , "dcd:actions:update" ] , subjects : [ "dcd:things:" + thingId ] , resources : [ "dcd:things:" + thingId , "dcd:things:" + thingId + ":properties" , "dcd:things:" + thingId + ":properties:<.*>" ] } ; logger . debug ( "Thing policy: " + JSON . stringify ( thingPolicy ) ) ; return policies . create ( thingPolicy ) ; }
Generate an access policy for a thing.
@param thingId
@returns {Promise<>}
Generate an access policy for a thing .