scope

package
v0.0.0-...-e14d643 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	S_name = map[int32]string{
		0:   "undef",
		1:   "All",
		2:   "Predict",
		4:   "Inputs_Add",
		5:   "Inputs_Get",
		7:   "Inputs_Patch",
		8:   "Inputs_Delete",
		9:   "Outputs_Patch",
		10:  "Concepts_Add",
		11:  "Concepts_Get",
		12:  "Concepts_Patch",
		13:  "Concepts_Delete",
		14:  "Models_Add",
		15:  "Models_Get",
		16:  "Models_Patch",
		17:  "Models_Delete",
		26:  "Models_Train",
		27:  "Models_Sync",
		142: "ModelExports_Get",
		143: "ModelExports_Add",
		18:  "Workflows_Add",
		19:  "Workflows_Get",
		20:  "Workflows_Patch",
		21:  "Workflows_Delete",
		96:  "WorkflowMetrics_Get",
		97:  "WorkflowMetrics_Add",
		98:  "WorkflowMetrics_Delete",
		24:  "TSNEVisualizations_Add",
		25:  "TSNEVisualizations_Get",
		37:  "Annotations_Add",
		38:  "Annotations_Get",
		39:  "Annotations_Patch",
		40:  "Annotations_Delete",
		41:  "Collectors_Add",
		42:  "Collectors_Get",
		43:  "Collectors_Delete",
		44:  "Apps_Add",
		45:  "Apps_Get",
		46:  "Apps_Delete",
		47:  "Keys_Add",
		48:  "Keys_Get",
		49:  "Keys_Delete",
		51:  "Collaborators_Add",
		50:  "Collaborators_Get",
		52:  "Collaborators_Delete",
		54:  "Metrics_Add",
		53:  "Metrics_Get",
		63:  "Metrics_Delete",
		55:  "Tasks_Add",
		56:  "Tasks_Get",
		70:  "Tasks_Delete",
		57:  "PasswordPolicies_Add",
		58:  "PasswordPolicies_Get",
		59:  "PasswordPolicies_Delete",
		67:  "LabelOrders_Get",
		68:  "LabelOrders_Add",
		69:  "LabelOrders_Delete",
		71:  "UserFeatureConfigs_Get",
		102: "FindDuplicateAnnotationsJobs_Add",
		103: "FindDuplicateAnnotationsJobs_Get",
		104: "FindDuplicateAnnotationsJobs_Delete",
		105: "Datasets_Get",
		106: "Datasets_Add",
		107: "Datasets_Delete",
		108: "Modules_Add",
		109: "Modules_Get",
		110: "Modules_Delete",
		111: "InstalledModuleVersions_Add",
		112: "InstalledModuleVersions_Get",
		113: "InstalledModuleVersions_Delete",
		3:   "Search",
		114: "SavedSearch_Get",
		115: "SavedSearch_Add",
		116: "SavedSearch_Delete",
		117: "ModelVersionPublications_Add",
		118: "ModelVersionPublications_Delete",
		119: "WorkflowPublications_Add",
		120: "WorkflowPublications_Delete",
		121: "BulkOperation_Add",
		122: "BulkOperation_Get",
		123: "BulkOperation_Delete",
		124: "HistoricalUsage_Get",
		128: "Uploads_Get",
		129: "Uploads_Add",
		130: "Uploads_Delete",
		131: "Runners_Get",
		132: "Runners_Add",
		133: "Runners_Delete",
		134: "RunnerItems_Get",
		135: "RunnerItems_Add",
	}
	S_value = map[string]int32{
		"undef":                               0,
		"All":                                 1,
		"Predict":                             2,
		"Inputs_Add":                          4,
		"Inputs_Get":                          5,
		"Inputs_Patch":                        7,
		"Inputs_Delete":                       8,
		"Outputs_Patch":                       9,
		"Concepts_Add":                        10,
		"Concepts_Get":                        11,
		"Concepts_Patch":                      12,
		"Concepts_Delete":                     13,
		"Models_Add":                          14,
		"Models_Get":                          15,
		"Models_Patch":                        16,
		"Models_Delete":                       17,
		"Models_Train":                        26,
		"Models_Sync":                         27,
		"ModelExports_Get":                    142,
		"ModelExports_Add":                    143,
		"Workflows_Add":                       18,
		"Workflows_Get":                       19,
		"Workflows_Patch":                     20,
		"Workflows_Delete":                    21,
		"WorkflowMetrics_Get":                 96,
		"WorkflowMetrics_Add":                 97,
		"WorkflowMetrics_Delete":              98,
		"TSNEVisualizations_Add":              24,
		"TSNEVisualizations_Get":              25,
		"Annotations_Add":                     37,
		"Annotations_Get":                     38,
		"Annotations_Patch":                   39,
		"Annotations_Delete":                  40,
		"Collectors_Add":                      41,
		"Collectors_Get":                      42,
		"Collectors_Delete":                   43,
		"Apps_Add":                            44,
		"Apps_Get":                            45,
		"Apps_Delete":                         46,
		"Keys_Add":                            47,
		"Keys_Get":                            48,
		"Keys_Delete":                         49,
		"Collaborators_Add":                   51,
		"Collaborators_Get":                   50,
		"Collaborators_Delete":                52,
		"Metrics_Add":                         54,
		"Metrics_Get":                         53,
		"Metrics_Delete":                      63,
		"Tasks_Add":                           55,
		"Tasks_Get":                           56,
		"Tasks_Delete":                        70,
		"PasswordPolicies_Add":                57,
		"PasswordPolicies_Get":                58,
		"PasswordPolicies_Delete":             59,
		"LabelOrders_Get":                     67,
		"LabelOrders_Add":                     68,
		"LabelOrders_Delete":                  69,
		"UserFeatureConfigs_Get":              71,
		"FindDuplicateAnnotationsJobs_Add":    102,
		"FindDuplicateAnnotationsJobs_Get":    103,
		"FindDuplicateAnnotationsJobs_Delete": 104,
		"Datasets_Get":                        105,
		"Datasets_Add":                        106,
		"Datasets_Delete":                     107,
		"Modules_Add":                         108,
		"Modules_Get":                         109,
		"Modules_Delete":                      110,
		"InstalledModuleVersions_Add":         111,
		"InstalledModuleVersions_Get":         112,
		"InstalledModuleVersions_Delete":      113,
		"Search":                              3,
		"SavedSearch_Get":                     114,
		"SavedSearch_Add":                     115,
		"SavedSearch_Delete":                  116,
		"ModelVersionPublications_Add":        117,
		"ModelVersionPublications_Delete":     118,
		"WorkflowPublications_Add":            119,
		"WorkflowPublications_Delete":         120,
		"BulkOperation_Add":                   121,
		"BulkOperation_Get":                   122,
		"BulkOperation_Delete":                123,
		"HistoricalUsage_Get":                 124,
		"Uploads_Get":                         128,
		"Uploads_Add":                         129,
		"Uploads_Delete":                      130,
		"Runners_Get":                         131,
		"Runners_Add":                         132,
		"Runners_Delete":                      133,
		"RunnerItems_Get":                     134,
		"RunnerItems_Add":                     135,
	}
)

