|
|
@ -16,8 +16,6 @@ import ( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
var ( |
|
|
|
// ErrOrgNotExist organization does not exist
|
|
|
|
|
|
|
|
ErrOrgNotExist = errors.New("Organization does not exist") |
|
|
|
|
|
|
|
// ErrTeamNotExist team does not exist
|
|
|
|
// ErrTeamNotExist team does not exist
|
|
|
|
ErrTeamNotExist = errors.New("Team does not exist") |
|
|
|
ErrTeamNotExist = errors.New("Team does not exist") |
|
|
|
) |
|
|
|
) |
|
|
@ -180,7 +178,7 @@ func CreateOrganization(org, owner *User) (err error) { |
|
|
|
// GetOrgByName returns organization by given name.
|
|
|
|
// GetOrgByName returns organization by given name.
|
|
|
|
func GetOrgByName(name string) (*User, error) { |
|
|
|
func GetOrgByName(name string) (*User, error) { |
|
|
|
if len(name) == 0 { |
|
|
|
if len(name) == 0 { |
|
|
|
return nil, ErrOrgNotExist |
|
|
|
return nil, ErrOrgNotExist{0, name} |
|
|
|
} |
|
|
|
} |
|
|
|
u := &User{ |
|
|
|
u := &User{ |
|
|
|
LowerName: strings.ToLower(name), |
|
|
|
LowerName: strings.ToLower(name), |
|
|
@ -190,7 +188,7 @@ func GetOrgByName(name string) (*User, error) { |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} else if !has { |
|
|
|
} else if !has { |
|
|
|
return nil, ErrOrgNotExist |
|
|
|
return nil, ErrOrgNotExist{0, name} |
|
|
|
} |
|
|
|
} |
|
|
|
return u, nil |
|
|
|
return u, nil |
|
|
|
} |
|
|
|
} |
|
|
|