Work on create organization repo and #257

This commit is contained in:
Unknown
2014-06-25 05:14:36 -04:00
parent 72ba273cc9
commit 43b33440b5
7 changed files with 144 additions and 65 deletions

View File

@ -123,11 +123,14 @@ func (u *User) GetOrganizations() error {
return nil
}
// Member represents user is member of organization.
type Member struct {
Id int64
OrgId int64 `xorm:"unique(member) index"`
UserId int64 `xorm:"unique(member)"`
// GetOwnerTeam returns owner team of organization.
func (org *User) GetOwnerTeam() (*Team, error) {
t := &Team{
OrgId: org.Id,
Name: OWNER_TEAM,
}
_, err := x.Get(t)
return t, err
}
// IsUserExist checks if given user name exist,
@ -249,7 +252,7 @@ func CreateOrganization(org, owner *User) (*User, error) {
// Create default owner team.
t := &Team{
OrgId: org.Id,
Name: "Owner",
Name: OWNER_TEAM,
Authorize: ORG_ADMIN,
NumMembers: 1,
}