dbrole

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

 DAL uses 4 database roles/users to perform all operations,

	- `TENANT_READER` - has read access to its tenant's data
	- `READER` - has read access to all tenants' data
	- `TENANT_WRITER` - has read & write access to its tenant's data
	- `WRITER` - has read & write access to all tenants' data

 DAL allows to map a user's service role to the DB role that will be used for
 that user. If a user has multiple service roles which map to several DB roles,
 the DB role with the most extensive privileges will be used (see `DbRoles()`
 for reference to ordered list of DbRoles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbRole

type DbRole string

DbRole Database roles/users.

const (
	// NO_ROLE DB Roles.
	NO_ROLE       DbRole = ""
	TENANT_READER DbRole = "tenant_reader"
	READER        DbRole = "reader"
	TENANT_WRITER DbRole = "tenant_writer"
	WRITER        DbRole = "writer"
	MAIN          DbRole = "main"
)

func (DbRole) IsDbRoleTenantScoped

func (dbRole DbRole) IsDbRoleTenantScoped() bool

type DbRoleSlice

type DbRoleSlice []DbRole // Needed for sorting records

func DbRoles

func DbRoles() DbRoleSlice

Returns *Ordered* slice of DbRoles. A reader role is always considered to have fewer permissions than a writer role. and a tenant-specific reader/writer role is always considered to have fewer permissions, than a non-tenant specific reader/writer role, respectively. NO_ROLE < TENANT_READER < READER < TENANT_WRITER < WRITER.

func (DbRoleSlice) Len

func (a DbRoleSlice) Len() int

func (DbRoleSlice) Less

func (a DbRoleSlice) Less(i, j int) bool

Returns true if the first role has fewer permissions than the second role, and true if the two roles are the same or the second role has more permissions.

func (DbRoleSlice) Swap

func (a DbRoleSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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