services/ThingService.js
function createOwnerAccessPolicy(thingId, subject) {
  const thingOwnerPolicy = {
    id: thingId + "-" + subject + "-clrud-policy",
    effect: "allow",
    actions: [
      "dcd:actions:create",
      "dcd:actions:list",
      "dcd:actions:read",
      "dcd:actions:update",
      "dcd:actions:delete"
    ],
    subjects: [subject],
    resources: [
      "dcd:things:" + thingId,
      "dcd:things:" + thingId + ":properties",
      "dcd:things:" + thingId + ":properties:<.*>"
    ]
  };
  return policies.create(thingOwnerPolicy);
}
function createOwnerAccessPolicy(thingId, subject) {
  const thingOwnerPolicy = {
    id: thingId + "-" + subject + "-clrud-policy",
    effect: "allow",
    actions: [
      "dcd:actions:create",
      "dcd:actions:list",
      "dcd:actions:read",
      "dcd:actions:update",
      "dcd:actions:delete"
    ],
    subjects: [subject],
    resources: [
      "dcd:things:" + thingId,
      "dcd:things:" + thingId + ":properties",
      "dcd:things:" + thingId + ":properties:<.*>"
    ]
  };
  return policies.create(thingOwnerPolicy);
}
function createOwnerAccessPolicy ( thingId , subject ) { const thingOwnerPolicy = { id : thingId + "-" + subject + "-clrud-policy" , effect : "allow" , actions : [ "dcd:actions:create" , "dcd:actions:list" , "dcd:actions:read" , "dcd:actions:update" , "dcd:actions:delete" ] , subjects : [ subject ] , resources : [ "dcd:things:" + thingId , "dcd:things:" + thingId + ":properties" , "dcd:things:" + thingId + ":properties:<.*>" ] } ; return policies . create ( thingOwnerPolicy ) ; }
Generate an access policy for the owner of a thing.
@param thingId
@param subject
@returns {Promise<>}
Generate an access policy for the owner of a thing .