Coder Social home page Coder Social logo

inveniosoftware / invenio-accounts-rest Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 13.0 85 KB

Invenio modules that adds accounts REST API.

Home Page: https://invenio-accounts-rest.readthedocs.io

License: GNU General Public License v2.0

Python 99.60% Shell 0.40%

invenio-accounts-rest's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

invenio-accounts-rest's Issues

views: add a REST API

@nharraud commented on Fri Sep 02 2016

As for the other modules a REST API will be needed here.

The main features would be:

  • searching/listing users
  • getting a user's information
  • updating a user's information
  • searching roles
  • creating roles
  • assigning roles to users or unassigning them.

It would also need a shortcut URI for the currently authenticated user.

There is however one question. Do we want this in invenio-accounts or do we create an API for both invenio-accounts and invenio-userprofiles at the same time? Not being able to search users by name would be a strange limitation.

@inveniosoftware/triagers


@nharraud commented on Fri Sep 02 2016

Needed for #137


@lnielsen commented on Fri Sep 02 2016

would need careful though about oauth2 scopes as well


@nharraud commented on Mon Sep 05 2016

Regarding B2Share, we will need a search/suggest of users and roles based on their names. I see at least one use case where this would be useful: admin interface.

This would imply that we need to have a combined REST API for invenio-accounts and invenio-userprofile.
The cons of this approach is that other people might want to use a custom profile module.


@lnielsen commented on Mon Sep 05 2016

It's useful to have an endpoint for the current authenticated user as well similar to GitHub:
https://developer.github.com/v3/users/#get-the-authenticated-user.

Also we might be forward looking an allow support for multiple email addresses:
https://developer.github.com/v3/users/emails/

Regarding Accounts/UserProfiles:
This might be taken care of by serialisers and loaders, since usually the profile can be accessed from the user model. Also we can launch an Invenio-Accounts-REST which depends on both accounts and user profiles.


@PaulinaLach commented on Mon Sep 05 2016

Here is my suggestion of list of the endpoints:

  • List all users - GET /users
  • Search user - GET /users?q=sth
  • Get info about the user - GET /users/<id>
  • Update user’s info - PATCH /users/<id>
  • Create user - POST /users
  • Search roles - GET /roles?q=sth
  • Create role - POST /roles
  • Delete role - DELETE /roles/<role_id>
  • Assign role - PUT /users/<user_id>/roles/<role_id>
  • Divest role - DELETE /users/<user_id>/roles/<role_id>

Is it ok for everyone? Or do you have any suggestions?


@jirikuncar commented on Mon Sep 05 2016

It's needed also for Invenio-Circulation (inveniosoftware/invenio-circulation#38 cc @mvesper).

Can we create Invenio-Accounts-REST?

tests: simplify doctest execution

The following cookiecutter change:

inveniosoftware/cookiecutter-invenio-module#98

should be propagated to this Invenio module.

Namely, in run-tests.sh, the sphinx for doctests is invoked after pytest run:

$ tail -3 ./\{\{\ cookiecutter.project_shortname\ \}\}/run-tests.sh
sphinx-build -qnNW docs docs/_build/html && python setup.py test && sphinx-build -qnNW -b doctest docs docs/_build/doctest

This sometimes led to problems on Travis CI with the second sphinx-build run due
to "disappearing" dependencies after the example application was tested.

A solution that worked for invenio-marc21 (see
inveniosoftware/invenio-marc21#49 (comment))
and that was integrated in cookiecutter (see
inveniosoftware/cookiecutter-invenio-module#98) was to
run doctest execution in pytest, removing the second sphinx-build invocation.

This both solved Travis CI build failures and simplified test suite execution.

Note that this change may necessitate to amend the code tests etc so that things
would be executed with the Flask application context (see
inveniosoftware/invenio-marc21@09e98fc).

views: separate config variable for account serializers

Problem:
ACCOUNTS_REST_ACCOUNT_SERIALIZERS is used for both UserListResource and UserAccountResource . Because of that it is not possible to override the serializers as the one provided would be used for both accounts search which returns a list of result, and single account requests.

views: no commit after role (un)assignment

Problem:
db.session.commit() is not called after roles are assigned or unassigned. The tests don't detect this bug as the check is ran in the same application context.

dependencies: jsonpatch not included in install requirements

The library jsonpatch is only included in the tests, not in the installation requirements. In some cases, it will be installed by other modules that has it as a dependency. However, as is my case of a "UI" only app (No records backend, since I connect to the API via the react-searchkit) it fails due to this missing dependency.

tests: Fix failing pytests

 ==================== short test summary info ==============
FAILED invenio_accounts_rest/serializers.py::PYCODESTYLE
ERROR tests/test_views.py::test_get_user_properties[app0]
ERROR tests/test_views.py::test_update_user_properties[app0]
ERROR tests/test_views.py::test_user_search[app0]
ERROR tests/test_views.py::test_role_users_search[app0]
ERROR tests/test_views.py::test_get_user_properties[app1]
ERROR tests/test_views.py::test_update_user_properties[app1]
ERROR tests/test_views.py::test_user_search[app1]
ERROR tests/test_views.py::test_role_users_search[app1]

views: add roles loaders

Problem:
The views RolesListResource and RoleResource do not use any loader. Thus:

  • there is no check that the input is valid.
  • it is not possible for overlays to override the loading.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.