Check if user has permission to access a url (for use with logon return url)
NickName:stew Ask DateTime:2009-11-27T17:15:35

Check if user has permission to access a url (for use with logon return url)

When a user logs on, I check if there is a return url, and if so I redirect to it, as per the MVC application template.

if (!String.IsNullOrEmpty(returnUrl))
{          
    return Redirect(returnUrl);
}

How would I check if this URL was valid (routes to a controller/action), and the user has permission to access it? My actions are all protected using the standard authorize attribute.

Thanks for your help,

Stew

Copyright Notice:Content Author:「stew」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/1807604/check-if-user-has-permission-to-access-a-url-for-use-with-logon-return-url

More about “Check if user has permission to access a url (for use with logon return url)” related questions

Check if user has permission to access a url (for use with logon return url)

When a user logs on, I check if there is a return url, and if so I redirect to it, as per the MVC application template. if (!String.IsNullOrEmpty(returnUrl)) { return Redirect(return...

Show Detail

Check if user has permission to access specific states

I use angular-permission and I want to check if user has access to specific states. My state config: $stateProvider .state('app', { url: '/', abstract: true, ...

Show Detail

I want to check if the user has required permission to do CRUD operations on the api URL

The task was to verify if the user has the permission to perform CRUD operations in the given api, I was given a mongoDB database that contains all the api url that a user can perform CRUD operatio...

Show Detail

Spring security check if user has access to mentioned url

I have started using spring security, and after a lot of research I am not able to find an answer for: If I explicitly want to check if user A have access to stuff B. I can check this with JSP tag

Show Detail

How to log in and check, if user is staff, can access to url or use a views class?

At my question, my problem is How to log in and check, if user is staff, can access to url or use a views class ? I want to user login on website (Not admin-console) and user is staff (in admin-co...

Show Detail

Symfony2 check if user has access to url inside Twig

Is there a way in Symfony2 to check if user has access to specified url inside Twig template? Something like this: {% if user_has_access( '/some/url/to/access' ) %} <a href="{{ path( '/some...

Show Detail

Should login_url for permission_required check the permission?

Simple question..? The permission_required decorator (https://docs.djangoproject.com/en/1.7/topics/auth/default/#the-permission-required-decorator) allows you to specify a login_url parameter. Sho...

Show Detail

Check if user has permission to access module in joomla 2.5

I using joomla 2.5. I have made a custom module. I need to run some codes in component if that user had permission to access the module. Is there a function to check that if the user has permission

Show Detail

In Django template: Check if user has permission to access view specified by name

Say I have a view that has been decorated with the user_passes_test decorator: # myapp/views.py from django.views.generic import TemplateView from django.contrib.auth.decorators import user_passes...

Show Detail

How to check if user has permission to access this function in Laravel

I have a function that check if the user has permission or not and it return Boolean. Question is How I check in each function user has permission or not. For example in users controller I have 2

Show Detail