mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	Reimplement GetUserOrgsList to make it simple and clear (#32486)
Reimplement GetUserOrgsList and also move some functions and test to org_list file. --------- Co-authored-by: Zettat123 <zettat123@gmail.com>
This commit is contained in:
		| @@ -8,6 +8,7 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	auth "code.gitea.io/gitea/models/auth" | ||||
| 	"code.gitea.io/gitea/models/db" | ||||
| 	org_model "code.gitea.io/gitea/models/organization" | ||||
| 	user_model "code.gitea.io/gitea/models/user" | ||||
| 	"code.gitea.io/gitea/modules/log" | ||||
| @@ -192,7 +193,10 @@ func NewAccessTokenResponse(ctx context.Context, grant *auth.OAuth2Grant, server | ||||
| // returns a list of "org" and "org:team" strings, | ||||
| // that the given user is a part of. | ||||
| func GetOAuthGroupsForUser(ctx context.Context, user *user_model.User) ([]string, error) { | ||||
| 	orgs, err := org_model.GetUserOrgsList(ctx, user) | ||||
| 	orgs, err := db.Find[org_model.Organization](ctx, org_model.FindOrgOptions{ | ||||
| 		UserID:         user.ID, | ||||
| 		IncludePrivate: true, | ||||
| 	}) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("GetUserOrgList: %w", err) | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user