From a35ca3380293c9940c097227612e28e5fe0aabca Mon Sep 17 00:00:00 2001 From: Ji-Ha Date: Fri, 12 Aug 2022 14:01:21 +0900 Subject: [PATCH] =?UTF-8?q?[#168]=20fix(authority)=20-=20=EA=B6=8C?= =?UTF-8?q?=ED=95=9C=20=EA=B2=80=EC=82=AC=ED=95=A0=20=EB=95=8C,=20folder?= =?UTF-8?q?=EB=A5=BC=20=ED=86=B5=ED=95=B4=20=EA=B2=80=EC=82=AC=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD=ED=95=A8.=20-=20remindO?= =?UTF-8?q?n=ED=95=A0=20=EB=95=8C,=20remind=EA=B0=80=20=EC=A1=B4=EC=9E=AC?= =?UTF-8?q?=ED=95=98=EB=A9=B4=20=EC=B6=94=EA=B0=80=EB=90=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD=ED=95=A8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web2/domain/bookmark/service/SharedBookmarkService.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/yapp/web2/domain/bookmark/service/SharedBookmarkService.kt b/src/main/kotlin/com/yapp/web2/domain/bookmark/service/SharedBookmarkService.kt index 8ecfd94..1b62e29 100644 --- a/src/main/kotlin/com/yapp/web2/domain/bookmark/service/SharedBookmarkService.kt +++ b/src/main/kotlin/com/yapp/web2/domain/bookmark/service/SharedBookmarkService.kt @@ -21,16 +21,14 @@ class SharedBookmarkService( private val jwtProvider: JwtProvider ) { - @Transactional(readOnly = true) fun checkAuthority(account: Account, folderId: Long) { var folder = folderRepository.findFolderById(folderId) ?: throw FolderNotFoundException() if (folder.rootFolderId != null) folder = folderRepository.findFolderById(folder.rootFolderId!!) ?: throw FolderNotFoundException() - // 존재하면? 일단 공유 멤버이니까 return - for (af in account.accountFolderList) - if (af.folder == folder && af.authority > Authority.NONE) return + for (af in folder.folders!!) + if (af.account == account && af.authority > Authority.NONE) return throw NoPermissionException() } @@ -132,6 +130,8 @@ class SharedBookmarkService( val folderId = bookmark.folderId ?: throw RuntimeException("폴더에 속해있지 않습니다!") val remind = Remind(account) + if(bookmark.isRemindExist(remind)) return + checkAuthority(account, folderId) bookmark.remindOn(remind)