shared

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneAccessControlEntry

func CloneAccessControlEntry(src *security.AccessControlEntry) *security.AccessControlEntry

CloneAccessControlEntry returns a deep copy of the provided ACE, including any nested extended information pointers. Callers receive a brand new struct so they can mutate the result without affecting the original value.

func CloneAceExtendedInformation

func CloneAceExtendedInformation(src *security.AceExtendedInformation) *security.AceExtendedInformation

CloneAceExtendedInformation produces a safe, deep copy of the extended ACE information.

func DescribeBitmask

func DescribeBitmask(actions []security.ActionDefinition, mask *int) *string

DescribeBitmask converts a pointer to a permission bitmask into a human-readable description. The description prefers the namespace action Name values and falls back to display name or the raw hexadecimal representation when no metadata exists.

func DescribeBitmaskArray

func DescribeBitmaskArray(actions []security.ActionDefinition, mask *int) *[]string

DescribeBitmaskArray converts a pointer to a permission bitmask into an array of action names. When mask is nil or zero, an empty slice is returned.

func DescribeBitmaskValue

func DescribeBitmaskValue(actions []security.ActionDefinition, mask int) string

DescribeBitmaskValue converts an integer bitmask into its human-readable representation. When the mask is zero, the string "None" is returned.

func ExtractNamespaceActions

func ExtractNamespaceActions(response *[]security.SecurityNamespaceDescription) []security.ActionDefinition

ExtractNamespaceActions returns a defensive copy of the action definitions for the provided namespace result.

func FindAccessControlEntry

func FindAccessControlEntry(ctx context.Context, client security.Client, namespaceID uuid.UUID, token, descriptor string) (*security.AccessControlEntry, error)

FindAccessControlEntry looks up a descriptor within the specified namespace/token and returns a cloned copy of the matching ACE when one exists.

func ParsePermissionBits

func ParsePermissionBits(actions []security.ActionDefinition, parts []string) (int, error)

ParsePermissionBits converts user-supplied textual or numeric permission identifiers into a bitmask. It accepts comma-separated values via Cobra's string slice parsing and validates tokens against the namespace action definitions when available.

Types

type ActionEntry

type ActionEntry struct {
	Bit         *int   `json:"bit,omitempty"`
	BitHex      string `json:"bitHex,omitempty"`
	Name        string `json:"name,omitempty"`
	DisplayName string `json:"displayName,omitempty"`
	NamespaceID string `json:"namespaceId,omitempty"`
}

ActionEntry describes a single permission action within a security namespace.

type NamespaceEntry

type NamespaceEntry struct {
	NamespaceID       string        `json:"namespaceId"`
	Name              string        `json:"name,omitempty"`
	DisplayName       string        `json:"displayName,omitempty"`
	DataspaceCategory string        `json:"dataspaceCategory,omitempty"`
	IsRemotable       *bool         `json:"isRemotable,omitempty"`
	ExtensionType     string        `json:"extensionType,omitempty"`
	ElementLength     *int          `json:"elementLength,omitempty"`
	SeparatorValue    string        `json:"separatorValue,omitempty"`
	WritePermission   string        `json:"writePermission,omitempty"`
	ReadPermission    string        `json:"readPermission,omitempty"`
	UseTranslator     *bool         `json:"useTokenTranslator,omitempty"`
	SystemBitMask     string        `json:"systemBitMask,omitempty"`
	StructureValue    *int          `json:"structureValue,omitempty"`
	ActionsCount      *int          `json:"actionsCount,omitempty"`
	Actions           []ActionEntry `json:"actions,omitempty"`
}

NamespaceEntry represents the exported view of a security namespace used for CLI output.

func TransformNamespace

TransformNamespace converts the Azure DevOps SDK response model into the CLI-friendly structure.

type SubjectTarget

type SubjectTarget struct {
	util.Scope
	Subject string
}

func ParseSubjectTarget

func ParseSubjectTarget(ctx util.CmdContext, input string) (*SubjectTarget, error)

ParseSubjectTarget parses the target input for permission commands. Accepted formats:

  • (empty) → defaults organization from configuration
  • ORGANIZATION → organization scope only
  • ORGANIZATION/SUBJECT → organization with explicit subject
  • ORGANIZATION/PROJECT/SUBJECT → project-scoped subject

Jump to

Keyboard shortcuts

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