working commit
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
type CreateGrantParams struct {
|
||||
AccountID string `json:"accountID"`
|
||||
Operation string `json:"operation"`
|
||||
Right string `json:"operation"`
|
||||
Pattern string `json:"pattern"`
|
||||
}
|
||||
type CreateGrantResult struct {
|
||||
@@ -26,7 +26,7 @@ func (oper *Operator) CreateGrant(ctx context.Context, params *CreateGrantParams
|
||||
err := fmt.Errorf("Empty accountId parameters")
|
||||
return res, err
|
||||
}
|
||||
if params.Operation == "" {
|
||||
if params.Right == "" {
|
||||
err := fmt.Errorf("Empty operation parameter")
|
||||
return res, err
|
||||
}
|
||||
@@ -35,7 +35,7 @@ func (oper *Operator) CreateGrant(ctx context.Context, params *CreateGrantParams
|
||||
return res, err
|
||||
}
|
||||
|
||||
grantExists, _, err := oper.mdb.GetGrantByAccoundIDOperationPattern(ctx, params.AccountID, params.Operation, params.Pattern)
|
||||
grantExists, _, err := oper.mdb.GetGrantByAccoundIDRightPattern(ctx, params.AccountID, params.Right, params.Pattern)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
@@ -47,7 +47,7 @@ func (oper *Operator) CreateGrant(ctx context.Context, params *CreateGrantParams
|
||||
grantDescr := &descr.Grant{
|
||||
ID: auxuuid.NewUUID(),
|
||||
AccountID: params.AccountID,
|
||||
Operation: params.Operation,
|
||||
Right: params.Right,
|
||||
Pattern: params.Pattern,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
|
||||
Reference in New Issue
Block a user