Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom 161 posts 322 karma points
    Dec 19, 2017 @ 11:19
    Tom
    0

    Server Side Notifications

    We are on Umbraco 7.5,9 and it appears all of the "notifications" are tied to Umbraco javascript internal files. We need the ability to create C# Visual Studio 2017 server side notifications back to our users when things happen.

    For example, a logged in user is not allowed to update our custom Content Aging. For now, if our read only user clicks the button, nothing happens. But what I'd like to do is send back a server side notification that will appear in green or red with the words "Access Denied."

    If server side "notifications" exist, can you please send me a C# example? If not, can you add this to the list of enhancements.

    Thanks

    Tom

  • Markus Johansson 1930 posts 5858 karma points MVP 2x c-trib
    Dec 22, 2017 @ 13:48
    Markus Johansson
    0

    Hi!

    How are you preventing this save in your code? What button are the user clicking? Is that button in a User Control or something?

    // m

  • Tom 161 posts 322 karma points
    Dec 25, 2017 @ 11:47
    Tom
    0

    Good question.

    I am preventing the save by checking Umbraco Permissions. If the logged in user ONLY have "Read Only" access to the backend, then the update won't happen.
    However in my case when a Read Only user logs in and clicks the "Update Page reviewed" button on the Content Age tab, Umbraco auto-shows a green bar with text at the bottom of the screen just above the Preview Save and Submit command buttons. The text says "Last Reviewed Updated. The page has been marked reviewed."

    Here is the code which displays the button. Its using twitter-bottstrap to show the command button. Update Review Schedule

    Note: All of this code is part of a custon Umbraco Backoffice plug-in that we wrote from scratch. This particular plugin provides editors the ability to (a) set the aging of the content (b) reset it by clicking the button.
    We are using Umbraco's scheduledTasks to schedule a check of each page to determine if its been at 3 months since anyone has reviewed each page. If the answer to any page in the site is no, we send out an email notifying management that the page is stale and needs to be reviewed.

    Tom

  • Matthew Wise 271 posts 1373 karma points MVP 5x c-trib
    Dec 25, 2017 @ 16:12
    Matthew Wise
    0

    Hi Tom, could you not check the permissions on load and not show the actions to the user?

    Currently you can't send notification from c# to my knowledge you can however return a 400 error to you API call and show the error message in js.

  • Tom 161 posts 322 karma points
    Dec 26, 2017 @ 11:23
    Tom
    0

    I could just hide the control all together if they don't have access. If I leave the control visible, and send back a 0 success or 400 access denied, in either case the API call is a success!

    So what difference does it make if I return a 400. The API call is still a success, right?

    Are you saying, if I get a 400 from the API call, to popup an alert, saying access denied? Or is there a way to utilize the built in Umbraco notification and send my Access Denied to it so its consistent with the other Umbraco notifications?

    Thanks so much for your help.

    To

  • Matthew Wise 271 posts 1373 karma points MVP 5x c-trib
    Dec 26, 2017 @ 17:02
    Matthew Wise
    0

    Hi Tom,

    Sorry was on my phone last time.

    I would always go with showing the user what they can use, this means the UI is cleaner and easier for your user to interact with.

    If you choose to show the controls but want to show a message I would return a 400 bad request header with the error message I wanted to show. This will return an error response which means you will be able to handle it separately to you success code.

    You can then use the notifcations service. To display the passed message from the server

    Hope this helps

    Matt

  • Tom 161 posts 322 karma points
    Dec 27, 2017 @ 15:58
    Tom
    0

    Thanks Matt. I got it figured out. Have a Happy New Year.

Please Sign in or register to post replies

Write your reply to:

Draft