Function hasPermission