Skip to content

Commit

Permalink
Merge pull request #256 from ArtisanCloud/dev/northseadl
Browse files Browse the repository at this point in the history
temp fix: casbin re-migrate error
  • Loading branch information
northseadl authored Sep 26, 2023
2 parents bea9426 + 90ab06c commit 2af0638
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/uc/powerx/authorizationadmin.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,16 @@ func (uc *AdminPermsUseCase) Init() {
}
}

// 初始化casbin策略
if err := uc.db.Model(&permission.EmployeeCasbinPolicy{}).Count(&count).Error; err != nil {
panic(errors.Wrap(err, "init casbin policy failed"))
}
if count == 0 {
uc.Casbin.SetAdapter(uc.fileAdapter)
uc.Casbin.LoadPolicy()
uc.Casbin.SetAdapter(uc.sqlAdapter)
uc.Casbin.SavePolicy()
}
//// 初始化casbin策略
//if err := uc.db.Model(&permission.EmployeeCasbinPolicy{}).Count(&count).Error; err != nil {
// panic(errors.Wrap(err, "init casbin policy failed"))
//}
//if count == 0 {
// uc.Casbin.SetAdapter(uc.fileAdapter)
// uc.Casbin.LoadPolicy()
// uc.Casbin.SetAdapter(uc.sqlAdapter)
// uc.Casbin.SavePolicy()
//}

// 初始化角色
if err := uc.db.Model(&permission.AdminRole{}).Count(&count).Error; err != nil {
Expand Down

0 comments on commit 2af0638

Please sign in to comment.