diff --git a/acs-auth/dump-schema.yaml b/acs-auth/dump-schema.yaml index d9e460f0..779c97c7 100644 --- a/acs-auth/dump-schema.yaml +++ b/acs-auth/dump-schema.yaml @@ -37,4 +37,8 @@ oneOf: - type: "null" - type: object propertyNames: { format: uuid } - additionalProperties: { type: boolean } + additionalProperties: + oneOf: + - type: boolean + - type: string + enum: ["both"] diff --git a/acs-auth/lib/dump-schema.js b/acs-auth/lib/dump-schema.js index f46bd63d..cc1b6fa6 100644 --- a/acs-auth/lib/dump-schema.js +++ b/acs-auth/lib/dump-schema.js @@ -1 +1 @@ -"use strict";export const dump_schema = validate10;const schema11 = {"type":"object","required":["service","version"],"properties":{"service":{"const":"cab2642a-f7d9-42e5-8845-8f35affe1fd4"},"version":{"type":"integer"}},"oneOf":[{"type":"object","required":["version"],"additionalProperties":false,"properties":{"service":true,"version":{"const":2},"identities":{"type":"object","propertyNames":{"format":"uuid"},"additionalProperties":{"type":"object","additionalProperties":false,"properties":{"kerberos":{"type":"string"}}}},"grants":{"type":"object","propertyNames":{"format":"uuid"},"additionalProperties":{"type":"object","propertyNames":{"format":"uuid"},"additionalProperties":{"oneOf":[{"type":"null"},{"type":"object","propertyNames":{"format":"uuid"},"additionalProperties":{"type":"boolean"}}]}}}}}],"$id":"dump_schema"};const formats0 = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="dump_schema" */;let vErrors = null;let errors = 0;const _errs1 = errors;let valid0 = false;let passing0 = null;const _errs2 = errors;if(errors === _errs2){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.version === undefined) && (missing0 = "version")){const err0 = {instancePath,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}else {const _errs4 = errors;for(const key0 in data){if(!((((key0 === "service") || (key0 === "version")) || (key0 === "identities")) || (key0 === "grants"))){const err1 = {instancePath,schemaPath:"#/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;break;}}if(_errs4 === errors){if(data.version !== undefined){const _errs5 = errors;if(2 !== data.version){const err2 = {instancePath:instancePath+"/version",schemaPath:"#/oneOf/0/properties/version/const",keyword:"const",params:{allowedValue: 2},message:"must be equal to constant"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}var valid1 = _errs5 === errors;}else {var valid1 = true;}if(valid1){if(data.identities !== undefined){let data1 = data.identities;const _errs6 = errors;if(errors === _errs6){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){for(const key1 in data1){const _errs8 = errors;if(errors === _errs8){if(typeof key1 === "string"){if(!(formats0.test(key1))){const err3 = {instancePath:instancePath+"/identities",schemaPath:"#/oneOf/0/properties/identities/propertyNames/format",keyword:"format",params:{format: "uuid"},message:"must match format \""+"uuid"+"\"",propertyName:key1};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}}var valid2 = _errs8 === errors;if(!valid2){const err4 = {instancePath:instancePath+"/identities",schemaPath:"#/oneOf/0/properties/identities/propertyNames",keyword:"propertyNames",params:{propertyName: key1},message:"property name must be valid"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;break;}}if(valid2){for(const key2 in data1){let data2 = data1[key2];const _errs10 = errors;if(errors === _errs10){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){const _errs12 = errors;for(const key3 in data2){if(!(key3 === "kerberos")){const err5 = {instancePath:instancePath+"/identities/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/identities/additionalProperties/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;break;}}if(_errs12 === errors){if(data2.kerberos !== undefined){if(typeof data2.kerberos !== "string"){const err6 = {instancePath:instancePath+"/identities/" + key2.replace(/~/g, "~0").replace(/\//g, "~1")+"/kerberos",schemaPath:"#/oneOf/0/properties/identities/additionalProperties/properties/kerberos/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}}}else {const err7 = {instancePath:instancePath+"/identities/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/identities/additionalProperties/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}var valid3 = _errs10 === errors;if(!valid3){break;}}}}else {const err8 = {instancePath:instancePath+"/identities",schemaPath:"#/oneOf/0/properties/identities/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}var valid1 = _errs6 === errors;}else {var valid1 = true;}if(valid1){if(data.grants !== undefined){let data4 = data.grants;const _errs15 = errors;if(errors === _errs15){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){for(const key4 in data4){const _errs17 = errors;if(errors === _errs17){if(typeof key4 === "string"){if(!(formats0.test(key4))){const err9 = {instancePath:instancePath+"/grants",schemaPath:"#/oneOf/0/properties/grants/propertyNames/format",keyword:"format",params:{format: "uuid"},message:"must match format \""+"uuid"+"\"",propertyName:key4};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}}var valid5 = _errs17 === errors;if(!valid5){const err10 = {instancePath:instancePath+"/grants",schemaPath:"#/oneOf/0/properties/grants/propertyNames",keyword:"propertyNames",params:{propertyName: key4},message:"property name must be valid"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;break;}}if(valid5){for(const key5 in data4){let data5 = data4[key5];const _errs19 = errors;if(errors === _errs19){if(data5 && typeof data5 == "object" && !Array.isArray(data5)){for(const key6 in data5){const _errs21 = errors;if(errors === _errs21){if(typeof key6 === "string"){if(!(formats0.test(key6))){const err11 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/propertyNames/format",keyword:"format",params:{format: "uuid"},message:"must match format \""+"uuid"+"\"",propertyName:key6};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}}var valid7 = _errs21 === errors;if(!valid7){const err12 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/propertyNames",keyword:"propertyNames",params:{propertyName: key6},message:"property name must be valid"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;break;}}if(valid7){for(const key7 in data5){let data6 = data5[key7];const _errs23 = errors;const _errs24 = errors;let valid9 = false;let passing1 = null;const _errs25 = errors;if(data6 !== null){const err13 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/0/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}var _valid1 = _errs25 === errors;if(_valid1){valid9 = true;passing1 = 0;}const _errs27 = errors;if(errors === _errs27){if(data6 && typeof data6 == "object" && !Array.isArray(data6)){for(const key8 in data6){const _errs29 = errors;if(errors === _errs29){if(typeof key8 === "string"){if(!(formats0.test(key8))){const err14 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/1/propertyNames/format",keyword:"format",params:{format: "uuid"},message:"must match format \""+"uuid"+"\"",propertyName:key8};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}}var valid10 = _errs29 === errors;if(!valid10){const err15 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/1/propertyNames",keyword:"propertyNames",params:{propertyName: key8},message:"property name must be valid"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;break;}}if(valid10){for(const key9 in data6){const _errs31 = errors;if(typeof data6[key9] !== "boolean"){const err16 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key9.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/1/additionalProperties/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}var valid11 = _errs31 === errors;if(!valid11){break;}}}}else {const err17 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}var _valid1 = _errs27 === errors;if(_valid1 && valid9){valid9 = false;passing1 = [passing1, 1];}else {if(_valid1){valid9 = true;passing1 = 1;}}if(!valid9){const err18 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf",keyword:"oneOf",params:{passingSchemas: passing1},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}else {errors = _errs24;if(vErrors !== null){if(_errs24){vErrors.length = _errs24;}else {vErrors = null;}}}var valid8 = _errs23 === errors;if(!valid8){break;}}}}else {const err19 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}var valid6 = _errs19 === errors;if(!valid6){break;}}}}else {const err20 = {instancePath:instancePath+"/grants",schemaPath:"#/oneOf/0/properties/grants/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}var valid1 = _errs15 === errors;}else {var valid1 = true;}}}}}}else {const err21 = {instancePath,schemaPath:"#/oneOf/0/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}var _valid0 = _errs2 === errors;if(_valid0){valid0 = true;passing0 = 0;}if(!valid0){const err22 = {instancePath,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;validate10.errors = vErrors;return false;}else {errors = _errs1;if(vErrors !== null){if(_errs1){vErrors.length = _errs1;}else {vErrors = null;}}}if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing1;if(((data.service === undefined) && (missing1 = "service")) || ((data.version === undefined) && (missing1 = "version"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data.service !== undefined){const _errs33 = errors;if("cab2642a-f7d9-42e5-8845-8f35affe1fd4" !== data.service){validate10.errors = [{instancePath:instancePath+"/service",schemaPath:"#/properties/service/const",keyword:"const",params:{allowedValue: "cab2642a-f7d9-42e5-8845-8f35affe1fd4"},message:"must be equal to constant"}];return false;}var valid12 = _errs33 === errors;}else {var valid12 = true;}if(valid12){if(data.version !== undefined){let data9 = data.version;const _errs34 = errors;if(!(((typeof data9 == "number") && (!(data9 % 1) && !isNaN(data9))) && (isFinite(data9)))){validate10.errors = [{instancePath:instancePath+"/version",schemaPath:"#/properties/version/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid12 = _errs34 === errors;}else {var valid12 = true;}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;} \ No newline at end of file +"use strict";export const dump_schema = validate10;const schema11 = {"type":"object","required":["service","version"],"properties":{"service":{"const":"cab2642a-f7d9-42e5-8845-8f35affe1fd4"},"version":{"type":"integer"}},"oneOf":[{"type":"object","required":["version"],"additionalProperties":false,"properties":{"service":true,"version":{"const":2},"identities":{"type":"object","propertyNames":{"format":"uuid"},"additionalProperties":{"type":"object","additionalProperties":false,"properties":{"kerberos":{"type":"string"}}}},"grants":{"type":"object","propertyNames":{"format":"uuid"},"additionalProperties":{"type":"object","propertyNames":{"format":"uuid"},"additionalProperties":{"oneOf":[{"type":"null"},{"type":"object","propertyNames":{"format":"uuid"},"additionalProperties":{"oneOf":[{"type":"boolean"},{"type":"string","enum":["both"]}]}}]}}}}}],"$id":"dump_schema"};const formats0 = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="dump_schema" */;let vErrors = null;let errors = 0;const _errs1 = errors;let valid0 = false;let passing0 = null;const _errs2 = errors;if(errors === _errs2){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.version === undefined) && (missing0 = "version")){const err0 = {instancePath,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}else {const _errs4 = errors;for(const key0 in data){if(!((((key0 === "service") || (key0 === "version")) || (key0 === "identities")) || (key0 === "grants"))){const err1 = {instancePath,schemaPath:"#/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;break;}}if(_errs4 === errors){if(data.version !== undefined){const _errs5 = errors;if(2 !== data.version){const err2 = {instancePath:instancePath+"/version",schemaPath:"#/oneOf/0/properties/version/const",keyword:"const",params:{allowedValue: 2},message:"must be equal to constant"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}var valid1 = _errs5 === errors;}else {var valid1 = true;}if(valid1){if(data.identities !== undefined){let data1 = data.identities;const _errs6 = errors;if(errors === _errs6){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){for(const key1 in data1){const _errs8 = errors;if(errors === _errs8){if(typeof key1 === "string"){if(!(formats0.test(key1))){const err3 = {instancePath:instancePath+"/identities",schemaPath:"#/oneOf/0/properties/identities/propertyNames/format",keyword:"format",params:{format: "uuid"},message:"must match format \""+"uuid"+"\"",propertyName:key1};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}}var valid2 = _errs8 === errors;if(!valid2){const err4 = {instancePath:instancePath+"/identities",schemaPath:"#/oneOf/0/properties/identities/propertyNames",keyword:"propertyNames",params:{propertyName: key1},message:"property name must be valid"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;break;}}if(valid2){for(const key2 in data1){let data2 = data1[key2];const _errs10 = errors;if(errors === _errs10){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){const _errs12 = errors;for(const key3 in data2){if(!(key3 === "kerberos")){const err5 = {instancePath:instancePath+"/identities/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/identities/additionalProperties/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;break;}}if(_errs12 === errors){if(data2.kerberos !== undefined){if(typeof data2.kerberos !== "string"){const err6 = {instancePath:instancePath+"/identities/" + key2.replace(/~/g, "~0").replace(/\//g, "~1")+"/kerberos",schemaPath:"#/oneOf/0/properties/identities/additionalProperties/properties/kerberos/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}}}else {const err7 = {instancePath:instancePath+"/identities/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/identities/additionalProperties/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}var valid3 = _errs10 === errors;if(!valid3){break;}}}}else {const err8 = {instancePath:instancePath+"/identities",schemaPath:"#/oneOf/0/properties/identities/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}var valid1 = _errs6 === errors;}else {var valid1 = true;}if(valid1){if(data.grants !== undefined){let data4 = data.grants;const _errs15 = errors;if(errors === _errs15){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){for(const key4 in data4){const _errs17 = errors;if(errors === _errs17){if(typeof key4 === "string"){if(!(formats0.test(key4))){const err9 = {instancePath:instancePath+"/grants",schemaPath:"#/oneOf/0/properties/grants/propertyNames/format",keyword:"format",params:{format: "uuid"},message:"must match format \""+"uuid"+"\"",propertyName:key4};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}}var valid5 = _errs17 === errors;if(!valid5){const err10 = {instancePath:instancePath+"/grants",schemaPath:"#/oneOf/0/properties/grants/propertyNames",keyword:"propertyNames",params:{propertyName: key4},message:"property name must be valid"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;break;}}if(valid5){for(const key5 in data4){let data5 = data4[key5];const _errs19 = errors;if(errors === _errs19){if(data5 && typeof data5 == "object" && !Array.isArray(data5)){for(const key6 in data5){const _errs21 = errors;if(errors === _errs21){if(typeof key6 === "string"){if(!(formats0.test(key6))){const err11 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/propertyNames/format",keyword:"format",params:{format: "uuid"},message:"must match format \""+"uuid"+"\"",propertyName:key6};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}}var valid7 = _errs21 === errors;if(!valid7){const err12 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/propertyNames",keyword:"propertyNames",params:{propertyName: key6},message:"property name must be valid"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;break;}}if(valid7){for(const key7 in data5){let data6 = data5[key7];const _errs23 = errors;const _errs24 = errors;let valid9 = false;let passing1 = null;const _errs25 = errors;if(data6 !== null){const err13 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/0/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}var _valid1 = _errs25 === errors;if(_valid1){valid9 = true;passing1 = 0;}const _errs27 = errors;if(errors === _errs27){if(data6 && typeof data6 == "object" && !Array.isArray(data6)){for(const key8 in data6){const _errs29 = errors;if(errors === _errs29){if(typeof key8 === "string"){if(!(formats0.test(key8))){const err14 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/1/propertyNames/format",keyword:"format",params:{format: "uuid"},message:"must match format \""+"uuid"+"\"",propertyName:key8};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}}var valid10 = _errs29 === errors;if(!valid10){const err15 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/1/propertyNames",keyword:"propertyNames",params:{propertyName: key8},message:"property name must be valid"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;break;}}if(valid10){for(const key9 in data6){let data7 = data6[key9];const _errs31 = errors;const _errs32 = errors;let valid12 = false;let passing2 = null;const _errs33 = errors;if(typeof data7 !== "boolean"){const err16 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key9.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/1/additionalProperties/oneOf/0/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}var _valid2 = _errs33 === errors;if(_valid2){valid12 = true;passing2 = 0;}const _errs35 = errors;if(typeof data7 !== "string"){const err17 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key9.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/1/additionalProperties/oneOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(!(data7 === "both")){const err18 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key9.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/1/additionalProperties/oneOf/1/enum",keyword:"enum",params:{allowedValues: schema11.oneOf[0].properties.grants.additionalProperties.additionalProperties.oneOf[1].additionalProperties.oneOf[1].enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}var _valid2 = _errs35 === errors;if(_valid2 && valid12){valid12 = false;passing2 = [passing2, 1];}else {if(_valid2){valid12 = true;passing2 = 1;}}if(!valid12){const err19 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key9.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/1/additionalProperties/oneOf",keyword:"oneOf",params:{passingSchemas: passing2},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}else {errors = _errs32;if(vErrors !== null){if(_errs32){vErrors.length = _errs32;}else {vErrors = null;}}}var valid11 = _errs31 === errors;if(!valid11){break;}}}}else {const err20 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}var _valid1 = _errs27 === errors;if(_valid1 && valid9){valid9 = false;passing1 = [passing1, 1];}else {if(_valid1){valid9 = true;passing1 = 1;}}if(!valid9){const err21 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1")+"/" + key7.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/additionalProperties/oneOf",keyword:"oneOf",params:{passingSchemas: passing1},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}else {errors = _errs24;if(vErrors !== null){if(_errs24){vErrors.length = _errs24;}else {vErrors = null;}}}var valid8 = _errs23 === errors;if(!valid8){break;}}}}else {const err22 = {instancePath:instancePath+"/grants/" + key5.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/oneOf/0/properties/grants/additionalProperties/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}var valid6 = _errs19 === errors;if(!valid6){break;}}}}else {const err23 = {instancePath:instancePath+"/grants",schemaPath:"#/oneOf/0/properties/grants/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}var valid1 = _errs15 === errors;}else {var valid1 = true;}}}}}}else {const err24 = {instancePath,schemaPath:"#/oneOf/0/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}var _valid0 = _errs2 === errors;if(_valid0){valid0 = true;passing0 = 0;}if(!valid0){const err25 = {instancePath,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;validate10.errors = vErrors;return false;}else {errors = _errs1;if(vErrors !== null){if(_errs1){vErrors.length = _errs1;}else {vErrors = null;}}}if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing1;if(((data.service === undefined) && (missing1 = "service")) || ((data.version === undefined) && (missing1 = "version"))){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data.service !== undefined){const _errs37 = errors;if("cab2642a-f7d9-42e5-8845-8f35affe1fd4" !== data.service){validate10.errors = [{instancePath:instancePath+"/service",schemaPath:"#/properties/service/const",keyword:"const",params:{allowedValue: "cab2642a-f7d9-42e5-8845-8f35affe1fd4"},message:"must be equal to constant"}];return false;}var valid13 = _errs37 === errors;}else {var valid13 = true;}if(valid13){if(data.version !== undefined){let data9 = data.version;const _errs38 = errors;if(!(((typeof data9 == "number") && (!(data9 % 1) && !isNaN(data9))) && (isFinite(data9)))){validate10.errors = [{instancePath:instancePath+"/version",schemaPath:"#/properties/version/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid13 = _errs38 === errors;}else {var valid13 = true;}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;} \ No newline at end of file diff --git a/acs-auth/lib/loader.js b/acs-auth/lib/loader.js index 04087036..b3fb6be7 100644 --- a/acs-auth/lib/loader.js +++ b/acs-auth/lib/loader.js @@ -36,8 +36,16 @@ export class Loader { .map(([p, t]) => [p, t ?? { [Special.Wildcard]: false }]) .flatMap(([permission, targs]) => Object.entries(targs) - .flatMap(([target, plural]) => - ({ principal, permission, target, plural })))); + .flatMap(([target, plural]) => { + if (plural === "both"){ + return [ + { principal, permission, target, plural: true }, + { principal, permission, target, plural: false } + ]; + } + return { principal, permission, target, plural }; + }) + )); const permitted = { acl: await data.check_targ(req.auth, Perm.WriteACL, true), id: await data.check_targ(req.auth, Perm.WriteACL, true), diff --git a/acs-service-setup/dumps/data-access.yaml b/acs-service-setup/dumps/data-access.yaml new file mode 100644 index 00000000..741360ce --- /dev/null +++ b/acs-service-setup/dumps/data-access.yaml @@ -0,0 +1,164 @@ + +service: !u UUIDs.Service.ConfigDB +version: 2 +objects: + + !u UUIDs.Class.Service: + !u DataAccess.Service.DataAccess: + name: "Data Access service" + + !u Auth.Class.ServiceRole: + !u DataAccess.Requirement.ServiceRole: + name: "Data Access service role" + subclassOf: + - !u Auth.Class.CentralService + + !u ConfigDB.Class.R3Class: + !u DataAccess.Group.DatasetGroup: + name: "Dataset group" + !u DataAccess.Group.DatasetRoleGroup: + name: "Dataset role" + subclassOf: + - !u DataAccess.Group.DatasetGroup + !u DataAccess.Group.StructuralDatasetType: + name: "Structural dataset type" + subclassOf: + - !u DataAccess.Group.DatasetGroup + !u DataAccess.Group.FunctionalDatasetGroup: + name: "Functional dataset group" + subclassOf: + - !u DataAccess.Group.DatasetGroup + + !u DataAccess.Group.DatasetGroup: + !u DataAccess.Class.Dataset: + name: "Dataset" + + !u DataAccess.Group.StructuralDatasetType: + !u DataAccess.Class.Sparkplug: + name: "Sparkplug dataset" + subclassOf: + - !u DataAccess.Class.Dataset + !u DataAccess.Class.Session: + name: "Session dataset" + subclassOf: + - !u DataAccess.Class.Dataset + !u DataAccess.Class.Union: + name: "Union dataset" + subclassOf: + - !u DataAccess.Class.Dataset + + + !u DataAccess.Group.FunctionalDatasetGroup: + !u DataAccess.Class.Published: + name: "Published dataset" + subclassOf: + - !u DataAccess.Class.Dataset + !u DataAccess.Class.Partial: + name: "Partial dataset" + subclassOf: + - !u DataAccess.Class.Dataset + !u DataAccess.Class.MESDataset: + name: "MES dataset" + subclassOf: + - !u DataAccess.Class.Dataset + !u DataAccess.Class.Equipment: + name: "MES equipment" + subclassOf: + - !u DataAccess.Class.MESDataset + !u DataAccess.Class.WorkOrder: + name: "MES work order" + subclassOf: + - !u DataAccess.Class.MESDataset + !u DataAccess.Class.Product: + name: "MES product" + subclassOf: + - !u DataAccess.Class.MESDataset + !u DataAccess.Class.Operation: + name: "MES operation" + subclassOf: + - !u DataAccess.Class.MESDataset + + !u ConfigDB.Class.R1Class: + !u DataAccess.Class.Measurement: + name: "Measurement" + !u DataAccess.Class.MES: + name: "MES" + + !u DataAccess.App.DatasetDefinition: + name: "Dataset definition" + subclassOf: + - !u UUIDs.Class.App + !u DataAccess.App.DatasetMetadata: + name: "Dataset metadata" + subclassOf: + - !u UUIDs.Class.App + + !u DataAccess.App.DatasetDefinition: + !u DataAccess.App.SparkplugSrc: + name: "Sparkplug source" + !u DataAccess.App.UnionComponents: + name: "Union components" + !u DataAccess.App.SessionLimits: + name: "Session limits" + + !u DataAccess.App.DatasetMetadata: + !u DataAccess.App.MESIdentifiers: + name: "MES identifiers" + + !u UUIDs.Class.Special: + !u DataAccess.Special.InvalidDataset: + name: "Structurally invalid dataset" + +# Permissions + !u Auth.Class.ServicePerms: + !u DataAccess.Perm.All: + name: "Data Access permission" + subclassOf: + - !u Auth.Class.Permission + + !u DataAccess.Perm.All: + !u DataAccess.Perm.CreateDataset: + name: "Create dataset" + !u DataAccess.Perm.IncludeInUnion: + name: "Include in union" + !u DataAccess.Perm.ReadDataset: + name: "Read dataset" + !u DataAccess.Perm.UseForSession: + name: "Use for session" + !u DataAccess.Perm.EditDataset: + name: "Edit dataset" + !u DataAccess.Perm.UseSparkplug: + name: "Use Sparkplug data" + + +--- +service: !u UUIDs.Service.Authentication +version: 2 +grants: + !u DataAccess.Requirement.ServiceRole: + !u UUIDs.Permission.Directory.AdvertiseService: + !u DataAccess.Service.DataAccess: false + !u UUIDs.Permission.Auth.ReadACL: + !u DataAccess.Perm.All: true + !u UUIDs.Permission.ConfigDB.ReadConfig: + !u DataAccess.App.DatasetDefinition: true + !u DataAccess.App.DatasetMetadata: true + !u UUIDs.Permission.ConfigDB.WriteConfig: + !u DataAccess.App.DatasetDefinition: true + !u ConfigDB.Perm.CreateObject: + !u DataAccess.Group.StructuralDatasetType: true + !u ConfigDB.Perm.ReadMembers: + !u DataAccess.App.DatasetDefinition: false + !u DataAccess.App.DatasetMetadata: false + !u DataAccess.Group.StructuralDatasetType: "both" + !u DataAccess.Group.FunctionalDatasetGroup: "both" + !u ConfigDB.Perm.WriteMembers: + !u DataAccess.Group.StructuralDatasetType: true + !u ConfigDB.Perm.WriteMemberships: + !u DataAccess.Class.Dataset: true + !u ConfigDB.Perm.WriteSubclasses: + !u DataAccess.Class.Dataset: true + !u ConfigDB.Perm.WriteSuperclasses: + !u DataAccess.Class.Dataset: true + + diff --git a/acs-service-setup/lib/uuids.js b/acs-service-setup/lib/uuids.js index 42b1590f..37d95a0e 100644 --- a/acs-service-setup/lib/uuids.js +++ b/acs-service-setup/lib/uuids.js @@ -421,6 +421,62 @@ export const Git = { }, }; +export const DataAccess = { + App: { + DatasetDefinition: "eae2d4ae-164d-4dc6-b646-7e0320057bd9", + DatasetMetadata: "e3b9fd2c-9de1-470b-9675-739e2a55b77f", + SparkplugSrc: "f5d550c4-2831-11f1-b0b0-83fda3035799", + UnionComponents: "1c4ca454-de38-44d9-92fb-aa5218bfa257", + SessionLimits: "8754c000-3778-4ae6-b2b8-bbcd959bb775", + MESIdentifiers: "af178f0c-3b1e-44f2-9724-5cf06e8fd056", + }, + + Class: { + Measurement: "cce0ac4e-b5ba-4837-b45d-c74df55aa2d7", + Dataset: "c31d3cbd-01cd-4833-8014-c4512aef1e5c", + Sparkplug: "8d25845e-2831-11f1-ad53-3be499ddf442", + Session: "2f555be8-e7fc-4fb0-b62f-809cefd8a141", + Union: "c57a42a9-348c-4972-a05b-9082c20f2afc", + Published: "414d2d10-6be8-4c27-8e9f-c716ef5432b9", + Partial: "6c583d11-9a88-4bc1-b77c-81b01e9c9827", + MESDataset: "586205bf-81c6-4091-9d2c-f3c0465ebdc4", + Equipment: "4c93ddc1-e610-4efe-91e3-a355f9ba1a09", + WorkOrder: "b416e44c-c57e-4486-9431-64c425f1b2c6", + Product: "4a089748-b26b-4f12-8f1a-164bfba97809", + Operation: "bd0354eb-b8f7-4bd9-8407-0588e545603c", + MES: "2c691583-89fe-4421-bf2c-64e34e663711" + }, + + Group: { + DatasetGroup: "17e37253-8626-4031-b217-28c6a03e91c1", + DatasetRoleGroup: "56c52f70-0649-4962-8526-9ec9d1c85ca4", + StructuralDatasetType: "70ff7bea-bb2d-48c2-88fd-4f7a79b1aa3c", + FunctionalDatasetGroup: "86e5b048-e956-4820-939e-3abf3eda4e03", + }, + + Service: { + DataAccess: "06cee697-29d3-4972-9479-bc392e24946e" + }, + + Special: { + InvalidDataset: "696396a0-2831-11f1-9b12-33d63b8c5115", + }, + + Requirement: { + ServiceRole: "dd18050c-a9ab-4287-8af2-e983f20e89c8" + }, + + Perm: { + All: "1e3cb5aa-a3f7-4bb6-9ef1-c3bc08427f60", + CreateDataset: "2d666b41-7a0d-4845-ad59-3113f25b469a", + IncludeInUnion: "94d51085-af83-4796-8059-fcd578e3f572", + ReadDataset: "ec48462e-37eb-4f56-8efa-83d813e85559", + UseForSession: "c089b9a9-06cd-4211-94fc-9ad52a759987", + EditDataset: "af06b9e5-456a-43e4-b636-5b17de28fc7f", + UseSparkplug: "788b049c-2831-11f1-99fd-2b0bf86d6f77", + } +} + export const UNS = { Group: { Sparkplug: "e414d355-b991-429b-8f5d-97e823ff71f5", @@ -434,3 +490,4 @@ export const UNS = { ReadEntireUNS: "ffa40b36-3a61-4545-832a-2d1e8b860d63", }, }; + diff --git a/lib/js-service-client/lib/uuids.js b/lib/js-service-client/lib/uuids.js index 3ebe5946..164329aa 100644 --- a/lib/js-service-client/lib/uuids.js +++ b/lib/js-service-client/lib/uuids.js @@ -87,6 +87,7 @@ export const Service = { Clusters: "2706aa43-a826-441e-9cec-cd3d4ce623c2", Manager: "619eecab-742d-4824-8b97-bcae472e5c04", Files: 'a2a6efc5-9793-4486-9fd9-7caf9e3b5451', + DataAccess: "06cee697-29d3-4972-9479-bc392e24946e" }; /* This list is not meant to be exhaustive, but these are commonly used