1
0
mirror of https://github.com/go-gitea/gitea synced 2024-11-07 09:15:53 +01:00

Admin should be able to see all organizations

This is follow-up for 56c66ee486b4b8d544201662de62a23f36e6a069 allowing admin
to see private repositories, even when not being member of them.
This commit is contained in:
Adam Strzelecki 2015-11-28 22:31:06 +01:00
parent ca96e04e5f
commit e57b2dffa4
3 changed files with 11 additions and 5 deletions

@ -48,7 +48,12 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
return return
} }
if ctx.IsSigned { // Admin has super access.
if ctx.IsSigned && ctx.User.IsAdmin {
ctx.Org.IsOwner = true
ctx.Org.IsMember = true
ctx.Org.IsAdminTeam = true
} else if ctx.IsSigned {
ctx.Org.IsOwner = org.IsOwnedBy(ctx.User.Id) ctx.Org.IsOwner = org.IsOwnedBy(ctx.User.Id)
if ctx.Org.IsOwner { if ctx.Org.IsOwner {
ctx.Org.IsMember = true ctx.Org.IsMember = true
@ -68,6 +73,7 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
return return
} }
ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner
ctx.Data["IsOrganizationMember"] = ctx.Org.IsMember
ctx.Org.OrgLink = setting.AppSubUrl + "/org/" + org.Name ctx.Org.OrgLink = setting.AppSubUrl + "/org/" + org.Name
ctx.Data["OrgLink"] = ctx.Org.OrgLink ctx.Data["OrgLink"] = ctx.Org.OrgLink

@ -316,7 +316,7 @@ func showOrgProfile(ctx *middleware.Context) {
org := ctx.Org.Organization org := ctx.Org.Organization
ctx.Data["Title"] = org.FullName ctx.Data["Title"] = org.FullName
repos, err := models.GetRepositories(org.Id, ctx.IsSigned && org.IsOrgMember(ctx.User.Id)) repos, err := models.GetRepositories(org.Id, ctx.IsSigned && (ctx.User.IsAdmin || org.IsOrgMember(ctx.User.Id)))
if err != nil { if err != nil {
ctx.Handle(500, "GetRepositories", err) ctx.Handle(500, "GetRepositories", err)
return return

@ -24,7 +24,6 @@
<div class="ui container"> <div class="ui container">
<div class="ui grid"> <div class="ui grid">
{{$isMember := .Org.IsOrgMember $.SignedUser.Id}}
<div class="ui eleven wide column"> <div class="ui eleven wide column">
{{if .IsOrganizationOwner}} {{if .IsOrganizationOwner}}
<div class="text right"> <div class="text right">
@ -38,13 +37,14 @@
<div class="ui five wide column"> <div class="ui five wide column">
<h4 class="ui top attached header"> <h4 class="ui top attached header">
<strong>{{.i18n.Tr "org.people"}}</strong> <strong>{{.i18n.Tr "org.people"}}</strong>
{{if $isMember}} {{if .IsOrganizationMember}}
<div class="ui right"> <div class="ui right">
<a class="text grey" href="{{.OrgLink}}/members"><strong>{{.Org.NumMembers}}</strong><span class="octicon octicon-chevron-right"></span></a> <a class="text grey" href="{{.OrgLink}}/members"><strong>{{.Org.NumMembers}}</strong><span class="octicon octicon-chevron-right"></span></a>
</div> </div>
{{end}} {{end}}
</h4> </h4>
<div class="ui attached segment members"> <div class="ui attached segment members">
{{$isMember := .IsOrganizationMember}}
{{range .Members}} {{range .Members}}
{{if or $isMember (.IsPublicMember $.Org.Id)}} {{if or $isMember (.IsPublicMember $.Org.Id)}}
<a href="{{.HomeLink}}" title="{{.Name}}"><img class="ui avatar" src="{{.AvatarLink}}"></a> <a href="{{.HomeLink}}" title="{{.Name}}"><img class="ui avatar" src="{{.AvatarLink}}"></a>
@ -57,7 +57,7 @@
</div> </div>
{{end}} {{end}}
{{if $isMember}} {{if .IsOrganizationMember}}
<div class="ui top attached header"> <div class="ui top attached header">
<strong>{{.i18n.Tr "org.teams"}}</strong> <strong>{{.i18n.Tr "org.teams"}}</strong>
<div class="ui right"> <div class="ui right">