template-monorepo/internal/model/permission/domain/enum/status.go

29 lines
601 B
Go
Raw Normal View History

package enum
// Status indicates whether a Permission or Role node is enabled.
type Status string
const (
StatusOpen Status = "open"
StatusClose Status = "close"
)
// IsValid reports whether s is a known status value.
func (s Status) IsValid() bool {
switch s {
case StatusOpen, StatusClose:
return true
default:
return false
}
}
// String returns the raw status value.
func (s Status) String() string {
return string(s)
}
// Permissions maps permission name → status, used by the
// AuthorizationQuery layer when shaping the menu/permission map.
type Permissions map[string]Status