diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-08-29 20:50:43 +0800 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-08-29 20:50:43 +0800 |
commit | d2aff9a46a20bfd5345fec8a88d2638997a833c0 (patch) | |
tree | f655789858cc809b080bcd49ee75824384e550a5 /models | |
parent | 904bf1a50b021798344f8e124439bdd6a4db9cfc (diff) | |
download | gitea-d2aff9a46a20bfd5345fec8a88d2638997a833c0.tar.gz gitea-d2aff9a46a20bfd5345fec8a88d2638997a833c0.zip |
Continue working on new admin pages
Diffstat (limited to 'models')
-rw-r--r-- | models/org.go | 7 | ||||
-rw-r--r-- | models/user.go | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/models/org.go b/models/org.go index 18ed68e6f4..ce50670582 100644 --- a/models/org.go +++ b/models/org.go @@ -165,6 +165,13 @@ func CountOrganizations() int64 { return count } +// GetOrganizations returns given number of organizations with offset. +func GetOrganizations(num, offset int) ([]*User, error) { + orgs := make([]*User, 0, num) + err := x.Limit(num, offset).Where("type=1").Asc("id").Find(&orgs) + return orgs, err +} + // TODO: need some kind of mechanism to record failure. // DeleteOrganization completely and permanently deletes everything of organization. func DeleteOrganization(org *User) (err error) { diff --git a/models/user.go b/models/user.go index 661fb1c220..96881ea355 100644 --- a/models/user.go +++ b/models/user.go @@ -248,8 +248,8 @@ func CountUsers() int64 { } // GetUsers returns given number of user objects with offset. -func GetUsers(num, offset int) ([]User, error) { - users := make([]User, 0, num) +func GetUsers(num, offset int) ([]*User, error) { + users := make([]*User, 0, num) err := x.Limit(num, offset).Where("type=0").Asc("id").Find(&users) return users, err } |