access

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangePasswordRequest

type ChangePasswordRequest struct {
	Password string `url:"password" json:"password"` // The new password.
	Userid   string `url:"userid" json:"userid"`     // Full User ID, in the `name@realm` format.

}

type Client

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

func New

func New(c HTTPClient) *Client

func (*Client) ChangePassword

func (c *Client) ChangePassword(ctx context.Context, req ChangePasswordRequest) error

ChangePassword Change user password.

func (*Client) CreateTicket

func (c *Client) CreateTicket(ctx context.Context, req CreateTicketRequest) (CreateTicketResponse, error)

CreateTicket Create or verify authentication ticket.

func (*Client) GetTicket

func (c *Client) GetTicket(ctx context.Context) error

GetTicket Dummy. Useful for formatters which want to provide a login page.

func (*Client) Index

func (c *Client) Index(ctx context.Context) ([]IndexResponse, error)

Index Directory index.

func (*Client) Permissions

func (c *Client) Permissions(ctx context.Context, req PermissionsRequest) (map[string]interface{}, error)

Permissions Retrieve effective permissions of given user/token.

func (*Client) ReadAcl

func (c *Client) ReadAcl(ctx context.Context) ([]ReadAclResponse, error)

ReadAcl Get Access Control List (ACLs).

func (*Client) UpdateAcl

func (c *Client) UpdateAcl(ctx context.Context, req UpdateAclRequest) error

UpdateAcl Update Access Control List (add or remove permissions).

type CreateTicketRequest

type CreateTicketRequest struct {
	Password string `url:"password" json:"password"` // The secret password. This can also be a valid ticket.
	Username string `url:"username" json:"username"` // User name

	// The following parameters are optional
	NewFormat    *util.PVEBool `url:"new-format,omitempty" json:"new-format,omitempty"`       // With webauthn the format of half-authenticated tickts changed. New clients should pass 1 here and not worry about the old format. The old format is deprecated and will be retired with PVE-8.0
	Otp          *string       `url:"otp,omitempty" json:"otp,omitempty"`                     // One-time password for Two-factor authentication.
	Path         *string       `url:"path,omitempty" json:"path,omitempty"`                   // Verify ticket, and check if user have access 'privs' on 'path'
	Privs        *string       `url:"privs,omitempty" json:"privs,omitempty"`                 // Verify ticket, and check if user have access 'privs' on 'path'
	Realm        *string       `url:"realm,omitempty" json:"realm,omitempty"`                 // You can optionally pass the realm using this parameter. Normally the realm is simply added to the username <username>@<relam>.
	TfaChallenge *string       `url:"tfa-challenge,omitempty" json:"tfa-challenge,omitempty"` // The signed TFA challenge string the user wants to respond to.
}

type CreateTicketResponse

type CreateTicketResponse struct {
	Username string `url:"username" json:"username"`

	// The following parameters are optional
	Clustername         *string `url:"clustername,omitempty" json:"clustername,omitempty"`
	Csrfpreventiontoken *string `url:"CSRFPreventionToken,omitempty" json:"CSRFPreventionToken,omitempty"`
	Ticket              *string `url:"ticket,omitempty" json:"ticket,omitempty"`
}

type HTTPClient

type HTTPClient interface {
	Do(context.Context, string, string, interface{}, interface{}) error
}

type IndexResponse

type IndexResponse struct {
	Subdir string `url:"subdir" json:"subdir"`
}

type PermissionsRequest

type PermissionsRequest struct {

	// The following parameters are optional
	Path   *string `url:"path,omitempty" json:"path,omitempty"`     // Only dump this specific path, not the whole tree.
	Userid *string `url:"userid,omitempty" json:"userid,omitempty"` // User ID or full API token ID
}

type ReadAclResponse

type ReadAclResponse struct {
	Path   string `url:"path" json:"path"` // Access control path
	Roleid string `url:"roleid" json:"roleid"`
	Type   Type   `url:"type" json:"type"`
	Ugid   string `url:"ugid" json:"ugid"`

	// The following parameters are optional
	Propagate *util.PVEBool `url:"propagate,omitempty" json:"propagate,omitempty"` // Allow to propagate (inherit) permissions.
}

type Type added in v0.0.15

type Type string
const (
	Type_USER  Type = "user"
	Type_GROUP Type = "group"
	Type_TOKEN Type = "token"
)

func PtrType added in v0.0.15

func PtrType(i Type) *Type

type UpdateAclRequest

type UpdateAclRequest struct {
	Path  string `url:"path" json:"path"`   // Access control path
	Roles string `url:"roles" json:"roles"` // List of roles.

	// The following parameters are optional
	Delete    *util.PVEBool `url:"delete,omitempty" json:"delete,omitempty"`       // Remove permissions (instead of adding it).
	Groups    *string       `url:"groups,omitempty" json:"groups,omitempty"`       // List of groups.
	Propagate *util.PVEBool `url:"propagate,omitempty" json:"propagate,omitempty"` // Allow to propagate (inherit) permissions.
	Tokens    *string       `url:"tokens,omitempty" json:"tokens,omitempty"`       // List of API tokens.
	Users     *string       `url:"users,omitempty" json:"users,omitempty"`         // List of users.
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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