diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-01-20 19:42:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-20 19:42:33 +0800 |
commit | 6fe3c8b3980f850c9789f9fa62bdfee7b2708ff0 (patch) | |
tree | 5e11864dd63c60564080506291ca93e465c19940 /services | |
parent | 0c048e554ba42d99bd66c07447de5f35cf6c981b (diff) | |
download | gitea-6fe3c8b3980f850c9789f9fa62bdfee7b2708ff0.tar.gz gitea-6fe3c8b3980f850c9789f9fa62bdfee7b2708ff0.zip |
Support org/user level projects (#22235)
Fix #13405
<img width="1151" alt="image"
src="https://user-images.githubusercontent.com/81045/209442911-7baa3924-c389-47b6-b63b-a740803e640e.png">
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'services')
-rw-r--r-- | services/context/user.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/services/context/user.go b/services/context/user.go index 9dc84c3ac1..7642cba4e1 100644 --- a/services/context/user.go +++ b/services/context/user.go @@ -8,6 +8,7 @@ import ( "net/http" "strings" + org_model "code.gitea.io/gitea/models/organization" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/context" ) @@ -56,6 +57,14 @@ func userAssignment(ctx *context.Context, errCb func(int, string, interface{})) } else { errCb(http.StatusInternalServerError, "GetUserByName", err) } + } else { + if ctx.ContextUser.IsOrganization() { + if ctx.Org == nil { + ctx.Org = &context.Organization{} + } + ctx.Org.Organization = (*org_model.Organization)(ctx.ContextUser) + ctx.Data["Org"] = ctx.Org.Organization + } } } } |