Skip to content

Commit

Permalink
fix: fix some api and function error
Browse files Browse the repository at this point in the history
* feat:Add GetCert api

* fix:Move enfocer.go -> enforcer.go

* fix:Add ModelText to struct Model

* fix:fix func DeleteOrganization

* fix:fix func GetOrganization

* fix:fix func GetSession
  • Loading branch information
Songjf-ttk committed Sep 15, 2023
1 parent 6c2f3f8 commit 50aa926
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions casdoorsdk/cert_global.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func GetCerts() ([]*Cert, error) {
return globalClient.GetCerts()
}

func GetCert(name string) (*Cert, error) {
return globalClient.GetCert(name)
}

func UpdateCert(cert *Cert) (bool, error) {
return globalClient.UpdateCert(cert)
}
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions casdoorsdk/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Model struct {
Key string `json:"key,omitempty"`
Children []*Model `json:"children,omitempty"`

ModelText string `xorm:"mediumtext" json:"modelText"`
IsEnabled bool `json:"isEnabled"`
}

Expand Down
2 changes: 1 addition & 1 deletion casdoorsdk/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (c *Client) AddOrganization(organization *Organization) (bool, error) {

func (c *Client) DeleteOrganization(name string) (bool, error) {
organization := Organization{
Owner: "admin",
Owner: c.OrganizationName,
Name: name,
}

Expand Down
4 changes: 2 additions & 2 deletions casdoorsdk/organization_global.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

package casdoorsdk

func GetOrganization(name string) ([]*Organization, error) {
return globalClient.GetOrganizations()
func GetOrganization(name string) (*Organization, error) {
return globalClient.GetOrganization(name)
}

func GetOrganizations() ([]*Organization, error) {
Expand Down
4 changes: 2 additions & 2 deletions casdoorsdk/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ func (c *Client) GetPaginationSessions(p int, pageSize int, queryMap map[string]
return sessions, int(response.Data2.(float64)), nil
}

func (c *Client) GetSession(name string) (*Session, error) {
func (c *Client) GetSession(name string, application string) (*Session, error) {
queryMap := map[string]string{
"id": fmt.Sprintf("%s/%s", c.OrganizationName, name),
"sessionPkId": fmt.Sprintf("%s/%s/%s", c.OrganizationName, name, application),
}

url := c.GetUrl("get-session", queryMap)
Expand Down
4 changes: 2 additions & 2 deletions casdoorsdk/session_global.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func GetPaginationSessions(p int, pageSize int, queryMap map[string]string) ([]*
return globalClient.GetPaginationSessions(p, pageSize, queryMap)
}

func GetSession(name string) (*Session, error) {
return globalClient.GetSession(name)
func GetSession(name string, application string) (*Session, error) {
return globalClient.GetSession(name, application)
}

func UpdateSession(session *Session) (bool, error) {
Expand Down

0 comments on commit 50aa926

Please sign in to comment.