shared

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.Path
	Subject string
}

func ParseSubjectTarget

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

ParseSubjectTarget parses the target input for permission commands using the shared structural scope parser.

Accepted forms:

  • (empty) → default organization, no subject
  • ORG:/ → organization scope only, no subject
  • /SUBJECT → organization-level subject in the default organization
  • ORG:/SUBJECT → organization-level subject in an explicit organization
  • PROJECT/SUBJECT → project-scoped subject in the default organization
  • ORG:PROJECT/SUBJECT → project-scoped subject in an explicit organization

A legacy two-segment input such as ORG/SUBJECT is indistinguishable from the canonical PROJECT/SUBJECT form, so it is never rejected and never treated as an explicit organization: it parses as a project-scoped subject in the default organization. Organization-level subjects must use the ORG:/SUBJECT or /SUBJECT forms. Bare ORG is likewise parsed as a project, so the organization-only form requires the colon prefix (ORG:/).

Jump to

Keyboard shortcuts

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