Make prepare_runtime_permission a function.

Also fix a bug when evaluating if a user has any permission where
if they had the wildcard permission they could incorrectly be marked
as not having the permission.

Signed-off-by: Tyler O'Meara <Tyler@TylerOMeara.com>