rbac

package
v0.0.0-...-288c4de Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserHasPermission

func UserHasPermission(r *http.Request, project string, permission string) bool

UserHasPermission checks whether the requestor has a specific permission on a project.

func UserIsAdmin

func UserIsAdmin(r *http.Request) bool

UserIsAdmin checks whether the requestor is a global admin.

Types

type Server

type Server struct {
	ProjectsFunc func() (map[int64]string, error)
	// contains filtered or unexported fields
}

Server represents an RBAC server.

func NewServer

func NewServer(apiURL string, apiKey string, agentAuthURL string, agentUsername string, agentPrivateKey string, agentPublicKey string) (*Server, error)

NewServer returns a new RBAC server instance.

func (*Server) AddProject

func (r *Server) AddProject(id int64, name string) error

AddProject adds a new project resource to RBAC.

func (*Server) DeleteProject

func (r *Server) DeleteProject(id int64) error

DeleteProject adds a new project resource to RBAC.

func (*Server) RenameProject

func (r *Server) RenameProject(id int64, name string) error

RenameProject renames an existing project resource in RBAC.

func (*Server) StartStatusCheck

func (r *Server) StartStatusCheck()

StartStatusCheck runs a status checking loop.

func (*Server) StopStatusCheck

func (r *Server) StopStatusCheck()

StopStatusCheck stops the periodic status checker.

func (*Server) SyncProjects

func (r *Server) SyncProjects() error

SyncProjects updates the list of projects in RBAC.

func (*Server) UserAccess

func (r *Server) UserAccess(username string) (*UserAccess, error)

UserAccess returns a UserAccess struct for the user.

type UserAccess

type UserAccess struct {
	Admin    bool
	Projects map[string][]string
}

UserAccess struct for permission checks.

Jump to

Keyboard shortcuts

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