util/syspolicy: add ReadStringArray interface (#11857)
Fixes tailscale/corp#19459 This PR adds the ability for users of the syspolicy handler to read string arrays from the MDM solution configured on the system. Signed-off-by: Andrea Gottardo <andrea@gottardo.me>
This commit is contained in:
@ -25,6 +25,9 @@ type Handler interface {
|
||||
// ReadBool reads the policy setting's boolean value for the given key.
|
||||
// It should return ErrNoSuchKey if the key does not have a value set.
|
||||
ReadBoolean(key string) (bool, error)
|
||||
// ReadStringArray reads the policy setting's string array value for the given key.
|
||||
// It should return ErrNoSuchKey if the key does not have a value set.
|
||||
ReadStringArray(key string) ([]string, error)
|
||||
}
|
||||
|
||||
// ErrNoSuchKey is returned by a Handler when the specified key does not have a
|
||||
@ -46,6 +49,10 @@ func (defaultHandler) ReadBoolean(_ string) (bool, error) {
|
||||
return false, ErrNoSuchKey
|
||||
}
|
||||
|
||||
func (defaultHandler) ReadStringArray(_ string) ([]string, error) {
|
||||
return nil, ErrNoSuchKey
|
||||
}
|
||||
|
||||
// markHandlerInUse is called before handler methods are called.
|
||||
func markHandlerInUse() {
|
||||
handlerUsed.Store(true)
|
||||
|
Reference in New Issue
Block a user