Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…lock into add-code
  • Loading branch information
petyos committed Nov 28, 2023
2 parents 2959042 + 5646b1d commit f2adc37
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
"filename": "driver/web/docs/gen/gen_types.go",
"hashed_secret": "c9739eab2dfa093cc0e450bf0ea81a43ae67b581",
"is_verified": false,
"line_number": 1806
"line_number": 1812
}
],
"driver/web/docs/resources/admin/auth/login.yaml": [
Expand Down Expand Up @@ -364,5 +364,5 @@
}
]
},
"generated_at": "2023-11-24T06:43:37Z"
"generated_at": "2023-11-28T04:34:17Z"
}
4 changes: 2 additions & 2 deletions core/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ type servicesImpl struct {
app *application
}

func (s *servicesImpl) SerDeleteAccount(id string) error {
return s.app.serDeleteAccount(id)
func (s *servicesImpl) SerDeleteAccount(id string, apps []string) error {
return s.app.serDeleteAccount(id, apps)
}

func (s *servicesImpl) SerGetAccount(cOrgID string, cAppID string, accountID string) (*model.Account, error) {
Expand Down
4 changes: 2 additions & 2 deletions core/app_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ func (app *application) serUpdateAccountPreferences(id string, appID string, org
return false, nil
}

func (app *application) serDeleteAccount(id string) error {
return app.auth.DeleteAccount(id)
func (app *application) serDeleteAccount(id string, apps []string) error {
return app.auth.DeleteAccount(id, apps)
}

func (app *application) serGetAccounts(limit int, offset int, appID string, orgID string, accountID *string, firstName *string, lastName *string, authType *string,
Expand Down
2 changes: 1 addition & 1 deletion core/auth/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ type APIs interface {
CheckGroups(context storage.TransactionContext, appOrg *model.ApplicationOrganization, groupIDs []string, assignerPermissions []string, revoke bool) ([]model.AppOrgGroup, error)

//DeleteAccount deletes an account for the given id
DeleteAccount(id string) error
DeleteAccount(id string, apps []string) error

//GetAdminToken returns an admin token for the specified application and organization
GetAdminToken(claims tokenauth.Claims, appID string, orgID string, l *logs.Log) (string, error)
Expand Down
2 changes: 1 addition & 1 deletion core/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

// Services exposes APIs for the driver adapters
type Services interface {
SerDeleteAccount(id string) error
SerDeleteAccount(id string, apps []string) error
SerGetAccount(cOrgID string, cAppID string, accountID string) (*model.Account, error)
SerGetProfile(cOrgID string, cAppID string, accountID string) (*model.Profile, error)
SerGetPreferences(cOrgID string, cAppID string, accountID string) (map[string]interface{}, error)
Expand Down
11 changes: 10 additions & 1 deletion driver/web/apis_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,16 @@ func (h ServicesApisHandler) getServiceRegistrations(l *logs.Log, r *http.Reques
}

func (h ServicesApisHandler) deleteAccount(l *logs.Log, r *http.Request, claims *tokenauth.Claims) logs.HTTPResponse {
err := h.coreAPIs.Services.SerDeleteAccount(claims.Subject)
//apps
var apps []string
appsArg := r.URL.Query().Get("apps")
if appsArg != "" {
apps = strings.Split(appsArg, ",")
} else {
apps = append(apps, claims.AppID)
}

err := h.coreAPIs.Services.SerDeleteAccount(claims.Subject, apps)
if err != nil {
return l.HTTPResponseErrorAction(logutils.ActionDelete, model.TypeAccount, nil, err, http.StatusInternalServerError, true)
}
Expand Down
9 changes: 9 additions & 0 deletions driver/web/docs/gen/def.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,15 @@ paths:
**Auth:** Requires auth token
security:
- bearerAuth: []
parameters:
- name: apps
in: query
description: A comma-separated list of app_ids
required: false
style: form
explode: false
schema:
type: string
responses:
'200':
description: Success
Expand Down
6 changes: 6 additions & 0 deletions driver/web/docs/gen/gen_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions driver/web/docs/resources/services/account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ delete:
**Auth:** Requires auth token
security:
- bearerAuth: []
parameters:
- name: apps
in: query
description: A comma-separated list of app_ids
required: false
style: form
explode: false
schema:
type: string
responses:
200:
description: Success
Expand Down

0 comments on commit f2adc37

Please sign in to comment.