milvus-io--milvus
498b235461
Build and test / Build and test AMD64 Ubuntu 22.04 (push) Failing after 0s
Publish Builder / amazonlinux2023 (push) Failing after 1s
Build and test / UT for Go (push) Has been skipped
Publish KRTE Images / KRTE (push) Failing after 1s
Build and test / Integration Test (push) Has been skipped
Build and test / Upload Code Coverage (push) Has been skipped
Publish Builder / rockylinux9 (push) Failing after 1s
Publish Builder / ubuntu22.04 (push) Failing after 0s
Publish Builder / ubuntu24.04 (push) Failing after 0s
Publish Gpu Builder / publish-gpu-builder (push) Failing after 1s
Publish Test Images / PyTest (push) Failing after 0s
Build and test / UT for Cpp (push) Has been cancelled
63 行
2.7 KiB
Go
63 行
2.7 KiB
Go
package rootcoord
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/cockroachdb/errors"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v3/milvuspb"
|
|
"github.com/milvus-io/milvus/pkg/v3/proto/internalpb"
|
|
)
|
|
|
|
var (
|
|
errUserNotFound = errors.New("user not found")
|
|
errUserAlreadyExists = errors.New("user already exists")
|
|
|
|
errRoleAlreadyExists = errors.New("role already exists")
|
|
errRoleNotExists = errors.New("role not exists")
|
|
|
|
errEmptyRBACMeta = errors.New("rbac meta is empty")
|
|
errNotCustomPrivilegeGroup = errors.New("not a custom privilege group")
|
|
)
|
|
|
|
type RBACChecker interface {
|
|
// CheckIfAddCredential checks if the credential can be added.
|
|
// if the credential already exists, it will return errUserAlreadyExists.
|
|
CheckIfAddCredential(ctx context.Context, req *internalpb.CredentialInfo) error
|
|
|
|
// CheckIfUpdateCredential checks if the credential can be updated.
|
|
// if the credential not exists, it will return errUserNotFound.
|
|
CheckIfUpdateCredential(ctx context.Context, req *internalpb.CredentialInfo) error
|
|
|
|
// CheckIfDeleteCredential checks if the credential can be deleted.
|
|
// if the credential not exists, it will return errUserNotFound.
|
|
CheckIfDeleteCredential(ctx context.Context, req *milvuspb.DeleteCredentialRequest) error
|
|
|
|
// CheckIfCreateRole checks if the role can be created.
|
|
// if the role already exists, it will return errRoleAlreadyExists.
|
|
CheckIfCreateRole(ctx context.Context, req *milvuspb.CreateRoleRequest) error
|
|
|
|
// CheckIfAlterRole checks if the role can be altered.
|
|
// if the role not exists, it will return errRoleNotExists.
|
|
CheckIfAlterRole(ctx context.Context, req *milvuspb.AlterRoleRequest) error
|
|
|
|
// CheckIfDropRole checks if the role can be dropped.
|
|
// if the role not exists, it will return errRoleNotExists.
|
|
CheckIfDropRole(ctx context.Context, in *milvuspb.DropRoleRequest) error
|
|
|
|
// CheckIfOperateUserRole checks if the user role can be operated.
|
|
CheckIfOperateUserRole(ctx context.Context, req *milvuspb.OperateUserRoleRequest) error
|
|
|
|
// CheckIfPrivilegeGroupCreatable checks if the privilege group can be created.
|
|
CheckIfPrivilegeGroupCreatable(ctx context.Context, req *milvuspb.CreatePrivilegeGroupRequest) error
|
|
|
|
// CheckIfPrivilegeGroupAlterable checks if the privilege group can be altered.
|
|
CheckIfPrivilegeGroupAlterable(ctx context.Context, req *milvuspb.OperatePrivilegeGroupRequest) error
|
|
|
|
// CheckIfPrivilegeGroupDropable checks if the privilege group can be dropped.
|
|
CheckIfPrivilegeGroupDropable(ctx context.Context, req *milvuspb.DropPrivilegeGroupRequest) error
|
|
|
|
// CheckIfRBACRestorable checks if the rbac meta data can be restored.
|
|
CheckIfRBACRestorable(ctx context.Context, req *milvuspb.RestoreRBACMetaRequest) error
|
|
}
|