I think these two sentences above are both correct.
I believe that both sentences are correct...in the 1st case "The speaker wants to know if it's all right to enter." --> the modal can has almost the same function of the modal "may " considering that the answer would be "yes you can"
but in the 2nd case; "The speaker wants to know if they are capable of entering." --> notice the use of "capable"= he is outside , they are inside & they are capable of letting him in.
This reminds me of elementary school. You would always go up to the teacher and ask "Can I go to the bathroom?". And they would say "I don't know, can you?" attempting to get us to use the "proper" term "may I" as in "do I have permission to" not "am I able to". But now if anyone says that to me, I promptly rape them verbally and dump their corpse in the East River.