roles

package
v0.0.0-...-c407d37 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Role

type Role struct {
	ID        uuid.UUID `json:"id" db:"id"`
	RoleType  RoleType  `json:"role_type" db:"role_type"`
	RoleName  RoleName  `json:"role_name" db:"role_name"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}

Role represents a Role for users

func (Role) TableName

func (r Role) TableName() string

TableName overrides the table name used by Pop.

func (*Role) Validate

func (r *Role) Validate(_ *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type RoleName

type RoleName string

RoleName represents the names of roles

type RoleType

type RoleType string

RoleType represents the types of users who can authenticate in the admin app

const (
	// RoleTypeTOO is the Transportation Ordering Officer Role
	RoleTypeTOO RoleType = "transportation_ordering_officer"
	// RoleTypeCustomer is the Customer Role
	RoleTypeCustomer RoleType = "customer"
	// RoleTypeTIO is the Transportation Invoicing Officer Role
	RoleTypeTIO RoleType = "transportation_invoicing_officer"
	// RoleTypeContractingOfficer is the Contracting Officer Role
	RoleTypeContractingOfficer RoleType = "contracting_officer"
	// RoleTypeServicesCounselor is the Services Counselor Role
	RoleTypeServicesCounselor RoleType = "services_counselor"
	// RoleTypePrimeSimulator is the PrimeSimulator Role
	RoleTypePrimeSimulator RoleType = "prime_simulator"
	// RoleTypeQaeCsr is the Quality Assurance and Customer Support Role
	RoleTypeQaeCsr RoleType = "qae_csr"
	// RoleTypePrime is the Role associated with actions performed by the Prime
	RoleTypePrime RoleType = "prime"
)

type Roles

type Roles []Role

Roles is a slice of Role objects

func FetchRolesForUser

func FetchRolesForUser(db *pop.Connection, userID uuid.UUID) (Roles, error)

FetchRolesForUser gets the active RoleTypes for the user

func (Roles) GetRole

func (rs Roles) GetRole(roleType RoleType) (Role, bool)

GetRole returns the role a Role Type

func (Roles) HasRole

func (rs Roles) HasRole(roleType RoleType) bool

HasRole validates if Role has a role of a particular type

Jump to

Keyboard shortcuts

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