mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
issue: #43897 - RBAC(Roles/Users/Privileges/Privilege Groups) is implemented by WAL-based DDL framework now. - Support following message type in wal `AlterUser`, `DropUser`, `AlterRole`, `DropRole`, `AlterUserRole`, `DropUserRole`, `AlterPrivilege`, `DropPrivilege`, `AlterPrivilegeGroup`, `DropPrivilegeGroup`, `RestoreRBAC`. - RBAC can be synced by new CDC now. - Refactor some UT for RBAC. --------- Signed-off-by: chyezh <chyezh@outlook.com>
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
package model
|
|
|
|
import "github.com/milvus-io/milvus/pkg/v2/proto/internalpb"
|
|
|
|
type Credential struct {
|
|
Username string
|
|
EncryptedPassword string
|
|
Tenant string
|
|
IsSuper bool
|
|
Sha256Password string
|
|
TimeTick uint64 // the timetick in wal which the credential updates
|
|
}
|
|
|
|
func MarshalCredentialModel(cred *Credential) *internalpb.CredentialInfo {
|
|
if cred == nil {
|
|
return nil
|
|
}
|
|
return &internalpb.CredentialInfo{
|
|
Tenant: cred.Tenant,
|
|
Username: cred.Username,
|
|
EncryptedPassword: cred.EncryptedPassword,
|
|
IsSuper: cred.IsSuper,
|
|
Sha256Password: cred.Sha256Password,
|
|
TimeTick: cred.TimeTick,
|
|
}
|
|
}
|
|
|
|
func UnmarshalCredentialModel(cred *internalpb.CredentialInfo) *Credential {
|
|
if cred == nil {
|
|
return nil
|
|
}
|
|
return &Credential{
|
|
Username: cred.Username,
|
|
EncryptedPassword: cred.EncryptedPassword,
|
|
Tenant: cred.Tenant,
|
|
IsSuper: cred.IsSuper,
|
|
Sha256Password: cred.Sha256Password,
|
|
TimeTick: cred.TimeTick,
|
|
}
|
|
}
|