Open Closed

Detail message in controller authorization #4027


0
mamak created

If user hasn't permission for any Service Method, error msg is ok, is about permission. ("Required permissions were not met...") But for Controller method (returns PartialView) error msg is "an internal error occured..". Not about permission.

I want Controller to show error msg about permission as Service. what can I do?


7 Answer(s)
  • 0
    aaron created

    You can add this attribute to your methods: [WrapResult(WrapOnSuccess = false, WrapOnError = true)]

  • 0
    mamak created

    Nothing changed. I still get that general message. "an internal error occured during your request"

  • 0
    aaron created

    Can you check the error log in *.Web.Mvc\App_Data\Logs?

  • 0
    mamak created

    It is ok : "Abp.Authorization.AbpAuthorizationException: Required permissions are not granted. At least one of these permissions must be granted: *** "

    But message shown on alert is like "an internal error occured during your request"

  • 0
    ismcagdas created

    Hi @mamak,

    How do you call your controller action ? Via an ajax request ?

  • 0
    mamak created

    Controller: HastaTakip, Action: MuayeneModal

    var _muayeneModal = new app.ModalManager({ modalId: "modalMuayene", viewUrl: abp.appPath + 'Mpa/HastaTakip/MuayeneModal',
    modalClass: 'MuayeneModal', modalData: hastaId }); _muayeneModal.open();

  • 0
    ismcagdas created

    Hi @mamak,

    I have checked and ABP does not wrap response for partialview results. So, you need to hide the item which opens modal if user does not have required permisison.