1
0
Fork 0
forked from forgejo/forgejo

Ensure DeleteUser is not allowed to Delete Orgs and visa versa (#10134)

* add check to DeleteUser

* add check to DeleteOrganization

* add Test

* remove redundancy (deleteOrg is only used in DeleteOrganization)

* Update models/org.go

Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
6543 2020-02-04 15:27:18 +01:00 committed by GitHub
parent b3c72a7c4a
commit d4096ab6a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 6 deletions

View file

@ -272,8 +272,8 @@ func TestDeleteOrganization(t *testing.T) {
assert.Error(t, err)
assert.True(t, IsErrUserOwnRepos(err))
nonOrg := AssertExistsAndLoadBean(t, &User{ID: 5}).(*User)
assert.Error(t, DeleteOrganization(nonOrg))
user := AssertExistsAndLoadBean(t, &User{ID: 5}).(*User)
assert.Error(t, DeleteOrganization(user))
CheckConsistencyFor(t, &User{}, &Team{})
}