Added can function

I added a can function to check whether the user has permission without redirecting. Useful for special cases when handling lack of permissions.