working commit

This commit is contained in:
2026-02-21 12:31:39 +02:00
parent 3220e2d78f
commit cd37a4508c
37 changed files with 354 additions and 319 deletions
+16 -17
View File
@@ -6,23 +6,22 @@ import (
"regexp"
"mstore/pkg/auxtool"
"mstore/pkg/auxuuid"
"mstore/pkg/descr"
"mstore/pkg/term"
"mstore/pkg/auxid"
)
// CreateGrant
type CreateGrantParams struct {
AccountID uint64 `json:"accountID"`
Username string `json:"username"`
Right term.Right `json:"operation"`
Pattern string `json:"pattern"`
AccountID string `json:"accountID"`
Username string `json:"username"`
Right string `json:"operation"`
Pattern string `json:"pattern"`
}
type CreateGrantResult struct {
GrantID uint64 `json:"grantId"`
GrantID string `json:"grantId"`
}
func (oper *Operator) CreateGrant(ctx context.Context, operatorID uint64, params *CreateGrantParams) (*CreateGrantResult, error) {
func (oper *Operator) CreateGrant(ctx context.Context, operatorID string, params *CreateGrantParams) (*CreateGrantResult, error) {
var err error
res := &CreateGrantResult{}
@@ -81,7 +80,7 @@ func (oper *Operator) CreateGrant(ctx context.Context, operatorID uint64, params
oper.logg.Debugf("Call CreateGrant")
now := auxtool.TimeNow()
grantDescr := &descr.Grant{
ID: uuid.NewUUID(),
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: params.Right,
Pattern: params.Pattern,
@@ -100,12 +99,12 @@ func (oper *Operator) CreateGrant(ctx context.Context, operatorID uint64, params
// UpdateGrant
type UpdateGrantParams struct {
GrantID uint64
GrantID string
NewPattern string
}
type UpdateGrantResult struct{}
func (oper *Operator) UpdateGrant(ctx context.Context, operatorID uint64, params *UpdateGrantParams) (*UpdateGrantResult, error) {
func (oper *Operator) UpdateGrant(ctx context.Context, operatorID string, params *UpdateGrantParams) (*UpdateGrantResult, error) {
var err error
res := &UpdateGrantResult{}
@@ -143,11 +142,11 @@ func (oper *Operator) UpdateGrant(ctx context.Context, operatorID uint64, params
// DeleteGrant
type DeleteGrantParams struct {
GrantID uint64 `json:"grantId"`
GrantID string `json:"grantId"`
}
type DeleteGrantResult struct{}
func (oper *Operator) DeleteGrant(ctx context.Context, operatorID uint64, params *DeleteGrantParams) (*DeleteGrantResult, error) {
func (oper *Operator) DeleteGrant(ctx context.Context, operatorID string, params *DeleteGrantParams) (*DeleteGrantResult, error) {
var err error
res := &DeleteGrantResult{}
@@ -177,13 +176,13 @@ func (oper *Operator) DeleteGrant(ctx context.Context, operatorID uint64, params
// ListGrants
type ListGrantsParams struct {
Username string
AccountID uint64
AccountID string
}
type ListGrantsResult struct {
Grants []descr.Grant `json:"grants"`
}
func (oper *Operator) ListGrants(ctx context.Context, operatorID uint64, params *ListGrantsParams) (*ListGrantsResult, error) {
func (oper *Operator) ListGrants(ctx context.Context, operatorID string, params *ListGrantsParams) (*ListGrantsResult, error) {
var err error
res := &ListGrantsResult{
Grants: make([]descr.Grant, 0),
@@ -224,13 +223,13 @@ func (oper *Operator) ListGrants(ctx context.Context, operatorID uint64, params
// Get Grants
type GetGrantParams struct {
GrantID uint64 `json:"grantId"`
GrantID string `json:"grantId"`
}
type GetGrantResult struct {
Grant *descr.Grant `json:"grant"`
}
func (oper *Operator) GetGrant(ctx context.Context, operatorID uint64, params *GetGrantParams) (*GetGrantResult, error) {
func (oper *Operator) GetGrant(ctx context.Context, operatorID string, params *GetGrantParams) (*GetGrantResult, error) {
var err error
res := &GetGrantResult{}