Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Conversation

@tobych
Copy link
Contributor

@tobych tobych commented Apr 8, 2014

No description provided.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should handle this too.

@rmccue
Copy link
Member

rmccue commented Apr 9, 2014

Phew; tonnes of inline comments above, but fantastic start on this! Thanks so much for what you have so far!

Feel free to ask any questions about anything I've mentioned; you can also email me directly if you'd prefer. :)

@rmccue rmccue added this to the 1.0 milestone Apr 9, 2014
@rmccue rmccue mentioned this pull request Apr 9, 2014
@tobych
Copy link
Contributor Author

tobych commented Apr 10, 2014

Thanks for the comments. I'll move things forward, with individual commits. Then when you're ready to pull I can squash them all together into one.

Meanwhile, I'm wondering if there should be a class for each User called API_User or something, that we can work with, and that the API code can automatically render as a dictionary using introspection, before being rendered further as JSON. Tom Christie's (@tomchristie) Django REST Framework is quite gorgeous in this respect and might be worth looking at: http://www.django-rest-framework.org/ I've also noticed that user roles and per-user capabilities are all stuffed into one meta item... that'll be interesting to handle with a RESTful API. Anyway, I digress. I imagine these comments belong elsewhere.

@tobych
Copy link
Contributor Author

tobych commented Apr 12, 2014

You can now add a user. More to come, but my six-year-old just woke up.

@tobych
Copy link
Contributor Author

tobych commented Apr 13, 2014

I've now done everything @rmccue has suggested, I think, apart from pagination, as explained above.

@tobych
Copy link
Contributor Author

tobych commented Apr 13, 2014

@rmccue has pointed out that "current_user_can('edit_user', $id) is called a meta cap. It maps to the correct real permission internally (edit_users/edit_profile or appropriate other permission).". So I'll update that.

Also, make error messages less apologetic. Sorry about that.
@tobych
Copy link
Contributor Author

tobych commented Apr 13, 2014

I've updated all the permission checks to improve things.

@tobych
Copy link
Contributor Author

tobych commented Apr 13, 2014

Okay, that's all for now. Feedback please!

@rmccue
Copy link
Member

rmccue commented Apr 13, 2014

Okay, that's all for now. Feedback please!

Fantastic work, I'll take a look and get back to you. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should stick strictly to one-class-per-file. It's fine to just use the values inline, since HTTP status codes have a one-to-one mapping from code to type. (As much as I hate magic values.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to have to keep looking up what each code is called, let alone the semantics, and I doubt anyone else does. Are there REALLY not constants defined elsewhere in PHP, or in WordPress? The more I look at WordPress and PHP, the more my eyes bleed. PHP still doesn't have enumerations? Unless you install a binary doodah? Anyway. Ahem. One must plow on. I can move the class out to a separate file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to add them somewhere if you think it'll help readability, but that should be a separate PR. :)

@rmccue
Copy link
Member

rmccue commented Apr 13, 2014

Your code here looks pretty solid; I'm happy to try it out and take over the pull request if you'd like? :)

@tobych
Copy link
Contributor Author

tobych commented Apr 13, 2014

Sure, that'd be great. I feel like I've reached diminishing returns here. I have ideas about meta handling: I need that for my paid project. How can I best be involved in that discussion, if at all, do you think?

@rmccue rmccue mentioned this pull request Apr 20, 2014
5 tasks
@rmccue
Copy link
Member

rmccue commented Apr 20, 2014

Closed in favour of #146.

Sure, that'd be great. I feel like I've reached diminishing returns here. I have ideas about meta handling: I need that for my paid project. How can I best be involved in that discussion, if at all, do you think?

I think I answered this elsewhere, but if not, jump into the meta ticket and let me know your thoughts. :)

@rmccue rmccue closed this Apr 20, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants