permission

package
v3.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Permission constants and helper functions for defining routes. These should match the permissions defined in Auth0 JWT tokens that come in with requests

Index

Constants

View Source
const PermBlessQuantification = "write:bless-quant"

Quantification "blessing" - marking it as the correct one to use

View Source
const PermCreateQuantification = "write:quantification"

Quantification creation

View Source
const PermDownloadPiquant = "download:piquant"

Downloading PIQUANT builds - not fully finished, likely only serving linux binaries if our build system still creates them

View Source
const PermEditDiffractionPeaks = "write:diffraction-peaks"

Editing diffraction peaks (manually creating new ones, or marking detected ones as deleted)

View Source
const PermExportMap = "export:map"

Ability to export various data

View Source
const PermPublic = "public"

Public endpoints, mainly for getting the API version

View Source
const PermPublishQuantification = "write:publish-quant"

Quantification publishing - to PDS

View Source
const PermReadDataAnalysis = "read:data-analysis"

Reading ROI, element set, annotation, expressions, modules, tags, quantifications, RGB mixes

View Source
const PermReadDiffractionPeaks = "read:diffraction-peaks"

Reading diffraction peaks DB that's created along with a dataset

View Source
const PermReadLogs = "read:logs"

Reading logs and log level of API

View Source
const PermReadPIXLISESettings = "read:pixlise-settings"

Reading current view state, collections, workspaces

View Source
const PermReadPiquantConfig = "read:piquant-config"

Reading piquant detector config and piquant config files

View Source
const PermReadPiquantJobs = "read:piquant-jobs"

Reads all piquant jobs - admin level

View Source
const PermReadUserRoles = "read:user-roles"

User role access - reading user listing, role listing and user/role individual gets

View Source
const PermReadUserSettings = "read:user-settings"

Get users own config and data collection agreement

View Source
const PermSuperAdmin = "access:super-admin"

Super Admin - not a real permission and mainly used to bypass tests

View Source
const PermTestEndpoints = "write:test-endpoints"

Ability to call test endpoints (admin feature)

View Source
const PermWriteDataAnalysis = "write:data-analysis"

Write/delete/edit ROI, element set, annotation, expressions, modules, tags, quantifications, RGB mixes

View Source
const PermWriteDataset = "write:dataset"

Allows editing custom fields/images on dataset, or creating new ones (using zipped MSA files, etc)

View Source
const PermWriteLogLevel = "write:log-level"

Changing API log level (admin feature really!)

View Source
const PermWriteMetrics = "write:metrics"

For saving metrics - aka user tracking info, UI behaviours, for research purposes

View Source
const PermWritePIXLISESettings = "write:pixlise-settings"

Writing current view state, collections, workspaces

View Source
const PermWritePiquantConfig = "write:piquant-config"

Writing piquant config (for spectroscopists who know what they're doing with piquant)

View Source
const PermWriteSharedAnnotation = "write:shared-annotation"

Sharing annotations (of spectrum chart)

View Source
const PermWriteSharedElementSet = "write:shared-element-set"

Sharing element sets

View Source
const PermWriteSharedExpression = "write:shared-expression"

Sharing expressions

View Source
const PermWriteSharedQuantification = "write:shared-quantification"

Sharing quantifications

View Source
const PermWriteSharedROI = "write:shared-roi"

Sharing ROI

View Source
const PermWriteUserRoles = "write:user-roles"

Writing/deleting user roles, and editing users in bulk

View Source
const PermWriteUserSettings = "write:user-settings"

Writing users own config and data collection agreement

Variables

This section is empty.

Functions

func CheckAndUpdatePublicDataset added in v3.4.1

func CheckAndUpdatePublicDataset(fs fileaccess.FileAccess, configBucket string, datasetID string, datasetsAuth DatasetsAuth) (bool, error)

func CheckIsObjectInPublicSet added in v3.4.1

func CheckIsObjectInPublicSet(publicObjectsList []string, objectID string) (bool, error)

func CheckIsObjectPublic added in v3.4.1

func CheckIsObjectPublic(fs fileaccess.FileAccess, configBucket string, objectType PublicObjectEnumType, objectID string) (bool, error)

func CheckIsPublicDataset added in v3.4.1

func CheckIsPublicDataset(fs fileaccess.FileAccess, configBucket string, datasetID string) (bool, error)

Check if the dataset CAN be public

func CheckIsPublicDatasetWithSharedObjects added in v3.4.1

func CheckIsPublicDatasetWithSharedObjects(fs fileaccess.FileAccess, configBucket string, datasetID string) (bool, error)

Check if the dataset is both public and has shared objects in it

func GetAccessibleGroups

func GetAccessibleGroups(permissions map[string]bool) map[string]bool

Get all groups that are accessible by the list of permissions provided. This means basically returning what's after access: in each permission

func UserCanAccessDataset

func UserCanAccessDataset(userInfo pixlUser.UserInfo, summary datasetModel.SummaryFileData, fs fileaccess.FileAccess, configBucket string) error

Returns nil if user CAN access it, otherwise a api.StatusError with the right HTTP error code

func UserCanAccessDatasetWithSummaryDownload

func UserCanAccessDatasetWithSummaryDownload(fs fileaccess.FileAccess, userInfo pixlUser.UserInfo, dataBucket string, configBucket string, datasetID string) (datasetModel.SummaryFileData, error)

Checking if the user can access a given dataset - use this if you don't already have summary info downloaded

Types

type DatasetAuthInfo added in v3.4.1

type DatasetAuthInfo struct {
	DatasetID               string `json:"dataset_id"`
	Public                  bool   `json:"public"`
	PublicReleaseUTCTimeSec int64  `json:"public_release_utc_time_sec"`
	Sol                     string `json:"sol"`
}

DatasetAuthInfo - Structure of dataset auth JSON files This is used to check whether an individual dataset CAN be public or not

type DatasetsAuth added in v3.4.1

type DatasetsAuth map[string]DatasetAuthInfo

DatasetsAuth - Structure of dataset auth JSON files This is used to check the public status of all datasets

func ReadDatasetsAuth added in v3.4.1

func ReadDatasetsAuth(fs fileaccess.FileAccess, configBucket string, s3Path string) (DatasetsAuth, error)

type PublicObjectEnumType added in v3.4.1

type PublicObjectEnumType int64

These enums keep track of the different types of objects that can be public

const (
	PublicObjectDataset PublicObjectEnumType = iota
	PublicObjectROI
	PublicObjectExpression
	PublicObjectModule
	PublicObjectRGBMix
	PublicObjectQuantification
	PublicObjectCollection
	PublicObjectWorkspace
)

type PublicObjectsAuth added in v3.4.1

type PublicObjectsAuth struct {
	Datasets        []string // This is a list of all datasets that are public AND have public objects in them
	ROIs            []string
	Expressions     []string
	Modules         []string
	RGBMixes        []string
	Quantifications []string
	Collections     []string
	Workspaces      []string
}

This is a list of all the objects that are publicly accessible. This is used to determine whether a user has access to an object or not. If the object is not in this list, then the user must have access to it in order to see it.

func GetPublicObjectsAuth added in v3.4.1

func GetPublicObjectsAuth(fs fileaccess.FileAccess, configBucket string, isPublicUser bool) (PublicObjectsAuth, error)

func ReadPublicObjectsAuth added in v3.4.1

func ReadPublicObjectsAuth(fs fileaccess.FileAccess, configBucket string, s3Path string) (PublicObjectsAuth, error)

Jump to

Keyboard shortcuts

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