Allow owners that did not create the account to delete it (#1825)

Sometimes the Owner role will be passed to new users, and they need to be able to delete the account
This commit is contained in:
Maycon Santos 2024-04-11 10:02:51 +02:00 committed by GitHub
parent 3ed2f08f3c
commit 704c67dec8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1120,7 +1120,7 @@ func (am *DefaultAccountManager) DeleteAccount(accountID, userID string) error {
return status.Errorf(status.PermissionDenied, "user is not allowed to delete account") return status.Errorf(status.PermissionDenied, "user is not allowed to delete account")
} }
if user.Id != account.CreatedBy { if user.Role != UserRoleOwner {
return status.Errorf(status.PermissionDenied, "user is not allowed to delete account. Only account owner can delete account") return status.Errorf(status.PermissionDenied, "user is not allowed to delete account. Only account owner can delete account")
} }
for _, otherUser := range account.Users { for _, otherUser := range account.Users {