Documentation ¶
Index ¶
- Variables
- func FullName(grant Grant) string
- func InitModels()
- type Grant
- type Manager
- func (m *Manager) DeleteOrgGrants(globalID string) error
- func (m *Manager) DeleteUserGrant(username, globalID string, grant Grant) error
- func (m *Manager) DeleteUserGrants(username, globalID string) error
- func (m *Manager) GetByGrant(grant Grant, globalID string) ([]SavedGrants, error)
- func (m *Manager) GetGrantsForUser(username string, globalID string) (*SavedGrants, error)
- func (m *Manager) UpdateGrant(username, globalID string, oldgrant, newgrant Grant) error
- func (m *Manager) UpserGrant(username, globalID string, grant Grant) error
- type SavedGrants
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrGrantTooLarge indicates that the size of the grant in bytes is larger than grantMaxLen ErrGrantTooLarge = fmt.Errorf("Grant size too large, max %d bytes", grantMaxLen) // ErrGrantTooSmall indicates that the size of the grant in bytes is less than grantMinLen ErrGrantTooSmall = fmt.Errorf("Grant size too small, max %d bytes", grantMinLen) // ErrInvalidGrantCharacter indicates that a grant contains an invalid character ErrInvalidGrantCharacter = errors.New("Invalid character in grant") )
View Source
var ( // ErrGrantLimitReached indicates that an organization can not add anymore grants for a user ErrGrantLimitReached = errors.New("Max amount of grants reached for this user by this organization") )
Functions ¶
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is used to store grants
func NewManager ¶
NewManager creates and initializes a new Manager
func (*Manager) DeleteOrgGrants ¶
DeleteOrgGrants remooves all grants given by an organization
func (*Manager) DeleteUserGrant ¶
DeleteUserGrant removes a single grant from a user for an organization
func (*Manager) DeleteUserGrants ¶
DeleteUserGrants removes all grants given to a user by an organization
func (*Manager) GetByGrant ¶
func (m *Manager) GetByGrant(grant Grant, globalID string) ([]SavedGrants, error)
GetByGrant returns all SavedGrants where the given grant is in the list of grants
func (*Manager) GetGrantsForUser ¶
func (m *Manager) GetGrantsForUser(username string, globalID string) (*SavedGrants, error)
GetGrantsForUser gets all the saved grants for a user and globalID
func (*Manager) UpdateGrant ¶
UpdateGrant updates an old grant to a new one
type SavedGrants ¶
type SavedGrants struct { Username string `json:"username"` GlobalID string `json:"globalid"` Grants []Grant `json:"grants"` }
SavedGrants links a username and globalid to stored grants
Click to show internal directories.
Click to hide internal directories.