railroad/usora

User management system.

v3.0.2 2024-04-15 15:55 UTC

README

Usora is a user management system including auth, user settings, user information, and single sign on.

Single Sign On

How it Works

Users can be signed in on any domain running this package with a single login attempt from any of the domains as long as they are all connected to the same usora database. This is possible by setting authentication cookies on all participating domains after the login succeeds using html img tags.

API Reference

Get Index of Users

GET user/index

Request Example(s)

$.ajax({
    url: 'https://www.musora.com' +
        '/usora/user/index?' +
        'limit=10' + '&' +
        'page=1' + '&' +
        'order_by_column=email' + '&' +
        'order_by_direction=asc',
    type: 'get',
    dataType: 'json',
    success: function(response) {
        // handle success
    },
    error: function(response) {
        // handle error
    }
});

Request Parameters

path|query|body key required default description|notes
query limit 25
query page 1
query order_by_column 'created_at'
query order_by_direction 'desc'

Response Example(s)

200 OK
{
   "status":"ok",
   "code":201,
   "results":{
      "id":217988,
      "content_id":202313,
      "key":"difficulty",
      "value":"1",
      "type":"integer",
      "position":1
   }
}

Get Single User by ID

GET user/show/{id}

Request Example(s)

var userId = 1;

$.ajax({
    url: 'https://www.musora.com' +
        '/usora/user/show/' . userId,
    type: 'get',
    dataType: 'json',
    success: function(response) {
        // handle success
    },
    error: function(response) {
        // handle error
    }
});

Request Parameters

path|query|body key required default description|notes
path yes Id of the user to be returned

Response Example(s)

200 OK
{
   "id":"1",
   "email":"pascale84@schimmel.com",
   "password":"$2y$10$hh5cU.fo.Jq48A267zkjiun\\/W.TwbRs4Pg02Nm.X7k.s5yKQxVMj2",
   "remember_token":"D5mpp6aZhvi5vOD7Fs4EDMw8782Be3hXcrRa7cUEaqt6eXlmQPmKbaU1RKdy",
   "session_salt":"0bPpeEbf13tpNi5zkN6bHSQ5Oq72s7YVrCkh2rkRA65Jttd16d0RGQNJbc1R",
   "display_name":"sed accusamus dolorem ut",
   "created_at":"1526460917",
   "updated_at":"1526460917",
   "fields":[]
}

Update User's Display Name

PUT user/update/{id}

Request Example(s)

var userId = 1;
var displayNameToSet = 'sed accusamus dolorem ut';

$.ajax({
    url: 'https://www.musora.com' +
        '/usora/user/update/' . userId,
    type: 'patch',
    data: {display_name: displayNameToSet},
    dataType: 'json',
    success: function(response) {
        // handle success
    },
    error: function(response) {
        // handle error
    }
});

Request Parameters

path|query|body key required default description|notes
path yes user id
body display_name yes new display name to set

Response Example(s)

200 OK
{
   "id":"1",
   "email":"pascale84@schimmel.com",
   "password":"$2y$10$hh5cU.fo.Jq48A267zkjiun\\/W.TwbRs4Pg02Nm.X7k.s5yKQxVMj2",
   "remember_token":"D5mpp6aZhvi5vOD7Fs4EDMw8782Be3hXcrRa7cUEaqt6eXlmQPmKbaU1RKdy",
   "session_salt":"0bPpeEbf13tpNi5zkN6bHSQ5Oq72s7YVrCkh2rkRA65Jttd16d0RGQNJbc1R",
   "display_name":"sed accusamus dolorem ut",
   "created_at":"1526460917",
   "updated_at":"1526460917",
   "fields":[

   ]
}

(todo: the rest of the endpoints)

Get details from "USORA USER MANAGEMENT SYSTEM - JSON API" section of https://musora.readme.io/v1.0.0/reference

  • put, user/store
  • patch, user/update/:id
  • delete, user/delete/:id
  • get, user-field/index/:id
  • get, user-field/show/:id
  • put, user-field/store
  • patch, user-field/update/:id
  • patch, user-field/update-or-create-by-key
  • delete, user-field/delete/:id
  • patch, user-field/update-or-create-multiple-by-key

Events

Name Parameters Listener exists Resultant action(s)
UserEvent id, eventType no n/a
EmailChangeRequest token, email no n/a

EmailChangeRequest

Captures that an EmailChangeRequest was made.

Trigger exists in request method of EmailChangeController

No Listener exists.

UserEvent

Capture any user-account change.

Trigger exists in:...

  1. Both UserQuery* methods
    1. insertGetId (eventType param value: "created")
    2. update (eventType param value: "updated")
  2. All three UserFieldQuery* methods (eventType param value: "field-updated" in each)
    1. insertGetId
    2. update
    3. delete

*namespace for each is Railroad\Usora\Repositories\Queries

No listener exists.

The End.