26 lines
1.2 KiB
Go
26 lines
1.2 KiB
Go
package entity
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
"time"
|
|
)
|
|
|
|
// UserLevelMenuActionAccesses mengatur akses user_level ke action tertentu di dalam menu
|
|
// Contoh: UserLevel "Creator" di menu "Content Management" hanya bisa create dan edit, tidak bisa delete
|
|
type UserLevelMenuActionAccesses struct {
|
|
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
|
UserLevelId uint `json:"user_level_id" gorm:"type:int4;not null"`
|
|
MenuId uint `json:"menu_id" gorm:"type:int4;not null"`
|
|
ActionCode string `json:"action_code" gorm:"type:varchar(50);not null"` // 'view', 'create', 'edit', 'delete', etc.
|
|
CanAccess bool `json:"can_access" gorm:"type:bool;default:true"` // Apakah boleh melakukan action 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"`
|
|
Menu *MasterMenus `json:"menu,omitempty" gorm:"foreignKey:MenuId"`
|
|
}
|
|
|