From 4d6de6c7b9715a6ccce3f09249b47b984b9a1295 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 11 May 2014 11:56:04 +0800 Subject: [PATCH] add login name for auth type --- models/release.go | 2 +- models/user.go | 1 + modules/auth/ldap/ldap_test.go | 32 ++++++++++++++++++++++++++++++++ templates/admin/users/edit.tmpl | 7 +++++++ templates/admin/users/new.tmpl | 7 +++++++ 5 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 modules/auth/ldap/ldap_test.go diff --git a/models/release.go b/models/release.go index 1df6272029..1fee56105f 100644 --- a/models/release.go +++ b/models/release.go @@ -58,7 +58,7 @@ func CreateRelease(repoPath string, rel *Release, gitRepo *git.Repository) error return ErrReleaseAlreadyExist } - if !git.IsTagExist(repoPath, rel.TagName) { + if !gitRepo.IsTagExist(rel.TagName) { _, stderr, err := com.ExecCmdDir(repoPath, "git", "tag", rel.TagName, "-m", rel.Title) if err != nil { return err diff --git a/models/user.go b/models/user.go index b2b16f1136..397094920b 100644 --- a/models/user.go +++ b/models/user.go @@ -44,6 +44,7 @@ type User struct { Passwd string `xorm:"not null"` LoginType int LoginSource int64 `xorm:"not null default 0"` + LoginName string Type int NumFollowers int NumFollowings int diff --git a/modules/auth/ldap/ldap_test.go b/modules/auth/ldap/ldap_test.go new file mode 100644 index 0000000000..8096573782 --- /dev/null +++ b/modules/auth/ldap/ldap_test.go @@ -0,0 +1,32 @@ +package ldap + +import ( + "fmt" + "testing" +) + +var ldapServer = "ldap.itd.umich.edu" +var ldapPort = uint16(389) +var baseDN = "dc=umich,dc=edu" +var filter = []string{ + "(cn=cis-fac)", + "(&(objectclass=rfc822mailgroup)(cn=*Computer*))", + "(&(objectclass=rfc822mailgroup)(cn=*Mathematics*))"} +var attributes = []string{ + "cn", + "description"} +var msadsaformat = "" + +func TestLDAP(t *testing.T) { + AddSource("test", ldapServer, ldapPort, + basedn, attributes, filter, + msadsaformat) + user, err := LoginUserLdap("xiaolunwen", "") + if err != nil { + t.Error(err) + return + } + + fmt.Println(user) + +} diff --git a/templates/admin/users/edit.tmpl b/templates/admin/users/edit.tmpl index 1fb29234ed..4995856768 100644 --- a/templates/admin/users/edit.tmpl +++ b/templates/admin/users/edit.tmpl @@ -26,6 +26,13 @@ +
+ +
+ +
+
+
diff --git a/templates/admin/users/new.tmpl b/templates/admin/users/new.tmpl index 88da16aa4e..b4843a99ca 100644 --- a/templates/admin/users/new.tmpl +++ b/templates/admin/users/new.tmpl @@ -24,6 +24,13 @@
+ +
+ +
+ +
+