0

Here is the scenario. At a large organization, all the users login to their Intranet and they are in a Staff (DNN) Role. We are building a 2sxc app to handle a very basic Classifieds Listing so the users can offer/sell items to each other.

For the staff, we have a Manage My Items view, its the only module on the page. Any logged in user in the Staff role can View (DNN permissions) the page. We got it working as expected so that the user can View approved (.IsPublished) items and also Add an item as a Draft (!.IsPublished).

The problem is, after the users add their item, they cannot see them. We cannot figure out how to show the Draft items at all in the View.

After the staff user adds a draft item, an admin can see:

enter image description here

and in the View

enter image description here

But when logged in as Staff role, the View only shows:

enter image description here

I've tried a number of things with Permissions on both the Content Type and the View. I experimented with GetDraft(), but that appears to serve a purpose in another scenario.

The code to get the list of items looks like this:

@{
  var items = AsList(App.Data["Items"])
    // .Where(i => i.IsPublished == false)
  ;
}

What do I need to do so that non-Admins can also view the Drafts (.IsPublished == false) items?

Note that if I upgrade the role's page (DNN) permissions from View to Edit, the draft items appear, but that defeats the purpose (in this scenario).

So again, this is not a public facing page, we are using the 2sxc UI to add a content item. If I am a logged in staff user and I add an item to sell in the Classifieds, I expect a manager will later approve it, but until then, I should be able to able to see my Items (where I am the entity .Owner) that are still in Draft (not approved yet). Thanks in advance!!

2sxc v13.12.1

Update:

Increased the permissions from Create Draft to Edit Draft CRUD and it made no difference, even after a DNN apppool restart.

Jeremy Farrance
  • 740
  • 6
  • 11

1 Answers1

1

Here's some background:

The App has data, and some data is in draft-mode. Internally a draft item actually exists twice - once as the real data, once as draft. All default mechanisms will apply a filter to show only published data to all users, and prefer the drafts for admins.

But this is easy to work around - you just have to get out of the default behavior. I don't know for sure how you're currently accessing the data, but I'll assume it's either

  1. module content (items assigned to module)
  2. query
  3. code accessing the App.Data

All of these behave the default way. But you can change that.

This is basically what a normal query looks like: enter image description here

Newer queries shorted this to just showing the App DataSource, because it does the same thing - auto-filter.

But you can change it doing it more manually. Add a App Root Cache IAppRoot and use the Draft Stream instead of the Default - then do with it whatever you want - like pass it through an Type Filter to only get the items you want.

it would look a bit like this:

enter image description here

iJungleBoy
  • 5,325
  • 1
  • 9
  • 21