aboutsummaryrefslogtreecommitdiff
path: root/models/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/user.go')
-rw-r--r--models/user.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go
index 641e14d0..da2f49a1 100644
--- a/models/user.go
+++ b/models/user.go
@@ -61,6 +61,7 @@ type User struct {
LoginSource int64 `xorm:"NOT NULL DEFAULT 0"`
LoginName string
Type UserType
+ OwnedOrgs []*User `xorm:"-"`
Orgs []*User `xorm:"-"`
Repos []*Repository `xorm:"-"`
Location string
@@ -307,6 +308,12 @@ func (u *User) GetRepositories() (err error) {
return err
}
+// GetOwnedOrganizations returns all organizations that user owns.
+func (u *User) GetOwnedOrganizations() (err error) {
+ u.OwnedOrgs, err = GetOwnedOrgsByUserID(u.Id)
+ return err
+}
+
// GetOrganizations returns all organizations that user belongs to.
func (u *User) GetOrganizations() error {
ous, err := GetOrgUsersByUserId(u.Id)