perm

package
v0.0.0-...-70e5bc8 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Overview

Package perm implements mutation permission checking for servers.

Index

Constants

View Source
const WritersGroupFile = "Writers"

WritersGroupFile is the name of the Group file that specifies writers for a Perm instance.

Variables

This section is empty.

Functions

func WrapDir

func WrapDir(cfg upspin.Config, ready <-chan struct{}, target upspin.UserName, dir upspin.DirServer) upspin.DirServer

WrapDir wraps the given DirServer with a DirServer that checks root-creation permissions. It will only start polling the store permissions after the ready channel is closed.

func WrapStore

func WrapStore(cfg upspin.Config, ready <-chan struct{}, store upspin.StoreServer) upspin.StoreServer

WrapStore wraps the given StoreServer with a StoreServer that checks access permissions. It will only start polling the store permissions after the ready channel is closed.

Types

type Perm

type Perm struct {
	// contains filtered or unexported fields
}

Perm tracks the set of users with write access to a server, as specified by the Writers Group file. These might be users who can write blocks to a StoreServer or create a root on a DirServer.

func New

func New(cfg upspin.Config, ready <-chan struct{}, target upspin.UserName) *Perm

New creates a new Perm monitoring the target user's Writers Group file, resolving the DirServer using the given config. The target user is typically the user name of a server, such as a StoreServer or a DirServer.

func NewWithDir

func NewWithDir(cfg upspin.Config, ready <-chan struct{}, target upspin.UserName, dir upspin.DirServer) *Perm

NewWithDir creates a new Perm monitoring the target user's Writers Group file which must reside on the given DirServer. The target user is typically the user name of a server, such as a StoreServer or a DirServer.

func (*Perm) IsWriter

func (p *Perm) IsWriter(u upspin.UserName) bool

IsWriter reports whether the user has write privileges on this Perm.

func (*Perm) Update

func (p *Perm) Update() error

Update retrieves and parses the Group file that rules over the set of allowed writers. This is mostly only exported for testing, but servers may use it to force immediate updates.

func (*Perm) WrapDir

func (p *Perm) WrapDir(dir upspin.DirServer) upspin.DirServer

WrapDir wraps the given DirServer with a DirServer that checks root-creation permissions using Perm.

func (*Perm) WrapStore

func (p *Perm) WrapStore(store upspin.StoreServer) upspin.StoreServer

WrapStore wraps the given StoreServer with a StoreServer that checks access permissions using Perm.

Jump to

Keyboard shortcuts

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