apostrophe-headless icon indicating copy to clipboard operation
apostrophe-headless copied to clipboard

Upload of attachments not working while logged in

Open RyamBaCo opened this issue 4 years ago • 2 comments

On our Apostrophe website we implemented Vue components interacting with apostrophe pieces using apostrophe-headless. When i'm logged in in Apostrophe and try to upload files by POST against api/v1/attachments i receive "forbidden" as response string with 403 response. when i'm not logged in everything is working fine.

On further debugging it occurs that in api.js the self.apos.permissions-check for "edit-attachment" fails. The initial can-request to apostrophe-permissions returns true, but somehow one of the "can"-listeners sets info.response to false. I currently hack-fixed it by putting

  self.apos.on("can", async function (req, action, object, info) {
      if (action === "edit-attachment" && !info.response) {
        info.response = true;
      }
    });

in my code. But I guess that this shouldn't be the solution.

RyamBaCo avatar May 08 '20 06:05 RyamBaCo

Hmm. Is workflow present?

On Fri, May 8, 2020 at 2:47 AM Ryam BaCo [email protected] wrote:

On our Apostrophe website we implemented Vue components interacting with apostrophe pieces using apostrophe-headless. When i'm logged in in Apostrophe and try to upload files by POST against api/v1/attachments i receive "forbidden" as response string with 403 response. when i'm not logged in everything is working fine.

On further debugging it occurs that in api.js the self.apos.permissions-check for "edit-attachment" fails. The initial can-request to apostrophe-permissions returns true, but somehow one of the "can"-listeners sets info.response to false. I currently hack-fixed it by putting

self.apos.on("can", async function (req, action, object, info) { if (action === "edit-attachment" && !info.response) { info.response = true; } });

in my code. But I guess that this shouldn't be the solution.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe-headless/issues/49, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH27JW65NVDAQQGCXY4STRQOTGHANCNFSM4M354GEQ .

--

THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his

boutell avatar May 08 '20 15:05 boutell

The tests on this feature do pass, so I'd recommend contributing a failing test.

On Fri, May 8, 2020 at 11:55 AM Tom Boutell [email protected] wrote:

Hmm. Is workflow present?

On Fri, May 8, 2020 at 2:47 AM Ryam BaCo [email protected] wrote:

On our Apostrophe website we implemented Vue components interacting with apostrophe pieces using apostrophe-headless. When i'm logged in in Apostrophe and try to upload files by POST against api/v1/attachments i receive "forbidden" as response string with 403 response. when i'm not logged in everything is working fine.

On further debugging it occurs that in api.js the self.apos.permissions-check for "edit-attachment" fails. The initial can-request to apostrophe-permissions returns true, but somehow one of the "can"-listeners sets info.response to false. I currently hack-fixed it by putting

self.apos.on("can", async function (req, action, object, info) { if (action === "edit-attachment" && !info.response) { info.response = true; } });

in my code. But I guess that this shouldn't be the solution.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe-headless/issues/49, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH27JW65NVDAQQGCXY4STRQOTGHANCNFSM4M354GEQ .

--

THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his

--

THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his

boutell avatar May 08 '20 15:05 boutell