diff --git a/packages/arcgis-rest-items/src/helpers.ts b/packages/arcgis-rest-items/src/helpers.ts index 8a3a370611..bad74fa146 100644 --- a/packages/arcgis-rest-items/src/helpers.ts +++ b/packages/arcgis-rest-items/src/helpers.ts @@ -31,6 +31,11 @@ export interface IItemResourceRequestOptions extends IItemIdRequestOptions { * Text input to be added as a file resource. */ content?: string; + /** + * Set file resource to be private regardless of the item access level, or revert it by setting + * it to inherit which makes the item resource have the same access as the item. + */ + access?: "private" | "inherit"; resource?: any; } diff --git a/packages/arcgis-rest-items/test/add.test.ts b/packages/arcgis-rest-items/test/add.test.ts index 452d573f9c..62231f4134 100644 --- a/packages/arcgis-rest-items/test/add.test.ts +++ b/packages/arcgis-rest-items/test/add.test.ts @@ -187,6 +187,7 @@ describe("search", () => { id: "3ef", // File() is only available in the browser resource: file, + access: "private", name: "thebigkahuna", ...MOCK_USER_REQOPTS }) @@ -203,6 +204,7 @@ describe("search", () => { expect(params.get("token")).toEqual("fake-token"); expect(params.get("f")).toEqual("json"); expect(params.get("file")).toEqual(file); + expect(params.get("access")).toEqual("private"); expect(params.get("fileName")).toEqual("thebigkahuna"); } diff --git a/packages/arcgis-rest-items/test/update.test.ts b/packages/arcgis-rest-items/test/update.test.ts index 80531b9ae8..6a191058b1 100644 --- a/packages/arcgis-rest-items/test/update.test.ts +++ b/packages/arcgis-rest-items/test/update.test.ts @@ -155,6 +155,7 @@ describe("search", () => { owner: "dbouwman", name: "image/banner.png", content: "jumbotron", + access: "inherit", ...MOCK_USER_REQOPTS }) .then(response => { @@ -168,6 +169,7 @@ describe("search", () => { encodeParam("fileName", "image/banner.png") ); expect(options.body).toContain(encodeParam("text", "jumbotron")); + expect(options.body).toContain(encodeParam("access", "inherit")); expect(options.body).toContain(encodeParam("token", "fake-token")); done(); })