authstore

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePermissionParams

type CreatePermissionParams struct {
	PermissionID          uuid.UUID
	PermissionExtlID      string
	Resource              string
	Operation             string
	PermissionDescription string
	Active                sql.NullBool
	CreateAppID           uuid.UUID
	CreateUserID          uuid.NullUUID
	CreateTimestamp       time.Time
	UpdateAppID           uuid.UUID
	UpdateUserID          uuid.NullUUID
	UpdateTimestamp       time.Time
}

type CreateRoleParams

type CreateRoleParams struct {
	RoleID          uuid.UUID
	RoleExtlID      string
	RoleCd          string
	RoleDescription string
	Active          sql.NullBool
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreateRolePermissionParams

type CreateRolePermissionParams struct {
	RoleID          uuid.UUID
	PermissionID    uuid.UUID
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type CreateRoleUserParams

type CreateRoleUserParams struct {
	RoleID          uuid.UUID
	UserID          uuid.UUID
	CreateAppID     uuid.UUID
	CreateUserID    uuid.NullUUID
	CreateTimestamp time.Time
	UpdateAppID     uuid.UUID
	UpdateUserID    uuid.NullUUID
	UpdateTimestamp time.Time
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type IsAuthorizedParams

type IsAuthorizedParams struct {
	Resource  string
	Operation string
	UserID    uuid.UUID
}

type Permission

type Permission struct {
	// The unique ID for the table.
	PermissionID uuid.UUID
	// Unique External ID to be given to outside callers.
	PermissionExtlID string
	// A human-readable string which represents a resource (e.g. an HTTP route or document, etc.).
	Resource string
	// A string representing the action taken on the resource (e.g. POST, GET, edit, etc.)
	Operation string
	// A description of what the permission is granting, e.g. "grants ability to edit a billing document".
	PermissionDescription string
	// A boolean denoting whether the permission is active (true) or not (false).
	Active sql.NullBool
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

The permission table stores an approval of a mode of access to a resource.

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreatePermission

func (q *Queries) CreatePermission(ctx context.Context, arg CreatePermissionParams) (int64, error)

func (*Queries) CreateRole

func (q *Queries) CreateRole(ctx context.Context, arg CreateRoleParams) (int64, error)

func (*Queries) CreateRolePermission

func (q *Queries) CreateRolePermission(ctx context.Context, arg CreateRolePermissionParams) (int64, error)

func (*Queries) CreateRoleUser

func (q *Queries) CreateRoleUser(ctx context.Context, arg CreateRoleUserParams) (int64, error)

func (*Queries) FindAllPermissions

func (q *Queries) FindAllPermissions(ctx context.Context) ([]Permission, error)

func (*Queries) IsAuthorized

func (q *Queries) IsAuthorized(ctx context.Context, arg IsAuthorizedParams) (uuid.UUID, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type Role

type Role struct {
	// The unique ID for the table.
	RoleID uuid.UUID
	// Unique External ID to be given to outside callers.
	RoleExtlID string
	// A human-readable code which represents the role.
	RoleCd string
	// A longer description of the role.
	RoleDescription string
	// A boolean denoting whether the role is active (true) or not (false).
	Active sql.NullBool
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

The role table stores a job function or title which defines an authority level.

type RolePermission

type RolePermission struct {
	// The unique role which can have 1 to many permissions set in this table.
	RoleID uuid.UUID
	// The unique permission that is being given to the role.
	PermissionID uuid.UUID
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

The role_permission table stores which roles have which permissions.

type RoleUser

type RoleUser struct {
	// The unique role which can have one to many users set in this table.
	RoleID uuid.UUID
	// The unique user that is being given the role.
	UserID uuid.UUID
	// The application which created this record.
	CreateAppID uuid.UUID
	// The user which created this record.
	CreateUserID uuid.NullUUID
	// The timestamp when this record was created.
	CreateTimestamp time.Time
	// The application which performed the most recent update to this record.
	UpdateAppID uuid.UUID
	// The user which performed the most recent update to this record.
	UpdateUserID uuid.NullUUID
	// The timestamp when the record was updated most recently.
	UpdateTimestamp time.Time
}

The role_user table stores which roles have which users.

Jump to

Keyboard shortcuts

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