Enum value maps for S.

View Source
var (
	// indicates whether the given scope should be returned by the Get /scopes/ call
	// or any other call that returns list of available perms.
	//
	// optional bool clarfai_exposed = 80318;
	E_ClarfaiExposed = &file_proto_clarifai_auth_scope_scope_proto_extTypes[0]
	// TODO: We have no way of picking extension field numbers within clarifai to guarantee
	// uniqueness.  Note: 50000-99999 are for organizational use (like this)
	//
	// repeated clarifai.auth.scope.S clarifai_depending_scopes = 80319;
	E_ClarifaiDependingScopes = &file_proto_clarifai_auth_scope_scope_proto_extTypes[1]
)

Extension fields to descriptorpb.EnumValueOptions.

View Source
var File_proto_clarifai_auth_scope_scope_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type S

type S int32

Next index: 41 NOTE: When updating the list of "clarifai_exposed" scopes, please also update the TestScopes function in main_key_test.go and TestGetExposedScopes function in scope_test.go

The dependencies listed for each scope are simply recommendations so that a user cannot make a key that would be useless. Beyond the key creation they are not enforced but rather the scopes are enforce when data is accessed.

There is the following conventions in place, make sure you add them to the scopes for all new resource types:

1. *_Add requires the corresponding _Get. 2. *_Delete requires the corresponding _Add and _Get. 3. *_Patch is deprecated and not check anywhere.

Think of the dependencies in this file at the DB level. If you cannot make a DB call to Get, Add or Delete a resource without having access to another resource then you should add it here. That should for the most part be the same resource type. In service.proto for the API level you will also specify cl_depending_scopes for each API endpoint. Those cover cases where an endpoint might need to access more than just that one resource type in order to operate (ie. API handlers that make multiple DB calls of various resource types likely have more cl_depending_scopes than the ones listed below). For example: PostCollectors to create a collector we make sure that you can do model predictions, get concepts, etc. so that you don't have a collector that would be useless at the end of that API handler but below you can see that the dependencies of Collector scopes are only on other Collector scopes.

