hasPermission method explained