Skip to content

Commit

Permalink
fix: fix bug in owner handling
Browse files Browse the repository at this point in the history
  • Loading branch information
hsluoyz committed Mar 13, 2024
1 parent a91dcc0 commit 75a6101
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions casdoorsdk/util_modify.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
// modifyOrganization is an encapsulation of permission CUD(Create, Update, Delete) operations.
// possible actions are `add-organization`, `update-organization`, `delete-organization`,
func (c *Client) modifyOrganization(action string, organization *Organization, columns []string) (*Response, bool, error) {
organization.Owner = "admin"

queryMap := map[string]string{
"id": fmt.Sprintf("%s/%s", organization.Owner, organization.Name),
}
Expand All @@ -31,8 +33,6 @@ func (c *Client) modifyOrganization(action string, organization *Organization, c
queryMap["columns"] = strings.Join(columns, ",")
}

organization.Owner = "admin"

postBytes, err := json.Marshal(organization)
if err != nil {
return nil, false, err
Expand All @@ -49,6 +49,8 @@ func (c *Client) modifyOrganization(action string, organization *Organization, c
// modifyApplication is an encapsulation of permission CUD(Create, Update, Delete) operations.
// possible actions are `add-application`, `update-application`, `delete-application`,
func (c *Client) modifyApplication(action string, application *Application, columns []string) (*Response, bool, error) {
application.Owner = "admin"

queryMap := map[string]string{
"id": fmt.Sprintf("%s/%s", application.Owner, application.Name),
}
Expand All @@ -57,8 +59,6 @@ func (c *Client) modifyApplication(action string, application *Application, colu
queryMap["columns"] = strings.Join(columns, ",")
}

application.Owner = "admin"

postBytes, err := json.Marshal(application)
if err != nil {
return nil, false, err
Expand Down Expand Up @@ -503,6 +503,8 @@ func (c *Client) modifyWebhook(action string, webhook *Webhook, columns []string
// modifyToken is an encapsulation of cert CUD(Create, Update, Delete) operations.
// possible actions are `add-token`, `update-token`, `delete-token`,
func (c *Client) modifyToken(action string, token *Token, columns []string) (*Response, bool, error) {
token.Owner = "admin"

queryMap := map[string]string{
"id": fmt.Sprintf("%s/%s", token.Owner, token.Name),
}
Expand All @@ -511,7 +513,6 @@ func (c *Client) modifyToken(action string, token *Token, columns []string) (*Re
queryMap["columns"] = strings.Join(columns, ",")
}

// token.Owner = c.OrganizationName
postBytes, err := json.Marshal(token)
if err != nil {
return nil, false, err
Expand Down

0 comments on commit 75a6101

Please sign in to comment.