device dao refactoring (criteria query fo finding devices by user, guids and check permissions)