otfe/misc/test/seed.go

42 lines
1.1 KiB
Go
Raw Normal View History

2022-03-12 18:06:39 +00:00
// package main
2022-02-23 12:07:09 +00:00
2022-03-12 18:06:39 +00:00
// import (
// "git.technical.kiwi/go/otfe/misc/helpers"
// "git.technical.kiwi/go/otfe/models"
// "github.com/globalsign/mgo/bson"
// )
2022-02-23 12:07:09 +00:00
2022-03-12 18:06:39 +00:00
// func main() {
// models.DBWipeCollection("group", "user", "session")
// //admin user and group
// adminGroup := models.NewGroup("admin")
// adminGroup.Admin = true
// adminGroup.ID = bson.NewObjectId()
// adminGroup.Permissions["user.show"] = true
2022-02-23 12:07:09 +00:00
2022-03-12 18:06:39 +00:00
// admin := models.User{}
// admin.Username = "admin"
// admin.Email = "admin"
// admin.ID = bson.NewObjectId()
// admin.Password, _ = helpers.HashPassword("admin")
// admin.PrimaryGroup = adminGroup.ID
// adminGroup.Users = append(adminGroup.Users, admin.ID)
// adminGroup.Create()
// admin.Create()
2022-02-23 12:07:09 +00:00
2022-03-12 18:06:39 +00:00
// //user and user group
// userGroup := models.NewGroup("user")
// userGroup.ID = bson.NewObjectId()
// userGroup.Admin = false
// user := models.User{}
// user.ID = bson.NewObjectId()
// user.Username = "user"
// user.Email = "u"
// user.Password, _ = helpers.HashPassword("user")
// user.PrimaryGroup = userGroup.ID
// userGroup.Users = append(userGroup.Users, user.ID)
// user.Create()
// userGroup.Create()
2022-02-23 12:07:09 +00:00
2022-03-12 18:06:39 +00:00
// }