Skip to content

MongoDB + REST API + Authentication + Authorization + Mail Notifications.

License

Notifications You must be signed in to change notification settings

agaviria/diskette

 
 

Repository files navigation

Go Report Card Build Status

Diskette

MongoDB + REST API + Authentication + Authorization + Mail Notifications

Status

Under heavy development.

Roadmap

  • REST

    • GET
    # examples:
    http localhost:5025/collection/user
    http localhost:5025/collection/user?q='{"name":"Joe Doe"}'
    http localhost:5025/collection/user?q='{"name":{"$ne":"Joe Doe"}}'
    • POST
    # example:
    http POST localhost:5025/collection/user name="Joe Doe" email=joe.doe@gmail.com
    • PUT
    # example:
    http PUT localhost:5025/collection/user?q='{"name":"Joe Doe"}' \$set:='{"email":"jdoe@gmail.com"}'
    • DELETE
    # example
    http DELETE localhost:5025/collection/user?q='{"name":"Joe Doe"}'
  • Authentication

    • sign up
    # example
    http POST localhost:5025/user/signup \
        email=joe.doe@gmail.com password=abc \
        profile:='{"name": "Joe Doe", "language": "en" }'
    • confirm sign up
    http POST localhost:5025/user/confirm token=<confirmation_token>
    • sign in
    # example
    http POST localhost:5025/user/signin email=joe.doe@gmail.com password=abc
    • forgot password
    # example
    http POST localhost:5025/user/forgot-password email=joe.doe@gmail.com
    • reset password
    # example
    http POST localhost:5025/user/reset-password token=<reset_token> password=123
    • sign out
    http POST localhost:5025/session/signout \
        X-Diskette-Session-Token:<session_token>
    • change password
    http POST localhost:5025/session/change-password \
        X-Diskette-Session-Token:<session_token> \
        oldPassword=<old_password> newPassword=<new_password>
    • change email
    http POST localhost:5025/session/change-email \
        X-Diskette-Session-Token:<session_token> \
        password=<password> newEmail=<newEmail>
    • set profile
    http POST localhost:5025/session/set-profile \
        X-Diskette-Session-Token:<session_token> \
        profile:='{"name": "Joe Doe"}'
  • User Management

    • get users
    http localhost:5025/admin/get-users?q=<query> X-Diskette-Session-Token:<session_token>
    • create user
    http POST localhost:5025/admin/create-user X-Diskette-Session-Token:<session_token> \
        email="joe.doe@gmail.com" password="123" \
        roles:='["admin"]' profile:='{"name": "Joe Doe", "lang": "en"}'
    • change user password
    http POST localhost:5025/admin/change-user-password X-Diskette-Session-Token:<session_token> \
        userId=<user_id> newPassword=<new_password>
    • change user email
    http POST localhost:5025/admin/change-user-email X-Diskette-Session-Token:<session_token> \
        userId=<user_id> newEmail=<new_email>
    • set user roles
    # example
    http POST localhost:5025/admin/set-user-roles X-Diskette-Session-Token:<session_token> \
        userId=<user_id> newRoles:='["customer"]'
    • set user profile
    # example
    http POST localhost:5025/admin/set-user-profile X-Diskette-Session-Token:<session_token> \
        userId=<user_id> newProfile:='{"name": "Joe Doe Jr."}'
    • remove users
    # example
    http DELETE localhost:5025/admin/remove-users X-Diskette-Session-Token:<session_token> \
        userIds:='["56bf19d65a1d18b704000001", "56be731d5a1d18accd000001"]'
    • signout users
    # example
    http POST localhost:5025/admin/signout-users X-Diskette-Session-Token:<session_token> \
        userIds:='["56bf19d65a1d18b704000001", "56be731d5a1d18accd000001"]'
    • suspend users
    # example
    http POST localhost:5025/admin/suspend-users X-Diskette-Session-Token:<session_token> \
        userIds:='["56bf19d65a1d18b704000001", "56be731d5a1d18accd000001"]'
    • unsuspend users
    # example
    http POST localhost:5025/admin/unsuspend-users X-Diskette-Session-Token:<session_token> \
        userIds:='["56bf19d65a1d18b704000001", "56be731d5a1d18accd000001"]'
    • remove unconfirmed users
    http DELETE localhost:5025/admin/remove-unconfirmed-users X-Diskette-Session-Token:<session_token>
    • remove expired reset keys
    http POST localhost:5025/admin/remove-expired-reset-keys X-Diskette-Session-Token:<session_token>
  • Authorization

    • Document level access control
    // example
    {
        "blog-post": {
            "read": true,
            "create": "session.userId != null",
            "update": "session.userId === doc.authorId || 'admin' in session.userRoles",
            "remove": "session.userId === doc.authorId || 'admin' in session.userRoles"
        }
    }
  • Mail Notifications:

    • send mail
    http POST localhost:5025/sendmail/<key>?q=<query>&l=<language_tag>
    • confirm signup
    # example
    http POST localhost:5025/sendmail/confirmSignup?q='{"email":"joe.doe@gmail.com"}'&l="en"
    • reset password
    # example
    http POST localhost:5025/sendmail/resetPassword?q='{"email":"joe.doe@gmail.com"}'&l="en"
  • Javascript library for usage in the browser

License

MIT

About

MongoDB + REST API + Authentication + Authorization + Mail Notifications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.7%
  • Shell 0.3%