shamrickus commented on code in PR #6832:
URL: https://github.com/apache/trafficcontrol/pull/6832#discussion_r878321410


##########
docs/source/api/v4/users.rst:
##########
@@ -24,7 +24,7 @@
 Retrieves all requested users.
 
 :Auth. Required: Yes
-:Roles Required: None\ [1]_
+:Roles Required: None\ [#tenancy]_

Review Comment:
   Warning: `Too many autonumbered footnote references: only 0 corresponding 
footnotes available.`



##########
lib/go-tc/tovalidate/validate.go:
##########
@@ -43,3 +45,28 @@ func ToErrors(err map[string]error) []error {
        }
        return vErrors
 }
+
+// ToError converts a map of strings to errors into a single error.
+//
+// Because multiple errors are collapsed, errors cannot be wrapped and 
therefore
+// error identity cannot be preserved.
+func ToError(err map[string]error) error {
+       if len(err) == 0 {
+               return nil
+       }
+       var b strings.Builder
+       for key, value := range err {
+               if value != nil {
+                       b.WriteRune('\'')
+                       b.WriteString(key)
+                       b.WriteString("' ")
+                       b.WriteString(value.Error())
+                       b.WriteString(", ")
+               }
+       }
+       msg := strings.TrimSuffix(b.String(), ", ")
+       if msg == "" {
+               return nil
+       }
+       return errors.New(strings.TrimSuffix(b.String(), ", "))

Review Comment:
   return `errors.New(msg)`?



##########
lib/go-tc/tovalidate/validate.go:
##########
@@ -43,3 +45,28 @@ func ToErrors(err map[string]error) []error {
        }
        return vErrors
 }
+
+// ToError converts a map of strings to errors into a single error.
+//
+// Because multiple errors are collapsed, errors cannot be wrapped and 
therefore
+// error identity cannot be preserved.
+func ToError(err map[string]error) error {
+       if len(err) == 0 {
+               return nil
+       }
+       var b strings.Builder
+       for key, value := range err {
+               if value != nil {
+                       b.WriteRune('\'')

Review Comment:
   Double quote like below?



##########
docs/source/api/v4/users.rst:
##########
@@ -91,54 +97,58 @@ Response Structure
 :tenant:            The name of the tenant to which this user belongs
 :tenantId:          The integral, unique identifier of the tenant to which 
this user belongs
 :ucdn:              The name of the :abbr:`uCDN (Upstream Content Delivery 
Network)` to which the user belongs
-:uid:               A deprecated field only kept for legacy compatibility 
reasons that used to contain the UNIX user ID of the user - now it is always 
``null``
-:username:          The user's username
+
+       .. versionadded:: 4.0
+
+:uid: A deprecated field only kept for legacy compatibility reasons that used 
to contain the UNIX user ID of the user - now it is always ``null``
+
+       .. deprecated:: 4.0
+               This field is serves no known purpose, and shouldn't be used 
for anything so it can be removed in the future.
+
+:username: The user's username
 
 .. code-block:: http
        :caption: Response Example
 
        HTTP/1.1 200 OK
-       Access-Control-Allow-Credentials: true
-       Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, 
Accept, Set-Cookie, Cookie
-       Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
-       Access-Control-Allow-Origin: *
+       Content-Encoding: gzip
        Content-Type: application/json
-       Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 
GMT; Max-Age=3600; HttpOnly
-       Whole-Content-Sha512: 
YBJLN8NbOxOvECe1RGtcwCzIPDhyhLpW56nTJHQM5WI2WUDe2mAKREpaEE72nzrfBliq1GABwJlsxq2OdhcFkw==
+       Permissions-Policy: interest-cohort=()
+       Set-Cookie: mojolicious=...; Path=/; Expires=Fri, 13 May 2022 23:16:14 
GMT; Max-Age=3600; HttpOnly
+       Vary: Accept-Encoding
        X-Server-Name: traffic_ops_golang/
-       Date: Thu, 13 Dec 2018 01:03:53 GMT
-       Content-Length: 454
+       Date: Fri, 13 May 2022 22:16:14 GMT
+       Content-Length: 350
 
        { "response": [
                {
-                       "username": "admin",
-                       "registrationSent": null,
-                       "addressLine1": null,
+                       "addressLine1": "22 Mike Wazowski You've Got Your Life 
Back Lane",
                        "addressLine2": null,
-                       "city": null,
+                       "changeLogCount": 0,
+                       "city": "Monstropolis",
                        "company": null,
                        "country": null,
-                       "email": null,
-                       "fullName": null,
+                       "email": "[email protected]",
+                       "fullName": "Mike Wazowski",
                        "gid": null,
-                       "id": 2,
-                       "newUser": false,
+                       "id": 3,
+                       "lastAuthenticated": null,
+                       "lastUpdated": "2022-05-13T22:13:54.605052Z",
+                       "newUser": true,
                        "phoneNumber": null,
                        "postalCode": null,
                        "publicSshKey": null,
+                       "registrationSent": null,
                        "role": "admin",
                        "stateOrProvince": null,
                        "tenant": "root",
                        "tenantId": 1,
+                       "ucdn": "",
                        "uid": null,
-                       "lastUpdated": "2021-08-25T14:08:13.974447-06:00",
-                       "changeLogCount": 20,
-                       "lastAuthenticated": "2021-07-09T14:44:10.371708-06:00"
+                       "username": "mike"
                }
        ]}
 
-.. [1] While no roles are required, this endpoint does respect tenancy. A user 
will only be able to see, create, delete or modify other users belonging to the 
same tenant, or its descendants.

Review Comment:
   On line 157 (after changes) Warning: `Unknown target name`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to