diff options
Diffstat (limited to 'models/user/user.go')
-rw-r--r-- | models/user/user.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/models/user/user.go b/models/user/user.go index 91eeeb8962..f1df335eb6 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -1317,6 +1317,16 @@ func IsUserVisibleToViewer(ctx context.Context, u, viewer *User) bool { return false } +// CountWrongUserType count OrgUser who have wrong type +func CountWrongUserType() (int64, error) { + return db.GetEngine(db.DefaultContext).Where(builder.Eq{"type": 0}.And(builder.Neq{"num_teams": 0})).Count(new(User)) +} + +// FixWrongUserType fix OrgUser who have wrong type +func FixWrongUserType() (int64, error) { + return db.GetEngine(db.DefaultContext).Where(builder.Eq{"type": 0}.And(builder.Neq{"num_teams": 0})).Cols("type").NoAutoTime().Update(&User{Type: 1}) +} + func GetOrderByName() string { if setting.UI.DefaultShowFullName { return "full_name, name" |