25 lines
1.0 KiB
Go
25 lines
1.0 KiB
Go
|
|
package entity
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/google/uuid"
|
||
|
|
"time"
|
||
|
|
)
|
||
|
|
|
||
|
|
// UserLevelModuleAccesses mengatur akses user_level ke modul-modul tertentu
|
||
|
|
// Contoh: UserLevel "Admin Pusat" bisa akses semua modul, "Editor" hanya bisa akses "create_article" dan "edit_article"
|
||
|
|
type UserLevelModuleAccesses struct {
|
||
|
|
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
||
|
|
UserLevelId uint `json:"user_level_id" gorm:"type:int4;not null"`
|
||
|
|
ModuleId uint `json:"module_id" gorm:"type:int4;not null"`
|
||
|
|
CanAccess bool `json:"can_access" gorm:"type:bool;default:true"` // Apakah boleh akses modul ini
|
||
|
|
ClientId *uuid.UUID `json:"client_id" gorm:"type:UUID"`
|
||
|
|
IsActive *bool `json:"is_active" gorm:"type:bool;default:true"`
|
||
|
|
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
|
||
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
|
||
|
|
|
||
|
|
// Relations
|
||
|
|
UserLevel *UserLevels `json:"user_level,omitempty" gorm:"foreignKey:UserLevelId"`
|
||
|
|
Module *MasterModules `json:"module,omitempty" gorm:"foreignKey:ModuleId"`
|
||
|
|
}
|
||
|
|
|