authz

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Roles_name = map[int32]string{
		0: "UNKNOWN",
		1: "REFLECTION",
		2: "VIEWER",
		3: "EDITOR",
		4: "OWNER",
	}
	Roles_value = map[string]int32{
		"UNKNOWN":    0,
		"REFLECTION": 1,
		"VIEWER":     2,
		"EDITOR":     3,
		"OWNER":      4,
	}
)

Enum value maps for Roles.

View Source
var (
	// optional authz.MethodOptions method = 5999;
	E_Method = &file_authz_authz_proto_extTypes[0]
)

Extension fields to descriptor.MethodOptions.

View Source
var (
	// optional authz.ServiceOptions service = 5999;
	E_Service = &file_authz_authz_proto_extTypes[1]
)

Extension fields to descriptor.ServiceOptions.

View Source
var ErrInvalidPermissionName = errors.New("authz: invalid permission name")
View Source
var File_authz_authz_proto protoreflect.FileDescriptor

Functions

func AllRoles added in v0.1.2

func AllRoles() []string

AllRoles provides a copy of all registered Role strings.

func RegisterRole

func RegisterRole(roleName string, permissions []PermissionId)

RegisterRole stores a role to permission mapping.

NOTE: RegisterRole is not goroutine safe, and is intended to be called from init() functions in generated code.

Types

type MessageRequiresPermission

type MessageRequiresPermission interface {
	AuthzRequiresPermission() PermissionId
}

type MethodOptions

type MethodOptions struct {
	Role        Roles    `protobuf:"varint,1,opt,name=role,proto3,enum=authz.Roles" json:"role,omitempty"`
	CustomRoles []string `protobuf:"bytes,2,rep,name=custom_roles,json=customRoles,proto3" json:"custom_roles,omitempty"`
	// contains filtered or unexported fields
}

func (*MethodOptions) Descriptor deprecated

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

Deprecated: Use MethodOptions.ProtoReflect.Descriptor instead.

func (*MethodOptions) GetCustomRoles

func (x *MethodOptions) GetCustomRoles() []string

func (*MethodOptions) GetRole

func (x *MethodOptions) GetRole() Roles

func (*MethodOptions) ProtoMessage

func (*MethodOptions) ProtoMessage()

func (*MethodOptions) ProtoReflect

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

func (*MethodOptions) Reset

func (x *MethodOptions) Reset()

func (*MethodOptions) String

func (x *MethodOptions) String() string

type Permission

type Permission struct {
	ID   PermissionId
	Name string
}

func AllPermissions added in v0.1.2

func AllPermissions() []Permission

AllPermissions provides a copy of all registered Permissions.

func PermissionFromID

func PermissionFromID(id PermissionId) Permission

PermissionFromID converts a in-memory PermissionId to a Permission

func PermissionFromName

func PermissionFromName(name string) (Permission, error)

PermissionFromName finds a Permission based on its string identifier.

func RegisterPermission

func RegisterPermission(permissionName string) Permission

RegisterPermission returns a in-memory integer identifier for a permission.

NOTE: RegisterPermission is not goroutine safe, and is intended to be called from init() functions in generated code.

type PermissionId

type PermissionId uint32

PermissionId is an in-process identifier for a Permission

func RolePermissions

func RolePermissions(roleName string) []PermissionId

RolePermissions returns a list of permissions from a service Role.

The returned PermissionId is only valid for within this process. Use PermissionLookup to find a portable string representation of an Permission

type Roles

type Roles int32
const (
	Roles_UNKNOWN    Roles = 0
	Roles_REFLECTION Roles = 1
	Roles_VIEWER     Roles = 2
	Roles_EDITOR     Roles = 3
	Roles_OWNER      Roles = 4
)

func (Roles) Descriptor

func (Roles) Descriptor() protoreflect.EnumDescriptor

func (Roles) Enum

func (x Roles) Enum() *Roles

func (Roles) EnumDescriptor deprecated

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

Deprecated: Use Roles.Descriptor instead.

func (Roles) Number

func (x Roles) Number() protoreflect.EnumNumber

func (Roles) String

func (x Roles) String() string

func (Roles) Type

func (Roles) Type() protoreflect.EnumType

type ServiceOptions

type ServiceOptions struct {
	Disabled bool `protobuf:"varint,1,opt,name=disabled,proto3" json:"disabled,omitempty"`
	// contains filtered or unexported fields
}

func (*ServiceOptions) Descriptor deprecated

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

Deprecated: Use ServiceOptions.ProtoReflect.Descriptor instead.

func (*ServiceOptions) GetDisabled

func (x *ServiceOptions) GetDisabled() bool

func (*ServiceOptions) ProtoMessage

func (*ServiceOptions) ProtoMessage()

func (*ServiceOptions) ProtoReflect

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

func (*ServiceOptions) Reset

func (x *ServiceOptions) Reset()

func (*ServiceOptions) String

func (x *ServiceOptions) String() string

Jump to

Keyboard shortcuts

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