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);
|
Utils.returnIfGuest(userRepository, null, hostId, principal);
|
||||||
return sceneService.applyAsGuest(
|
return sceneService.applyAsGuest(
|
||||||
sceneRepository
|
sceneRepository
|
||||||
.findByIdAndUserId(id, hostId)
|
.findByIdAndUserIdAndGuestAccessEnabled(id, hostId, true)
|
||||||
.orElseThrow(NotFoundException::new),
|
.orElseThrow(NotFoundException::new),
|
||||||
principal.getName(),
|
principal.getName(),
|
||||||
hostId);
|
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")
|
@Query("SELECT s FROM Scene s JOIN s.user u WHERE u.id = ?1 AND s.guestAccessEnabled = true")
|
||||||
List<Scene> findByHostId(Long hostId);
|
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