0

What I am needing help with is getting $2sxc().data().update() [I do have the proper info inside the ()s, just left it out for readability] to function for accounts in roles given view permissions to a page. Everything works when I am logged in with my admin account, but when I test it on my testing account it just throws a 400 error in the console for the post to the API before immediately refreshing the page. The command $2sxc().manage().run() with action: edit and new both work fine for the test account.

I have the features PublicEditForm and PublicUploadFiles enabled in the global apps management, and have added a permission on the content-type granting Edit (Create, Read, Update, Delete) on the View condition which is what got $2sxc().manage().run() working on the test account, and in the view file GetService<IPageService>().Activate("2sxc.JsCms"); and GetService<IPageService>().Activate("2sxc.JsCore"); even though "2sxc.JsCms" is supposed to include it already. It seems like I need to add another permission or grant a different option other than Edit (Create, Read, Update, Delete), but the other options don't appear to be correct for this.

Some extra background info in case it helps: The buttons calling $2sxc().data().update() are there to update a status field for the user. This isn't a public page as it is locked down to only be viewable by users in a specific role. The site is running 2sxc v13.12.1LTS.

  • I have to look into this, could be a bug... – iJungleBoy Aug 09 '22 at 16:24
  • I checked the tutorial - there the permissions were set incorrectly and now allow ananymous to do their thing. So there it works now. Maybe check v14.07.05 (to be released soon) in case it fixes anything. See also https://2sxc.org/dnn-tutorials/en/razor/js300/page – iJungleBoy Aug 15 '22 at 15:18
  • Can you link that tutorial you mentioned? I looked into the other tutorial and didn't see anything different than what I was doing except I didn't use turnOn. Also, the project is on an intranet site on DNN v8.00.04 running 2sxc 13.12.1 LTS. Because of other apps and custom code we are not currently able to upgrade Dnn past v8.x. If you are fixing this in 14.7.5 we need the fix applied to v13 LTS as well. – Accuraty-Jared Aug 17 '22 at 17:38
  • The sample I fixed was the js300 tutorial already linked above. The permissions had been set incorrectly. I didn't patch 2sxc or anything. v13 LTS should work just as well. – iJungleBoy Aug 19 '22 at 06:32
  • Maybe you could specify better where you're stuck. Basically there are 3 or 4 things that must work depending on what you're trying to achieve. So first there must be a call to the REST api and the REST API must accept it. Is that happening, or not? Is the URL always right? If not, the context is missing... If I know exactly which part isn't working I can help. – iJungleBoy Aug 19 '22 at 06:33
  • Appreciate the help. The REST api is not accepting the command when logged in with a non-superuser account. It just returns a 400 error without the update being applied. Since the superuser account works as expected I would have to be missing some permissions or required features. The "Update Poems" button does exactly what I am trying to accomplish. What permissions and features need to be set for that to work? – Accuraty-Jared Aug 22 '22 at 21:45
  • I had to put the print-screen in the answer below... – iJungleBoy Aug 24 '22 at 06:35

1 Answers1

1

With these permissions (Anonymous, create/read/delete) should work

enter image description here

iJungleBoy
  • 5,325
  • 1
  • 9
  • 21
  • Updating the Condition from View to Anonymous (any user) got everything working. Any idea why View wasn't working? The role had view and edit permissions on the page, and the module was set to inherit permissions. Would we have needed to add the role directly to the module permissions with "View" being set for the 2sxc permission to work? – Accuraty-Jared Aug 25 '22 at 20:33
  • I don't know, it could be a bug, or the view context was missing in the request. ATM my guess is a bug. Maybe you could verify and open an issue? – iJungleBoy Aug 29 '22 at 10:59