dbrole

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Corresponding *INSTANCE_* roles access is determined by the Instancer's configuration, allowing it to access records exclusively with a specific instance.

  • `TENANT_INSTANCE_READER` - has read access to its tenant instance's data
  • `INSTANCE_READER` - has read access to specific instance data
  • `TENANT_INSTANCE_WRITER` - has read & write access to its tenant instance's data
  • `INSTANCE_WRITER` - has read & write access to specific instance 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_INSTANCE_READER DbRole = "tenant_instance_reader"
	TENANT_READER          DbRole = "tenant_reader"
	INSTANCE_READER        DbRole = "instance_reader"
	READER                 DbRole = "reader"
	TENANT_INSTANCE_WRITER DbRole = "tenant_instance_writer"
	TENANT_WRITER          DbRole = "tenant_writer"
	INSTANCE_WRITER        DbRole = "instance_writer"
	WRITER                 DbRole = "writer"
	MAIN                   DbRole = "main"
)

func Max added in v0.0.10

func Max(dbRoles []DbRole) DbRole

func Min added in v0.0.10

func Min(dbRoles []DbRole) DbRole

func (DbRole) GetRoleWithInstancer added in v0.0.10

func (dbRole DbRole) GetRoleWithInstancer() DbRole

Map roles to instancer based when Instancer is set. Useful for backward compatibility when role Mapping do not reference *INSTANCE* roles, but an Instancer is configured to limit the access to an instance.

func (DbRole) IsDbRoleInstanceScoped added in v0.0.10

func (dbRole DbRole) IsDbRoleInstanceScoped() bool

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.

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