Skip to content

Commit

Permalink
Address code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
haoming29 committed Jan 8, 2024
1 parent d7097bc commit 157c43b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions registry/registry_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func getNamespaceJwksByPrefix(prefix string, approvalRequired bool) (*jwk.Set, e

func getNamespaceStatusById(id int) (RegistrationStatus, error) {
if id < 1 {
return "", errors.New("Invalid id. id must be a positive number")
return "", errors.New("Invalid id. id must be a positive integer")
}
adminMetadata := AdminMetadata{}
adminMetadataStr := ""
Expand Down Expand Up @@ -432,8 +432,8 @@ func getNamespaceByPrefix(prefix string) (*Namespace, error) {
// excluding Namespace.ID, Namespace.Identity, Namespace.Pubkey, and various dates
//
// For filterNs.AdminMetadata.Description and filterNs.AdminMetadata.SiteName,
// the string will be matched using `strings.Contains`. The rest of the AdminMetadata fields is
// matched by `==`
// the string will be matched using `strings.Contains`. This is too mimic a SQL style `like` match.
// The rest of the AdminMetadata fields is matched by `==`
func getNamespacesByFilter(filterNs Namespace, serverType ServerType) ([]*Namespace, error) {
query := `SELECT id, prefix, pubkey, identity, admin_metadata FROM namespace WHERE 1=1 `
if serverType == CacheType {
Expand Down
22 changes: 11 additions & 11 deletions web_ui/frontend/app/api/docs/pelican-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ definitions:
example: "/test"
identity:
type: string
description: The user identity we get from CILogon if the namespace is registered via CLI with `--identity` flag
description: The user identity we get from CILogon if the namespace is registered via CLI with `--with-identity` flag
admin_metadata:
$ref: "#/definitions/AdminMetadata"
Institution:
Expand Down Expand Up @@ -445,7 +445,7 @@ paths:
type: object
$ref: "#/definitions/ErrorModel"
"403":
description: Unauthorized request, when user is not logged in
description: Unauthorized request, when users are not logged in
schema:
type: object
$ref: "#/definitions/ErrorModel"
Expand Down Expand Up @@ -473,7 +473,7 @@ paths:
example: "admin"
headers:
X-CSRF-Token:
description: The CSRF token that user is expected to attach as the request header for any modification requests for registry APIs (PUT/PATCH/DELETE).
description: The CSRF token that users are expected to attach as the request header for any modification requests for registry APIs (PUT/PATCH/DELETE).
type: string
/auth/loginInitialized:
get:
Expand Down Expand Up @@ -504,12 +504,12 @@ paths:
- in: query
name: next_url
type: string
description: The path to redirect user to once they successfully authenticated against CILogon
description: The path to redirect users to once they successfully authenticated against CILogon
responses:
"307":
description: Redirect user to CILogon authentication page
"500":
description: Internal server error when failed to generate CSRF cookie for the OAuth flow
description: Internal server error when generating CSRF cookie for OAuth flow
schema:
type: object
$ref: "#/definitions/ErrorModel"
Expand Down Expand Up @@ -537,7 +537,7 @@ paths:
type: object
$ref: "#/definitions/ErrorModel"
"500":
description: Internal server error when process the token and handshake with CILogon
description: Internal server error when processing the token and handshake with CILogon
schema:
type: object
$ref: "#/definitions/ErrorModel"
Expand Down Expand Up @@ -626,7 +626,7 @@ paths:
$ref: "#/definitions/NamespaceForRegistration"
- in: header
name: X-CSRF-Token
description: The CSRF token for protecting Cross-Site Request Forgery (CSRF) attack. You will get this token by requesting `/api/v1.0/auth/whoami` and read response header `X-CSRF-Token`
description: The CSRF token for protecting against Cross-Site Request Forgery (CSRF) attacks. Obtained by requesting `/api/v1.0/auth/whoami` and reading response header `X-CSRF-Token`
type: string
required: true
responses:
Expand Down Expand Up @@ -743,7 +743,7 @@ paths:
For user with admin previlege, they can update any valid namespace.
For non-admin users, they can only update the namespace belonging to the user, or it returns 404. They also cannot update a namespace if its `admin_metadata.status == approved`.
Non-admin users can update only namespaces they own and only if the approval status is `admin_metadata.status == approved`, otherwise the endpoint returns 404.
"
operationId: updateNamespaceById
parameters:
Expand All @@ -760,7 +760,7 @@ paths:
$ref: "#/definitions/NamespaceForRegistration"
- in: header
name: X-CSRF-Token
description: The CSRF token for protecting Cross-Site Request Forgery (CSRF) attack. You will get this token by requesting `/api/v1.0/auth/whoami` and read response header `X-CSRF-Token`
description: The CSRF token for protecting against Cross-Site Request Forgery (CSRF) attacks. Obtained by requesting `/api/v1.0/auth/whoami` and reading response header `X-CSRF-Token`
type: string
required: true
consumes:
Expand Down Expand Up @@ -854,7 +854,7 @@ paths:
type: integer
- in: header
name: X-CSRF-Token
description: The CSRF token for protecting Cross-Site Request Forgery (CSRF) attack. You will get this token by requesting `/api/v1.0/auth/whoami` and read response header `X-CSRF-Token`
description: The CSRF token for protecting against Cross-Site Request Forgery (CSRF) attacks. Obtained by requesting `/api/v1.0/auth/whoami` and reading response header `X-CSRF-Token`
type: string
required: true
produces:
Expand Down Expand Up @@ -911,7 +911,7 @@ paths:
type: integer
- in: header
name: X-CSRF-Token
description: The CSRF token for protecting Cross-Site Request Forgery (CSRF) attack. You will get this token by requesting `/api/v1.0/auth/whoami` and read response header `X-CSRF-Token`
description: The CSRF token for protecting against Cross-Site Request Forgery (CSRF) attacks. Obtained by requesting `/api/v1.0/auth/whoami` and reading response header `X-CSRF-Token`
type: string
required: true
produces:
Expand Down

0 comments on commit 157c43b

Please sign in to comment.