Implement GET /_telodendria/admin/tokens #37
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Total Time Spent: 4 hours 30 minutes
Due Date
jordan
4 hours 30 minutes
No due date set.
Dependencies
No dependencies set.
Reference: Telodendria/Telodendria#37
Loading…
Reference in New Issue
No description provided.
Delete Branch "lda/telodendria:implement-26"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements everything in #26 :
Please review the developer certificate of origin:
the right to submit it under the open source licenses of the
Telodendria project; or
my knowledge, is covered under an appropriate open source license and
I have the right under that license to submit that work with
modifications, whether created in whole or in part by me, under the
Telodendria project license; or
who certified (1), (2), or (3), and I have not modified it.
made public and that a record of the contribution—including all
personal information I submit with it—is maintained indefinitely
and may be redistributed consistent with this project or the open
source licenses involved.
origin, and I certify that I have permission to submit this patch
under the conditions specified in it.
@ -109,0 +110,4 @@
* Returns a JSON object corresponding to a valid TokenInfo (see
* #26)
*/
extern HashMap * RegTokenJSON(RegTokenInfo *);
I wonder, is there any reason why
RegTokenInfo
can't be auto-generated withj2s
? That would also generate the code to convert it to JSON automatically.WIP: Implement GET /_telodendria/admin/tokensto Implement GET /_telodendria/admin/tokens@ -199,2 +201,4 @@
}
HashMap *
RegTokenJSON(RegTokenInfo * info)
I'm still a little confused about what's happening here.
You added a new
TokenInfo
schema, which looks like it works fine, but I wonder if there's still too much manual work happening here. I assumed we would just convert the existingRegTokenInfo
structure into a schema, which we could then store in the database and send over the HTTP API.Now,
RegTokenInfo
hasdb
andref
properties that should be ignored when doing the JSON encoding/decoding; we might need to add this as an option toj2s
.Is there a reason that this wouldn't work? It might require some refactoring of the
RegToken
API, though. Is that the reason you did it this way?Either way, seeing lines like this
doesn't really make me feel good about what's happening here. It looks hard to maintain.
Honestly, I think a simpler solution would be to just do something like a big RegTokenInfo with all of the database stuff and all of the properties as a property(with type RegToken).
@lda Take a look at my pull request on your
implement-26
branch and see if it is agreeable to you: lda/telodendria#1.If it is, you should just be able to merge it and then I can merge your pull request into
master
.@ -201,0 +229,4 @@
/* The owner can be null if Telodendria created it.
* Since users can't contain a space, it is in this case set to
* "Telodendria Server". */
tokinfo.created_by = "Telodendria Server";
It should be fine to just send a
NULL
(or omit the key entirely) if there wasn't a specific user that created the token. I don't see why we need to hard-codeTelodendria Server
in this case.This looks pretty good. I'm assuming you've tested it to verify that it works as intended?
I did some basic testing with the endpoints beforehand
Awesome. I'll trust your testing on this one because it looks like it should work fine.
I should note that the documentation in #26 is slightly out of date. The endpoints should allow the caller to view and modify all of the properties in the
RegTokenInfo
structure, including the privileges.Closing this because #43 is a significant improvement. Further discussion and development should take place there. If you find any issues with what is there, just open up a new pull request against the
pull-37
branch that #43 is based on.Pull request closed