ptype

package
v1.94.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package ptype contains types used by syspolicy.

It's a leaf package for dependency reasons and should not contain much if any code, and should not import much (or anything).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PreferenceOption

type PreferenceOption byte

PreferenceOption is a policy that governs whether a boolean variable is forcibly assigned an administrator-defined value, or allowed to receive a user-defined value.

const (
	ShowChoiceByPolicy PreferenceOption = iota
	NeverByPolicy
	AlwaysByPolicy
)

func (PreferenceOption) IsAlways

func (p PreferenceOption) IsAlways() bool

IsAlways reports whether the preference should always be enabled.

func (PreferenceOption) IsNever

func (p PreferenceOption) IsNever() bool

IsNever reports whether the preference should always be disabled.

func (*PreferenceOption) MarshalText

func (p *PreferenceOption) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler.

func (PreferenceOption) ShouldEnable

func (p PreferenceOption) ShouldEnable(userChoice bool) bool

ShouldEnable checks if the choice administered by this policy should be enabled. If the administrator has chosen a setting, the administrator's setting is returned, otherwise userChoice is returned.

func (PreferenceOption) Show

func (p PreferenceOption) Show() bool

Show reports whether the UI option that controls the choice administered by this policy should be shown (that is, available for users to change).

Currently this is true if and only if the policy is ShowChoiceByPolicy.

func (PreferenceOption) String

func (p PreferenceOption) String() string

String returns a string representation of p.

func (*PreferenceOption) UnmarshalText

func (p *PreferenceOption) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler. It never fails and sets p to ShowChoiceByPolicy if the specified text does not represent a valid PreferenceOption.

func (PreferenceOption) WillOverride

func (p PreferenceOption) WillOverride(userChoice bool) bool

WillOverride checks if the choice administered by the policy is different from the user's choice.

type Visibility

type Visibility byte

Visibility is a policy that controls whether or not a particular component of a user interface is to be shown.

const (
	VisibleByPolicy Visibility = 'v'
	HiddenByPolicy  Visibility = 'h'
)

func (Visibility) MarshalText

func (v Visibility) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler.

func (Visibility) Show

func (v Visibility) Show() bool

Show reports whether the UI option administered by this policy should be shown. Currently this is true if the policy is not [hiddenByPolicy].

func (Visibility) String

func (v Visibility) String() string

String returns a string representation of v.

func (*Visibility) UnmarshalText

func (v *Visibility) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler. It never fails and sets v to VisibleByPolicy if the specified text does not represent a valid Visibility.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL