mirror of
https://github.com/moul/sshportal.git
synced 2025-03-09 22:06:34 +08:00
Remove unimplemented group code
This commit is contained in:
parent
68a8d033b1
commit
cf447a84b0
1 changed files with 5 additions and 16 deletions
21
db.go
21
db.go
|
@ -29,25 +29,16 @@ type Host struct {
|
|||
User string
|
||||
Password string
|
||||
SSHKey *SSHKey
|
||||
SSHKeyID uint `gorm:"index"`
|
||||
Fingerprint string // FIXME: replace with hostkey ?
|
||||
Groups []Group `gorm:"many2many:host_groups;"`
|
||||
SSHKeyID uint `gorm:"index"`
|
||||
Fingerprint string // FIXME: replace with hostkey ?
|
||||
Comment string
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
// FIXME: use uuid for ID
|
||||
gorm.Model
|
||||
Name string // FIXME: govalidator: min length 3, alphanum
|
||||
Comment string
|
||||
}
|
||||
|
||||
type User struct {
|
||||
// FIXME: use uuid for ID
|
||||
gorm.Model
|
||||
Name string // FIXME: govalidator: min length 3, alphanum
|
||||
SSHKeys []SSHKey
|
||||
Groups []Group `gorm:"many2many:user_groups;"`
|
||||
Comment string
|
||||
}
|
||||
|
||||
|
@ -55,11 +46,9 @@ func dbInit(db *gorm.DB) error {
|
|||
db.AutoMigrate(&User{})
|
||||
db.AutoMigrate(&SSHKey{})
|
||||
db.AutoMigrate(&Host{})
|
||||
db.AutoMigrate(&Group{})
|
||||
db.Exec(`CREATE UNIQUE INDEX uix_keys_name ON "keys"("name") WHERE ("deleted_at" IS NULL)`)
|
||||
db.Exec(`CREATE UNIQUE INDEX uix_hosts_name ON "hosts"("name") WHERE ("deleted_at" IS NULL)`)
|
||||
db.Exec(`CREATE UNIQUE INDEX uix_users_name ON "users"("name") WHERE ("deleted_at" IS NULL)`)
|
||||
db.Exec(`CREATE UNIQUE INDEX uix_groups_name ON "groups"("name") WHERE ("deleted_at" IS NULL)`)
|
||||
db.Exec(`CREATE UNIQUE INDEX uix_keys_name ON "ssh_keys"("name") WHERE ("deleted_at" IS NULL)`)
|
||||
db.Exec(`CREATE UNIQUE INDEX uix_hosts_name ON "hosts"("name") WHERE ("deleted_at" IS NULL)`)
|
||||
db.Exec(`CREATE UNIQUE INDEX uix_users_name ON "users"("name") WHERE ("deleted_at" IS NULL)`)
|
||||
|
||||
// create default ssh key
|
||||
var count uint
|
||||
|
|
Loading…
Reference in a new issue