store

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegistryIDField             = "id"
	RegistryRepositoryNameField = "repository_name"
	RegistryTagField            = "tag"
	RegistryContentDigestField  = "digest"
	RegistryConfigDigestField   = "config_digest"
	RegistrySizeNameField       = "size"
	RegistryPullCounterField    = "pull_counter"
	RegistryTimestampField      = "timestamp"
	RegistryRawField            = "raw"
	RegistryTableName           = "repositories"
)

Contract with storage for a registry data

View Source
const (
	AdminRole   = "admin"
	ManagerRole = "manager"
	UserRole    = "user"
)

Role which define access right for different user admin - has full access for entire registry end-points manager - allow pull,push and delete for type 'repository' a repository type defined with https://docs.docker.com/registry/spec/auth/scope/ NOTE: don't change order of items, it's expose values by indexes

Variables

This section is empty.

Functions

func CheckRoleInList

func CheckRoleInList(role string) bool

CheckRoleInList checking role assigned to user when add or update for exist in roles (allowed role list roles)

func ComparePassword

func ComparePassword(passwordHash, passwordString string) bool

ComparePassword checking password for match

Types

type Access

type Access struct {
	ID      int64  `json:"id"`
	Owner   int64  `json:"owner_id"`
	IsGroup bool   `json:"is_group"`
	Name    string `json:"name"`

	// Represents type of resource which the resource name is intended.
	// Available next resource types:
	// 		- repository - represents a single repository within a registry;
	//		- registry - represents the entire registry (Used for administrative actions or lookup operations that span an entire registry).
	Type string `json:"type"`

	// The resource name represent the name which identifies a resource for a resource provider
	ResourceName string `json:"resource_name"`

	// The resource actions define the actions which the access token allows to be performed on the identified resource.
	// These actions are type specific but will normally have actions identifying read and write access on the resource.
	// Example for the 'repository' type are 'pull' for read access and 'push' for write access.
	Action string `json:"action"`

	// Marks a access item as disabled
	Disabled bool `json:"disabled"`
}

Access model for accessing rules Fields of access object defined with docker docs - https://docs.docker.com/registry/spec/auth/scope

type AccessInterface

type AccessInterface interface {
	// CheckAccessPermit will check access for a specify entry
	CheckAccessPermit() (bool, error)
}

AccessInterface defines methods provided for Access manipulation

type Group

type Group struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Group holds user group

type RegistryEntry

type RegistryEntry struct {
	ID             int64  `json:"id"`
	RepositoryName string `json:"repository_name"` // Storage identifies the named repository.
	Tag            string `json:"tag"`             // Tag provides the tag
	Digest         string `json:"digest"`          // Digest uniquely identifies an image content. A byte stream can be verified against this digest.
	ConfigDigest   string `json:"config_digest"`   // ConfigDigest uniquely identifies an image config data.
	Size           int64  `json:"size"`            // Size in bytes of content.
	PullCounter    int64  `json:"pull_counter"`    // image pull counter
	Timestamp      int64  `json:"timestamp"`       // last modification date/time
	Raw            string `json:"raw,omitempty"`   // Raw is a whole notify event data in json
}

RegistryEntry is main entry records which will save in storage

type User

type User struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Login       string `json:"login"`
	Password    string `json:"password"`
	Role        string `json:"role"`  // role name selected by index from roles item
	Group       int64  `json:"group"` // reference to group ID
	Disabled    bool   `json:"blocked"`
	Description string `json:"description"`
}

User holds user-related info

func (*User) HashAndSalt

func (u *User) HashAndSalt() error

HashAndSalt encrypted user password

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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