summaryrefslogtreecommitdiffstats
path: root/modules/middleware/org.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-08-15 18:29:41 +0800
committerUnknwon <joe2010xtmf@163.com>2014-08-15 18:29:41 +0800
commit36b4c57ff13198196134b853f624fb633061734d (patch)
treee973d2aad41823e50c951a08ec8742030141d675 /modules/middleware/org.go
parent3e32b14ad4da2db1b05eeec73936dbbe79cecc45 (diff)
downloadgitea-36b4c57ff13198196134b853f624fb633061734d.tar.gz
gitea-36b4c57ff13198196134b853f624fb633061734d.zip
Finish new organization members and invitation page
Diffstat (limited to 'modules/middleware/org.go')
-rw-r--r--modules/middleware/org.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/modules/middleware/org.go b/modules/middleware/org.go
index 05316a518f..77e999a328 100644
--- a/modules/middleware/org.go
+++ b/modules/middleware/org.go
@@ -13,8 +13,9 @@ import (
func OrgAssignment(redirect bool, args ...bool) macaron.Handler {
return func(ctx *Context) {
var (
- requireMember bool
- requireOwner bool
+ requireMember bool
+ requireOwner bool
+ requireAdminTeam bool
)
if len(args) >= 1 {
requireMember = args[0]
@@ -22,6 +23,9 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler {
if len(args) >= 2 {
requireOwner = args[1]
}
+ if len(args) >= 3 {
+ requireAdminTeam = args[2]
+ }
orgName := ctx.Params(":org")
@@ -43,13 +47,24 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler {
ctx.Org.IsOwner = ctx.Org.Organization.IsOrgOwner(ctx.User.Id)
if ctx.Org.IsOwner {
ctx.Org.IsMember = true
+ ctx.Org.IsAdminTeam = true
} else {
- ctx.Org.IsMember = ctx.Org.Organization.IsOrgMember(ctx.User.Id)
+ if ctx.Org.Organization.IsOrgMember(ctx.User.Id) {
+ ctx.Org.IsMember = true
+ // TODO: ctx.Org.IsAdminTeam
+ }
}
}
- if (requireMember && !ctx.Org.IsMember) || (requireOwner && !ctx.Org.IsOwner) {
+ if (requireMember && !ctx.Org.IsMember) ||
+ (requireOwner && !ctx.Org.IsOwner) ||
+ (requireAdminTeam && !ctx.Org.IsAdminTeam) {
ctx.Handle(404, "OrgAssignment", err)
return
}
+ ctx.Data["IsAdminTeam"] = ctx.Org.IsAdminTeam
+ ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner
+
+ ctx.Org.OrgLink = "/org/" + ctx.Org.Organization.Name
+ ctx.Data["OrgLink"] = ctx.Org.OrgLink
}
}