From 26a0cd7143cc933cee37ac87696eeda46b1ea437 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Sat, 8 Apr 2023 00:21:02 +0900 Subject: Allow repo admins too to delete the repo (#23940) Fixes https://github.com/go-gitea/gitea/issues/23934 We need to check `AccessModeAdmin` in `CanUserDelete` instead of `AccessModeOwner` --- models/organization/org.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'models/organization/org.go') diff --git a/models/organization/org.go b/models/organization/org.go index fa2a604721..53b020d704 100644 --- a/models/organization/org.go +++ b/models/organization/org.go @@ -100,6 +100,11 @@ func (org *Organization) IsOwnedBy(uid int64) (bool, error) { return IsOrganizationOwner(db.DefaultContext, org.ID, uid) } +// IsOrgAdmin returns true if given user is in the owner team or an admin team. +func (org *Organization) IsOrgAdmin(uid int64) (bool, error) { + return IsOrganizationAdmin(db.DefaultContext, org.ID, uid) +} + // IsOrgMember returns true if given user is member of organization. func (org *Organization) IsOrgMember(uid int64) (bool, error) { return IsOrganizationMember(db.DefaultContext, org.ID, uid) -- cgit v1.2.3