Versions in this module Expand all Collapse all v0 v0.9.0 Sep 7, 2023 v0.8.0 Apr 17, 2023 Changes in this version + func IsResourceKindExist(kind ResourceKind) bool + func IsRoleExist(role Role) bool + type Action string + const EventbusCreate + const EventbusDelete + const EventbusGet + const EventbusGrant + const EventbusRead + const EventbusRevoke + const EventbusUpdate + const EventbusWrite + const NamespaceCreate + const NamespaceDelete + const NamespaceGet + const NamespaceGrant + const NamespaceRevoke + const RoleGrant + const RoleRevoke + const SubscriptionCreate + const SubscriptionDelete + const SubscriptionGet + const SubscriptionGrant + const SubscriptionRevoke + const SubscriptionUpdate + const TokenCreate + const TokenDelete + const TokenGet + const TokenList + const UserCreate + const UserDelete + const UserGet + const UserGetRole + type Attributes interface + GetAction func() Action + GetResourceID func() vanus.ID + GetResourceKind func() ResourceKind + func NewDefaultAttributes(resourceKind ResourceKind, resourceID vanus.ID, action Action) Attributes + type Authorization interface + Authorize func(ctx context.Context, user string, attributes Attributes) (bool, error) + func NewAuthorization(client RoleClient, cluster cluster.Cluster) Authorization + type List []Action + func (list List) Contains(action Action) bool + type MockAuthorization struct + func NewMockAuthorization(ctrl *gomock.Controller) *MockAuthorization + func (m *MockAuthorization) Authorize(ctx context.Context, user string, attributes Attributes) (bool, error) + func (m *MockAuthorization) EXPECT() *MockAuthorizationMockRecorder + type MockAuthorizationMockRecorder struct + func (mr *MockAuthorizationMockRecorder) Authorize(ctx, user, attributes interface{}) *gomock.Call + type MockRoleClient struct + func NewMockRoleClient(ctrl *gomock.Controller) *MockRoleClient + func (m *MockRoleClient) EXPECT() *MockRoleClientMockRecorder + func (m *MockRoleClient) GetUserEventbusID(ctx context.Context, user string) (vanus.IDList, error) + func (m *MockRoleClient) GetUserNamespaceID(ctx context.Context, user string) (vanus.IDList, error) + func (m *MockRoleClient) GetUserRole(ctx context.Context, user string) ([]*UserRole, error) + func (m *MockRoleClient) GetUserSubscriptionID(ctx context.Context, user string) (vanus.IDList, error) + func (m *MockRoleClient) IsClusterAdmin(ctx context.Context, user string) (bool, error) + type MockRoleClientMockRecorder struct + func (mr *MockRoleClientMockRecorder) GetUserEventbusID(ctx, user interface{}) *gomock.Call + func (mr *MockRoleClientMockRecorder) GetUserNamespaceID(ctx, user interface{}) *gomock.Call + func (mr *MockRoleClientMockRecorder) GetUserRole(ctx, user interface{}) *gomock.Call + func (mr *MockRoleClientMockRecorder) GetUserSubscriptionID(ctx, user interface{}) *gomock.Call + func (mr *MockRoleClientMockRecorder) IsClusterAdmin(ctx, user interface{}) *gomock.Call + type ResourceKind string + const ResourceCluster + const ResourceEventbus + const ResourceNamespace + const ResourceSubscription + const ResourceUnknown + type Role string + const RoleAdmin + const RoleClusterAdmin + const RoleEdit + const RoleRead + const RoleView + const RoleWrite + type RoleClient interface + GetUserEventbusID func(ctx context.Context, user string) (vanus.IDList, error) + GetUserNamespaceID func(ctx context.Context, user string) (vanus.IDList, error) + GetUserRole func(ctx context.Context, user string) ([]*UserRole, error) + GetUserSubscriptionID func(ctx context.Context, user string) (vanus.IDList, error) + IsClusterAdmin func(ctx context.Context, user string) (bool, error) + func NewBuiltInClient(cluster cluster.Cluster) RoleClient + type UserRole struct + BuiltIn bool + ResourceID vanus.ID + ResourceKind ResourceKind + Role Role + RoleID string + UserIdentifier string + func FromPbUserRole(from *metapb.UserRole) *UserRole + func (ur *UserRole) IsClusterAdmin() bool