mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	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:
		| @@ -1244,6 +1244,10 @@ func deleteUser(e *xorm.Session, u *User) error { | ||||
| // DeleteUser completely and permanently deletes everything of a user, | ||||
| // but issues/comments/pulls will be kept and shown as someone has been deleted. | ||||
| func DeleteUser(u *User) (err error) { | ||||
| 	if u.IsOrganization() { | ||||
| 		return fmt.Errorf("%s is an organization not a user", u.Name) | ||||
| 	} | ||||
|  | ||||
| 	sess := x.NewSession() | ||||
| 	defer sess.Close() | ||||
| 	if err = sess.Begin(); err != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user