right type used

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