const (
	// introduce undef so that the zero (default/unset) value of the enum is not a real
	// permission.  undef is only present for this purpose and should not be used
	// to indicate any "real" value.
	S_undef S = 0
	S_All   S = 1
	// Make an rpc to our prediction services.
	S_Predict S = 2
	// Write to the inputs table in the DB.
	S_Inputs_Add S = 4
	// Read from the inputs table in the DB.
	S_Inputs_Get S = 5
	// To patch we need read/write.
	// Deprecated.
	// Optionally needs Concepts_Add.
	//
	// Deprecated: Do not use.
	S_Inputs_Patch S = 7
	// To delete we need read/write
	S_Inputs_Delete S = 8
	// Deprecated.
	//
	// Deprecated: Do not use.
	S_Outputs_Patch S = 9
	// Write to the concepts DB tables.
	S_Concepts_Add S = 10
	// Read from the concepts DB tables.
	S_Concepts_Get S = 11
	// To patch we need read/write.
	// Deprecated
	//
	// Deprecated: Do not use.
	S_Concepts_Patch S = 12
	// To delete we need read/write.
	// Note: not implemented.
	S_Concepts_Delete S = 13
	// Write to the models DB tables.
	S_Models_Add S = 14
	// Read from the models and models versions DB tables.
	S_Models_Get S = 15
	// To patch we need read/write.
	// Deprecated.
	//
	// Deprecated: Do not use.
	S_Models_Patch S = 16
	// To delete we need read/write.
	S_Models_Delete S = 17
	// Note: Models_Train is effectively doing POST /models/{models_id}/versions so it's treated that
	// way in terms of data access under the hood.
	// Write to the model versions DB table.
	S_Models_Train S = 26
	// Internal only model syncing.
	S_Models_Sync S = 27
	// To get model version export
	S_ModelExports_Get S = 142
	// To create model version export
	S_ModelExports_Add S = 143
	// Write to the workflows DB table.
	S_Workflows_Add S = 18
	// Read from the workflows DB table.
	S_Workflows_Get S = 19
	// To patch we need read/write.
	// Deprecated.
	//
	// Deprecated: Do not use.
	S_Workflows_Patch S = 20
	// To delete we need read/write.
	S_Workflows_Delete       S = 21
	S_WorkflowMetrics_Get    S = 96
	S_WorkflowMetrics_Add    S = 97
	S_WorkflowMetrics_Delete S = 98
	// Write to the visualizations DB table.
	// Deprecated
	//
	// Deprecated: Do not use.
	S_TSNEVisualizations_Add S = 24
	// Read from the visualizations DB table.
	// Deprecated
	//
	// Deprecated: Do not use.
	S_TSNEVisualizations_Get S = 25
	// Write to the annotations DB table.
	S_Annotations_Add S = 37
	// Read from the annotations DB table.
	S_Annotations_Get S = 38
	// To patch we need read/write.
	// Deprecated.
	//
	// Deprecated: Do not use.
	S_Annotations_Patch S = 39
	// To delete we need read/write.
	S_Annotations_Delete S = 40
	// Write to the collectors DB table.
	S_Collectors_Add S = 41
	// Read from the collectors DB table.
	S_Collectors_Get S = 42
	// To delete we need read/write.
	S_Collectors_Delete S = 43
	// Write to the apps DB table.
	S_Apps_Add S = 44
	// Read from the apps DB table.
	S_Apps_Get S = 45
	// To delete we need read/write.
	S_Apps_Delete S = 46
	// Write to the keys DB table.
	S_Keys_Add S = 47
	// Read from the keys DB table.
	S_Keys_Get S = 48
	// To delete we need read/write.
	S_Keys_Delete S = 49
	// Write to the app sharing DB table
	S_Collaborators_Add S = 51
	// Read from the app sharing DB table
	S_Collaborators_Get S = 50
	// To delete we need read/write
	S_Collaborators_Delete S = 52
	// Write to the metrics table
	S_Metrics_Add S = 54
	// Read from metrics table
	S_Metrics_Get S = 53
	// To delete we need read/write
	S_Metrics_Delete S = 63
	// Write to tasks DB table.
	S_Tasks_Add S = 55
	// Read from the tasks DB table.
	S_Tasks_Get S = 56
	// To delete we need read/write
	S_Tasks_Delete S = 70
	// Write to the password_policies DB table
	S_PasswordPolicies_Add S = 57
	// Read from the password_policies DB table
	S_PasswordPolicies_Get S = 58
	// To delete password_policies we need read/write
	S_PasswordPolicies_Delete S = 59
	// Read from label orders table
	S_LabelOrders_Get S = 67
	// Write to label orders table
	S_LabelOrders_Add S = 68
	// To delete label orders we need read/write
	S_LabelOrders_Delete S = 69
	// Read from user_feature_configs table
	S_UserFeatureConfigs_Get S = 71
	// CRUD on FindDuplicateAnnotationsJobs table
	S_FindDuplicateAnnotationsJobs_Add    S = 102
	S_FindDuplicateAnnotationsJobs_Get    S = 103
	S_FindDuplicateAnnotationsJobs_Delete S = 104
	S_Datasets_Get                        S = 105
	S_Datasets_Add                        S = 106
	S_Datasets_Delete                     S = 107
	// Write to the modules DB tables.
	S_Modules_Add S = 108
	// Read from the modules and modules versions DB tables.
	S_Modules_Get S = 109
	// To delete we need read/write.
	S_Modules_Delete S = 110
	// Write to the InstalledModuleVersions DB tables.
	S_InstalledModuleVersions_Add S = 111
	// Read from the InstalledModuleVersions and InstalledModuleVersions versions DB tables.
	S_InstalledModuleVersions_Get S = 112
	// To delete we need read/write.
	S_InstalledModuleVersions_Delete S = 113
	// Make an rpc to our search services.
	S_Search S = 3
	// To get a saved search.
	S_SavedSearch_Get S = 114
	// To add a saved search
	S_SavedSearch_Add S = 115
	// To delete a saved search
	S_SavedSearch_Delete              S = 116
	S_ModelVersionPublications_Add    S = 117
	S_ModelVersionPublications_Delete S = 118
	S_WorkflowPublications_Add        S = 119
	S_WorkflowPublications_Delete     S = 120
	// To write bulk operations to the DB
	S_BulkOperation_Add S = 121
	// To Read Bulk Operations from the DB
	S_BulkOperation_Get S = 122
	// To Delete Bulk Operations from the DB
	S_BulkOperation_Delete S = 123
	// To read historical usage from usage.dashboard_items table
	S_HistoricalUsage_Get S = 124
	// To read uploaded files and archives info from Uploads endpoints
	S_Uploads_Get S = 128
	// To upload files or archives through the Uploads endpoints
	S_Uploads_Add    S = 129
	S_Uploads_Delete S = 130
	// To control remote runners
	S_Runners_Get     S = 131
	S_Runners_Add     S = 132
	S_Runners_Delete  S = 133
	S_RunnerItems_Get S = 134
	S_RunnerItems_Add S = 135
)

