Documentation ¶
Index ¶
- Variables
- func AllRoles() []string
- func RegisterRole(roleName string, permissions []PermissionId)
- type MessageRequiresPermission
- type MethodOptions
- func (*MethodOptions) Descriptor() ([]byte, []int)deprecated
- func (x *MethodOptions) GetCustomRoles() []string
- func (x *MethodOptions) GetRole() Roles
- func (*MethodOptions) ProtoMessage()
- func (x *MethodOptions) ProtoReflect() protoreflect.Message
- func (x *MethodOptions) Reset()
- func (x *MethodOptions) String() string
- type Permission
- type PermissionId
- type Roles
- type ServiceOptions
Constants ¶
This section is empty.
Variables ¶
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.
var (
// optional authz.MethodOptions method = 5999;
E_Method = &file_authz_authz_proto_extTypes[0]
)
Extension fields to descriptor.MethodOptions.
var (
// optional authz.ServiceOptions service = 5999;
E_Service = &file_authz_authz_proto_extTypes[1]
)
Extension fields to descriptor.ServiceOptions.
var ErrInvalidPermissionName = errors.New("authz: invalid permission name")
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
func (Roles) Descriptor ¶
func (Roles) Descriptor() protoreflect.EnumDescriptor
func (Roles) EnumDescriptor
deprecated
func (Roles) Number ¶
func (x Roles) Number() protoreflect.EnumNumber
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