working commit
This commit is contained in:
+9
-11
@@ -17,13 +17,11 @@ import (
|
||||
"mstore/app/handler"
|
||||
"mstore/app/operator"
|
||||
"mstore/pkg/descr"
|
||||
"mstore/pkg/term"
|
||||
"mstore/pkg/auxid"
|
||||
)
|
||||
|
||||
func (cli *Client) CreateGrantByAccountID(ctx context.Context, hosturi string, accountID uint64, right term.Right, pattern string) (uint64, error) {
|
||||
func (cli *Client) CreateGrantByAccountID(ctx context.Context, hosturi string, accountID, right, pattern string) (string, error) {
|
||||
var err error
|
||||
var res uint64
|
||||
var res string
|
||||
|
||||
apiuri, err := setApiPath(hosturi, "/v3/api/grant/create")
|
||||
if err != nil {
|
||||
@@ -56,9 +54,9 @@ func (cli *Client) CreateGrantByAccountID(ctx context.Context, hosturi string, a
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (cli *Client) CreateGrantByUsername(ctx context.Context, hosturi, username string, right term.Right, pattern string) (uint64, error) {
|
||||
func (cli *Client) CreateGrantByUsername(ctx context.Context, hosturi, username string, right string, pattern string) (string, error) {
|
||||
var err error
|
||||
var res uint64
|
||||
var res string
|
||||
|
||||
apiuri, err := setApiPath(hosturi, "/v3/api/grant/create")
|
||||
if err != nil {
|
||||
@@ -91,7 +89,7 @@ func (cli *Client) CreateGrantByUsername(ctx context.Context, hosturi, username
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (cli *Client) GetGrant(ctx context.Context, hosturi string, id uint64) (*descr.Grant, error) {
|
||||
func (cli *Client) GetGrant(ctx context.Context, hosturi, grantID string) (*descr.Grant, error) {
|
||||
var err error
|
||||
res := &descr.Grant{}
|
||||
|
||||
@@ -100,7 +98,7 @@ func (cli *Client) GetGrant(ctx context.Context, hosturi string, id uint64) (*de
|
||||
return res, err
|
||||
}
|
||||
operParams := operator.GetGrantParams{
|
||||
GrantID: id,
|
||||
GrantID: grantID,
|
||||
}
|
||||
paramsJson, err := json.Marshal(operParams)
|
||||
if err != nil {
|
||||
@@ -124,7 +122,7 @@ func (cli *Client) GetGrant(ctx context.Context, hosturi string, id uint64) (*de
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (cli *Client) UpdateGrant(ctx context.Context, hosturi string, grantID uint64, newPattern string) error {
|
||||
func (cli *Client) UpdateGrant(ctx context.Context, hosturi, grantID, newPattern string) error {
|
||||
var err error
|
||||
|
||||
apipath, err := setApiPath(hosturi, "/v3/api/grant/update")
|
||||
@@ -155,7 +153,7 @@ func (cli *Client) UpdateGrant(ctx context.Context, hosturi string, grantID uint
|
||||
return err
|
||||
}
|
||||
|
||||
func (cli *Client) DeleteGrant(ctx context.Context, hosturi string, grantID uint64) error {
|
||||
func (cli *Client) DeleteGrant(ctx context.Context, hosturi, grantID string) error {
|
||||
var err error
|
||||
|
||||
apipath, err := setApiPath(hosturi, "/v3/api/grant/delete")
|
||||
@@ -186,7 +184,7 @@ func (cli *Client) DeleteGrant(ctx context.Context, hosturi string, grantID uint
|
||||
return err
|
||||
}
|
||||
|
||||
func (cli *Client) ListGrantsByAccountID(ctx context.Context, hosturi string, accountID uint64) ([]descr.Grant, error) {
|
||||
func (cli *Client) ListGrantsByAccountID(ctx context.Context, hosturi, accountID string) ([]descr.Grant, error) {
|
||||
var err error
|
||||
res := make([]descr.Grant, 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user