aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-06-25 00:44:48 -0400
committerUnknown <joe2010xtmf@163.com>2014-06-25 00:44:48 -0400
commite0f9c628c5ff7399167944b3d0730698487af498 (patch)
treecb296196a29b713d4aa224a296e5088021e6b777 /cmd
parentb2801a2e985f11e940a0cd420cea57242ea26d4c (diff)
downloadgitea-e0f9c628c5ff7399167944b3d0730698487af498.tar.gz
gitea-e0f9c628c5ff7399167944b3d0730698487af498.zip
Add create organization
Diffstat (limited to 'cmd')
-rw-r--r--cmd/serve.go20
-rw-r--r--cmd/web.go5
2 files changed, 13 insertions, 12 deletions
diff --git a/cmd/serve.go b/cmd/serve.go
index 62e290d82a..2a76da7937 100644
--- a/cmd/serve.go
+++ b/cmd/serve.go
@@ -56,19 +56,19 @@ func parseCmd(cmd string) (string, string) {
}
var (
- COMMANDS_READONLY = map[string]int{
- "git-upload-pack": models.AU_WRITABLE,
- "git upload-pack": models.AU_WRITABLE,
- "git-upload-archive": models.AU_WRITABLE,
+ COMMANDS_READONLY = map[string]models.AccessType{
+ "git-upload-pack": models.WRITABLE,
+ "git upload-pack": models.WRITABLE,
+ "git-upload-archive": models.WRITABLE,
}
- COMMANDS_WRITE = map[string]int{
- "git-receive-pack": models.AU_READABLE,
- "git receive-pack": models.AU_READABLE,
+ COMMANDS_WRITE = map[string]models.AccessType{
+ "git-receive-pack": models.READABLE,
+ "git receive-pack": models.READABLE,
}
)
-func In(b string, sl map[string]int) bool {
+func In(b string, sl map[string]models.AccessType) bool {
_, e := sl[b]
return e
}
@@ -129,7 +129,7 @@ func runServ(k *cli.Context) {
// Access check.
switch {
case isWrite:
- has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.AU_WRITABLE)
+ has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.WRITABLE)
if err != nil {
println("Gogs: internal error:", err)
log.GitLogger.Fatal("Fail to check write access:", err)
@@ -152,7 +152,7 @@ func runServ(k *cli.Context) {
break
}
- has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.AU_READABLE)
+ has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.READABLE)
if err != nil {
println("Gogs: internal error:", err)
log.GitLogger.Fatal("Fail to check read access:", err)
diff --git a/cmd/web.go b/cmd/web.go
index d29183a9dc..878fdeac70 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -188,14 +188,15 @@ func runWeb(*cli.Context) {
reqOwner := middleware.RequireOwner()
- m.Group("/o", func(r martini.Router) {
+ m.Group("/org", func(r martini.Router) {
r.Get("/create", org.New)
+ r.Post("/create", bindIgnErr(auth.CreateOrganizationForm{}), org.NewPost)
r.Get("/:org", org.Organization)
r.Get("/:org/dashboard", org.Dashboard)
r.Get("/:org/members", org.Members)
r.Get("/:org/teams", org.Teams)
r.Get("/:org/setting", org.Setting)
- })
+ }, reqSignIn)
m.Group("/:username/:reponame", func(r martini.Router) {
r.Get("/settings", repo.Setting)