Check Scene.guestAccessEnabled flag on guest application of scene
This commit is contained in:
parent
38c703e521
commit
ddcdaccbe0
2 changed files with 3 additions and 2 deletions
|
@ -70,7 +70,7 @@ public class SceneController {
|
|||
Utils.returnIfGuest(userRepository, null, hostId, principal);
|
||||
return sceneService.applyAsGuest(
|
||||
sceneRepository
|
||||
.findByIdAndUserId(id, hostId)
|
||||
.findByIdAndUserIdAndGuestAccessEnabled(id, hostId, true)
|
||||
.orElseThrow(NotFoundException::new),
|
||||
principal.getName(),
|
||||
hostId);
|
||||
|
|
|
@ -23,5 +23,6 @@ public interface SceneRepository extends CrudRepository<Scene, Long> {
|
|||
@Query("SELECT s FROM Scene s JOIN s.user u WHERE u.id = ?1 AND s.guestAccessEnabled = true")
|
||||
List<Scene> findByHostId(Long hostId);
|
||||
|
||||
Optional<Scene> findByIdAndUserId(Long id, Long userId);
|
||||
Optional<Scene> findByIdAndUserIdAndGuestAccessEnabled(
|
||||
Long id, Long userId, boolean guestAccessEnabled);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue