|
| 1 | +# How it works |
| 2 | +This is a more detailed documentation of how meteor works, and how |
| 3 | +the code we added interacts with helpq, and allows integration with LCS |
| 4 | + |
| 5 | +## Meteor |
| 6 | +Meteor is a framework for doing both frontend and backend development |
| 7 | +in JavaScript. The meteor server accomplishes this by two means: |
| 8 | + |
| 9 | +### Methods |
| 10 | +these are effectively like api requests. a client can call a method with |
| 11 | +Meteor.call and that communicates with the server to call serverside code. |
| 12 | +methods are added with Meteor.methods |
| 13 | + |
| 14 | +### Collections |
| 15 | +Meteor also gives you a conduit to directly query the MongoDB database from |
| 16 | +the client. This is built on a websocket type interface so when you update a |
| 17 | +collection it can push the changes out to all the clients that are watching it. |
| 18 | +users don't have access to the whole database though. you manually configure |
| 19 | +what users can and can't do with documents. this allows meteor to be secure and |
| 20 | +is also why methods are needed for when a user needs someone with special |
| 21 | +permission (like the server) to do something for them. |
| 22 | + |
| 23 | +## LCS integration |
| 24 | +On startup and for login, the server will contact LCS over HTTP to get user data |
| 25 | +and to validate passwords. in server/lib/lcs.js there is a function that takes in |
| 26 | +the config and adds all the LCS functionality to helpq. things like: |
| 27 | +- dynamically getting the floor plan image to display to the user |
| 28 | + + this is so there is a single source of truth so if the floor plan changes |
| 29 | + we don't have to rebuild/redeploy a bunch of applications that use this |
| 30 | +- get the names of all available locations on the map. |
| 31 | + + this is only updated at start time, but is done for all the reasons above |
| 32 | + + this can get fixed using something like fetch in the client and passing the |
| 33 | + client the endpoint from config |
| 34 | +- LCS login |
| 35 | + + on every login helpq asks if a username and pass is valid. if it isn't it checks |
| 36 | + to see if the user was added manually |
| 37 | + + if a user was valid it changes their password/creates their account in helpq |
| 38 | +- checking user roles in LCS |
| 39 | + + the first time a user logs in it will check to see if they have the mentor role |
| 40 | + in LCS. if they do it also gives them the appropriate role in helpq |
0 commit comments