后台授权模块调整
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
// ldap_group 权限组表
|
||||
type LdapGroup struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||
Type *string `gorm:"default:'';" json:"type"` //
|
||||
Name *string `gorm:"default:'';" json:"name"` //
|
||||
Keyword *string `gorm:"default:'';" json:"keyword"` //
|
||||
Remark *string `gorm:"default:'';" json:"remark"` //
|
||||
@@ -16,7 +17,6 @@ type LdapGroup struct {
|
||||
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
|
||||
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
||||
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||
Type *string `gorm:"default:'';" json:"type"` // 类型:people=个人
|
||||
}
|
||||
type LdapGroupModel struct {
|
||||
db *gorm.DB
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package gmodel
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// ldap_user_group 用户权限分组表
|
||||
type LdapUserGroup struct {
|
||||
GroupId *int64 `gorm:"default:0;" json:"group_id"` //
|
||||
UserId *int64 `gorm:"default:0;" json:"user_id"` //
|
||||
}
|
||||
type LdapUserGroupModel struct {
|
||||
db *gorm.DB
|
||||
name string
|
||||
}
|
||||
|
||||
func NewLdapUserGroupModel(db *gorm.DB) *LdapUserGroupModel {
|
||||
return &LdapUserGroupModel{db: db, name: "ldap_user_group"}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
package gmodel
|
||||
// TODO: 使用model的属性做你想做的
|
||||
@@ -10,6 +10,10 @@ func (u *LdapUserModel) Update(ctx context.Context, userDN string, data *LdapUse
|
||||
return u.db.WithContext(ctx).Model(&LdapUser{}).Where("user_dn = ?", userDN).Updates(&data).Error
|
||||
}
|
||||
|
||||
func (u *LdapUserModel) UpdateById(ctx context.Context, id int64, data *LdapUser) error {
|
||||
return u.db.WithContext(ctx).Model(&LdapUser{}).Where("id = ?", id).Updates(&data).Error
|
||||
}
|
||||
|
||||
func (u *LdapUserModel) Delete(ctx context.Context, id int64) error {
|
||||
return u.db.WithContext(ctx).Model(&LdapUser{}).Where("id = ?", id).Delete(&LdapUser{}).Error
|
||||
}
|
||||
|
||||
@@ -113,7 +113,6 @@ type AllModelsGen struct {
|
||||
LdapGroup *LdapGroupModel // ldap_group 权限组表
|
||||
LdapMenus *LdapMenusModel // ldap_menus 菜单表
|
||||
LdapUser *LdapUserModel // ldap_user ldap_用户id递增表
|
||||
LdapUserGroup *LdapUserGroupModel // ldap_user_group 用户权限分组表
|
||||
|
||||
}
|
||||
|
||||
@@ -228,7 +227,6 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||
LdapGroup: NewLdapGroupModel(gdb),
|
||||
LdapMenus: NewLdapMenusModel(gdb),
|
||||
LdapUser: NewLdapUserModel(gdb),
|
||||
LdapUserGroup: NewLdapUserGroupModel(gdb),
|
||||
}
|
||||
return models
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user