antirez / lamernews

Lamer News -- an HN style social news site written in Ruby/Sinatra/Redis/JQuery
http://lamernews.com
Other
1.35k stars 199 forks source link

Expose users via API #140

Open fracek opened 11 years ago

fracek commented 11 years ago

Expose the list of existing users at the /api/users endpoint.

It should return a json like this:

{
  "users": [
    {
      "username": "Tizio",
      "ctime": "1370468376",
      "karma": 100,
      "about": "baobab"
    },
    {
      "username": "Caio",
      "ctime": "1370468376",
      "karma": 100,
      "about": "bho"
    },
  ],
  "status": "ok",
  "count": 2
}

What do you think?

fcambus commented 11 years ago

This could be nice for generating statistics, is that the use case you have in mind?

I fear this could be abused though, so maybe if the feature is accepted, it should be restricted to only allow admins to access it? In this case, it could also be nice to include the number of news and comments posted for each user.

fracek commented 11 years ago

This could be nice for generating statistics, is that the use case you have in mind?

My idea (born on http://www.hackingitalia.com/ ) was to generate a map of the users. Each user puts a code (antirez idea was to add something like geo:72.2,83.3 ) in the about field, then we parse it and generate the map.

I fear this could be abused though, so maybe if the feature is accepted, it should be restricted to only allow admins to access it?

I did include only informations that are already public for this reason.

fcambus commented 11 years ago

So, I think this should be implemented, as there is already two use case for this :

In any case, we can add config file options to enable / disable the feature, and make it public / restrict it to admins only.

mulderp commented 11 years ago

Additionally, an admin UI for sorting users on email, karma, etc. might be nice. This could maybe done with Backbone.js similarly to https://github.com/documentcloud/documentcloud/blob/master/public/javascripts/model/accounts.js

lplume commented 9 years ago

also, would be nice in client application [edit] along with /user/:username [/edit]