func (S) Descriptor

func (S) Descriptor() protoreflect.EnumDescriptor

func (S) Enum

func (x S) Enum() *S

func (S) EnumDescriptor deprecated

func (S) EnumDescriptor() ([]byte, []int)

Deprecated: Use S.Descriptor instead.

func (S) Number

func (x S) Number() protoreflect.EnumNumber

func (S) String

func (x S) String() string

func (S) Type

func (S) Type() protoreflect.EnumType

type ScopeList

type ScopeList struct {

	// These are the list of low-level scopes to check from the enum below.
	Scopes []S `protobuf:"varint,1,rep,packed,name=scopes,proto3,enum=clarifai.auth.scope.S" json:"scopes,omitempty"`
	// This is a list of fully qualified grpc names to check.
	Endpoints []string `protobuf:"bytes,2,rep,name=endpoints,proto3" json:"endpoints,omitempty"`
	// contains filtered or unexported fields
}

func (*ScopeList) Descriptor deprecated

func (*ScopeList) Descriptor() ([]byte, []int)

Deprecated: Use ScopeList.ProtoReflect.Descriptor instead.

func (*ScopeList) GetEndpoints

func (x *ScopeList) GetEndpoints() []string

func (*ScopeList) GetScopes

func (x *ScopeList) GetScopes() []S

func (*ScopeList) ProtoMessage

func (*ScopeList) ProtoMessage()

func (*ScopeList) ProtoReflect

func (x *ScopeList) ProtoReflect() protoreflect.Message

func (*ScopeList) Reset

func (x *ScopeList) Reset()

func (*ScopeList) String

func (x *ScopeList) String() string

Jump to

Keyboard shortcuts

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