42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
// package main
|
|
|
|
// import (
|
|
// "git.technical.kiwi/go/otfe/misc/helpers"
|
|
// "git.technical.kiwi/go/otfe/models"
|
|
// "github.com/globalsign/mgo/bson"
|
|
// )
|
|
|
|
// 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
|
|
|
|
// 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()
|
|
|
|
// //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()
|
|
|
|
// }
|