Remove useless PermissionRule

This commit is contained in:
Yang Luo 2023-11-03 00:39:16 +08:00
parent 8a195715d0
commit 9442aa9f7a
3 changed files with 1 additions and 17 deletions

View File

@ -96,7 +96,7 @@ p, *, *, GET, /api/get-organization-names, *, *
sa := stringadapter.NewAdapter(ruleText)
// load all rules from string adapter to enforcer's memory
err := sa.LoadPolicy(Enforcer.GetModel())
err = sa.LoadPolicy(Enforcer.GetModel())
if err != nil {
panic(err)
}

View File

@ -329,11 +329,6 @@ func (a *Ormer) createTable() {
panic(err)
}
err = a.Engine.Sync2(new(PermissionRule))
if err != nil {
panic(err)
}
err = a.Engine.Sync2(new(xormadapter.CasbinRule))
if err != nil {
panic(err)

View File

@ -49,17 +49,6 @@ type Permission struct {
State string `xorm:"varchar(100)" json:"state"`
}
type PermissionRule struct {
Ptype string `xorm:"varchar(100) index not null default ''" json:"ptype"`
V0 string `xorm:"varchar(100) index not null default ''" json:"v0"`
V1 string `xorm:"varchar(100) index not null default ''" json:"v1"`
V2 string `xorm:"varchar(100) index not null default ''" json:"v2"`
V3 string `xorm:"varchar(100) index not null default ''" json:"v3"`
V4 string `xorm:"varchar(100) index not null default ''" json:"v4"`
V5 string `xorm:"varchar(100) index not null default ''" json:"v5"`
Id string `xorm:"varchar(100) index not null default ''" json:"id"`
}
const builtInAvailableField = 5 // Casdoor built-in adapter, use V5 to filter permission, so has 5 available field
func GetPermissionCount(owner, field, value string) (int64, error) {