简体   繁体   中英

2sxc - Toolbar - Edit permissions by DNN roles

I'm having a hard time trying to figure out how permissions work. Giving users security roles in DNN like edit module/page just to be able to edit app data doesn't work for me.

I need to give users strict permissions to add or edit any data on the view/content in that app/module, but they cannot have edit permissions to the page or the module itself (only the data in it, like FnL allows).

Basically, the content tool bars or list tool bars should be visible to some select DNN users with no security access (more like a social group).

2sxc Designers group is not possible. Way too many groups with different accesses to different apps.

Custom toolbars do not seem to render... I used

<ul class="sc-menu" toolbar='{"contentType":"farm_ad","action":"new"}'></ul>

and I can see the code in the page source, but the button itself is not rendered for non admins.

I tried giving full permissions to the content and view to everyone (security level: view permissions and even anonymous), but the buttons do not show...

I'm trying this code:

@Dnn.User.IsInRole("Editores de fármacos")<br>
@if (@Dnn.User.IsInRole("Editores de fármacos") == true)
    {
    <div class="sc-element">
    <h1>Fármacos adulto</h1>
    @Edit.Toolbar(ListContent)
    </div>
    <br>
    <ul class="sc-menu" toolbar='{"contentType":"farm_ad","action":"new"}'></ul>
    <br>
    }

And I can see the if clause returns true (the h1 is rendered), but toolbar and buttons simply do not show...

So to start - I would recommend to only use one toolbar-api, to keep things simple. As you're using Razor, I recommend you use that, also because you'll get errors when you use an incorrect syntax. So best to use @Edit.Toolbar(...)

There are always a few questions to ask, if the toolbar doesn't appear:

  1. is it really there? - check in the rendered HTML, if the @Edit.Toolbar was replaced with an . If not, my guess is that there is no ListContent object on this template - this is a template configuration. You could also just try an @Edit.Toolbar() without parameters, to just get a minimal toolbar which provides app/manage buttons but no edit.
  2. Is there a JS error renderering the toolbar - this is not common, but it could happen if something is wrong. Check F12 to see if something appears.
  3. Is it correctly replaced? the JS picks up the fairly simple tag and replaces it with a complex UL/LI list. Check F12 to see if it did that.
  4. Is just invisible because of CSS? sometimes you'll have a toolbar, but you won't see it because of something lying on top of it.

Depending on the core issue, you'll have different solutions.

  1. if it's not there, you're server code is somehow wrong, and an if or something is preventing the output.
  2. if it's a JS error, you should check what values you're using
  3. if it's not being replaced, then your tag is either wrong, or the page isn't loading the js required to do that. ATM it's only loaded if a user has edit-right on a module.
  4. if it's there but not showing up, either create a non-hovering solution, or tweak your CSS to get it to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM