osu-capstone-cs72 / cs-applied-plan-portal

A portal that streamlines the planning process for OSU CS Applied students and advisors
https://applied-plan-portal.herokuapp.com
MIT License
2 stars 5 forks source link

Add User API routes and authentication #38

Closed philectron closed 4 years ago

philectron commented 4 years ago
  1. Clone this branch
  2. Do npm install on the root of the repo. No need to install things in the client.
  3. npm run server. Note the port that the server runs on, since we will need this later on.
  4. Open a browser--no incognito!
  5. Search for your name on OSU Search.
  6. Click on your directory in the "People" result.
  7. Note the address bar; it has the query field osuuid=YOUR_OSUUID_NUMBER. Remember this 11-digit number for the next step.
  8. Go to this address:
https://login.oregonstate.edu/idp-dev/profile/cas/login?service=http://localhost:YOUR_PORT_HERE/user/login?redirectToPath=/user/YOUR_OSUUID_NUMBER/plans

where YOUR_PORT_HERE is the port that the server is currently running on, and YOUR_OSUUID_NUMBER is your 11-digit OSUUID number. Log in as usual.

  1. Magic ... ... ... ...
  2. You most likely don't have any Plans yet, so it'll show a not-found 404 error.
  3. You can (should) add a few Plans for yourself via the shell connecting to MySQL. If you don't have MySQL installed on your computer, do it on Flip.
  4. Make sure you are connected to OSU's network. Do this by simply connecting to the internet on campus or via OSU VPN.
  5. Run this:
mysql -h HOST -u USER -p DB_NAME

where HOST, USER, and DB_NAME are the latest MySQL credentials that Zak provided.

  1. Once you access MySQL, add a few Plans for yourself. Follow this template:
insert into Plan (status, planName, studentId) value (0, "some awesome name", YOUR_OSUUID_NUMBER);

where YOUR_OSUUID_NUMBER is your 11-digit OSUUID number.

  1. Once you insert some of your Plans successfully, try accessing the route /user/YOUR_OSUUID_NUMBER/plans again, where YOUR_OSUUID_NUMBER is your 11-digit OSUUID number.

  2. You should see a JSON result of the Plans you just inserted earlier.

  3. Now, try accessing someone else's Plans. Try the same route again but with a different userId.

  4. It should show you a 403 Forbidden error, since you are a student and thus don't have access to other students' Plans.

philectron commented 4 years ago

So far, I don't have any conflicts against master except the database initialization script. I will take whatever comes out of #37.

silverware13 commented 4 years ago

Lots of conflicts with master. I will have to do a new round of testing in the morning to make sure no bugs were added while resolving conflicts.

philectron commented 4 years ago

He's gonna turn red annnnnyyyy seconds now..... Mergify is gonna merge any seconds now.