fix: prevent API keys from assigning owner role

This commit is contained in:
ttommybot
2026-07-23 15:25:21 +08:00
committed by lyingbug
parent 8ae82573ab
commit a287808597
7 changed files with 119 additions and 0 deletions
+2
View File
@@ -295,6 +295,8 @@ func (h *TenantInvitationHandler) CreateInvitation(c *gin.Context) {
switch {
case errors.Is(err, service.ErrInvalidTenantRole):
c.Error(apperrors.NewValidationError(err.Error()))
case errors.Is(err, service.ErrAPIKeyCannotAssignOwner):
c.Error(apperrors.NewForbiddenError(err.Error()))
case errors.Is(err, service.ErrPendingInvitationExists):
c.Error(apperrors.NewConflictError(err.Error()))
case errors.Is(err, service.ErrAlreadyMember):