File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/main/java/im/zhaojun/zfile/module/share/service Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 2323import im .zhaojun .zfile .module .storage .model .enums .FileOperatorTypeEnum ;
2424import im .zhaojun .zfile .module .storage .service .StorageSourceService ;
2525import im .zhaojun .zfile .module .storage .service .base .AbstractBaseFileService ;
26+ import im .zhaojun .zfile .module .user .model .constant .UserConstant ;
2627import im .zhaojun .zfile .module .user .model .entity .User ;
2728import im .zhaojun .zfile .module .user .model .entity .UserStorageSource ;
2829import im .zhaojun .zfile .module .user .service .UserService ;
@@ -127,7 +128,9 @@ public void deleteShareLink(String shareKey) {
127128 throw new BizException (ErrorCode .BIZ_SHARE_LINK_NOT_EXIST );
128129 }
129130 Integer currentUserId = ZFileAuthUtil .getCurrentUserId ();
130- if (!Objects .equals (shareLink .getUserId (), currentUserId )) {
131+ boolean currentIsAdmin = Objects .equals (UserConstant .ADMIN_ID , currentUserId );
132+ boolean deleteIsCurrentUser = Objects .equals (shareLink .getUserId (), currentUserId );
133+ if (!deleteIsCurrentUser && !currentIsAdmin ) {
131134 throw new BizException (ErrorCode .BIZ_STORAGE_SOURCE_ILLEGAL_OPERATION );
132135 }
133136 shareLinkMapper .deleteById (shareLink .getId ());
You can’t perform that action at this time.
0 commit comments