From 4ebf15f3c1606a0b7bfa68762bb01a4bf3682564 Mon Sep 17 00:00:00 2001 From: lishuang Date: Sat, 22 Jul 2023 19:41:02 +0800 Subject: [PATCH] fix: fix the auth bug. --- code/rest/space_member_service.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/rest/space_member_service.go b/code/rest/space_member_service.go index 6f09061..12bff2a 100644 --- a/code/rest/space_member_service.go +++ b/code/rest/space_member_service.go @@ -65,6 +65,9 @@ func (this *SpaceMemberService) canManage(user *User, spaceUuid string) bool { if user.Role == USER_ROLE_ADMINISTRATOR { return true } + if user.SpaceUuid == spaceUuid { + return true + } //only space's admin can add member. spaceMember := this.spaceMemberDao.FindBySpaceUuidAndUserUuid(spaceUuid, user.Uuid) @@ -76,6 +79,9 @@ func (this *SpaceMemberService) canRead(user *User, spaceUuid string) bool { if user.Role == USER_ROLE_ADMINISTRATOR { return true } + if user.SpaceUuid == spaceUuid { + return true + } //only space's admin can add member. spaceMember := this.spaceMemberDao.FindBySpaceUuidAndUserUuid(spaceUuid, user.Uuid) @@ -87,6 +93,9 @@ func (this *SpaceMemberService) canWrite(user *User, spaceUuid string) bool { if user.Role == USER_ROLE_ADMINISTRATOR { return true } + if user.SpaceUuid == spaceUuid { + return true + } //only space's admin can add member. spaceMember := this.spaceMemberDao.FindBySpaceUuidAndUserUuid(spaceUuid, user.Uuid)