outmoded / university

Community learning experiment
Other
371 stars 193 forks source link

Assignment9 and Beyond #172

Closed zoe-1 closed 8 years ago

zoe-1 commented 9 years ago

Where are we going next? Most of the goals discussed at: #132 have been achieved.

Below is a list of subjects discussed earlier that have not yet been covered or were lightly covered. @FennNaten made most of the below recommendations in the discussion at: #132. Read the below and share your thoughts about the direction of the university :-)

I have been preparing to use couchdb in a hapijs application by writing logic with 100% test coverage here: sofajs This project is not complete but it illustrates a direction we could head with couchdb (nano and 100% hapijs/lab test coverage)

Other Ideas:

Couto commented 9 years ago

I know I've not been doing the exercises or delivering assignments, but I've been following the project.

Personally, I would really be interested in seeing more about cache handling and role-base authorization, and I would like to see some examples of image/file uploading, but I feel that could be done on a a future assignment where you allow some privileged users to upload photos and store information about them on a database (or something similar...)

Anyway these are just my votes! Keep up with the good work ;)

zoe-1 commented 9 years ago

@Couto good to have your input :-) In respect to role-base authorization, what would you like to see? Currently, the project uses scopes and hapi-auth-cookie to check if a user's role is authorized to access specific routes or not. What other RBAC features would you like to add?

Couto commented 9 years ago

I have to admit that I don't dwell too much with backend code, so take my case with a grain of salt, or dismiss it at all if it doesn't make sense.

My problem with RBAC is when several roles can use the same endpoint to perform an action but with different privileges. e.g.:

Having regular users, moderators and administrators. All roles can upload an avatar to their profiles by performing a POST request to /upload, however, regular users can only upload 128x128 images, moderators are allowed a bigger limit like 256x256 and administrators can upload anything they want.

What's the best way to manage all this? I guess that in the specific above example we'll always have to get the image first, check its dimensions and then perform the appropriated action, and I have to admit that I'm missing a better use case, something where you could check their privilege before performing any kind of action.

Mostly likely I'm just missing something simple... :)

devinivy commented 9 years ago

On the topic of role-based authorization, it's worth checking out the mrhorse plugin, which allows you to add lifecycle hooks on route configurations (called "policies"). There's also rumor hapi9 may have proper per-route lifecycle hooks: https://github.com/hapijs/hapi/issues/2566.

Couto commented 9 years ago

@devinivy Thanks for the suggestion! I can see mrhorse being quite useful :+1:

mikejerome commented 9 years ago

I'm also interested in role-based authorization

james-gardner commented 9 years ago

Personally I would love to see a demonstrated approach/assignment that details database integration. I've learned heaps from the assignments so far - can't wait for the next - thanks!

devinivy commented 9 years ago

Would there be any interest in a version of this tutorial extended into an assignment? It would be about integrating hapi with waterline ORM to create an API.

james-gardner commented 9 years ago

@devinivy Looks great. From a newbie perspective I'd be keen to understand the low level aspects first (i.e. what these plugins literally save me doing) before moving on to an ORM and so on. The assignment with 'glue' was really useful in that sense because I could see how much effort it was saving me and what the objectives were.

devinivy commented 9 years ago

Thanks for the feedback. Yeah, this is a few steps further removed from hapi than glue, and it's a bit more complicated to relate the value of these plugins. If there's more interest, it would also be nice to reach out to @moklick who wrote that tutorial.

In the interest of transparency, I'm the lead maintainer of those two plugins and a collaborator with waterline ORM. That both makes me a good candidate to help write the assignment, and also necessarily biased :P. But if there's interest in working with databases in hapi, I do believe it would be a useful route to explore.

zoe-1 commented 9 years ago

@devinivy and @james-gardner @mikejerome and @Couto

It is really good to have everyones input. From the above comments it seems that most people are interested in role-based access controls and integrating a database. I suggest we pursue both of these objectives in the next couple assignments by: one, integrating a database into the project. two, providing features that utilize RBAC (Role based access controls).

In respect to a database, over the past several weeks, I have been researching intergrating couchdb into our project. There are several things I really like about couchdb:

How to approach couchdb.

I suggest using couchdb with nano because nano is minimalistic and will force us to really get to know couchdb. A high level tool like cradle would create too much separation between us and couchdb.
Warning:

note about redis

Eventually, redis should be included in this project but to approach two databases at the same time would be too much. First, include couchdb and get to know it really well inside of the hapijs environment. Later, redis would be added.

Please give feedback. Cheers!

rutaihwa commented 8 years ago

I'm still very interested, when are we coming off hibernation mode.

zoe-1 commented 8 years ago

@rutaihwa Good to hear from you.
Here are some thoughts about future direction.

Work responsibilities have been big so have not tackled writing another assignment. However, on the positive side of things, the current project covers the core elements of setting up the hapijs framework and people seem to be making good use of it.

Next week plan to share more thoughts. If you are interested in helping move the project forward let me know. It would be enjoyable to build out assignments with someone else versus doing it alone.

Or, if someone is motivated and wants to contribute an assignment, please open up an issue and make a proposal. With the combination of the holiday coming the end of this month and work being busy, I will not be able to make any assignments until next year. But, I do plan to publish all the couchdb user crud data as mentioned above.

Cheers!

rutaihwa commented 8 years ago

Thanks @zoe-1 this project has been very good and helpful (speaking for my self at least). The proposals that you are making are interesting. I will be glad to help with little that I could.

I am having my semester final exams this coming week and holiday is coming along with some travellings.

I have been a lot more fixated on working on some sort of beautiful api design but I have not yet started playing with couchDB, but I would like to learn and work it out. I could also help with updating to the current hapi version. All in all, would like to contribute.

zoe-1 commented 8 years ago

@rutaihwa I am glad you want to contribute to the project.

I just put up a bunch of couchdb request logic at https://github.com/sofajs/sample . Almost done writing all the user CRUD logic. Currently, has 100% test coverage for create and delete logic. And much of the update logic is written but needs coverage. Take a look at the above and let me know what you think.

zoe-1 commented 8 years ago

sample user couchdb queries completed. To see the work do the following:

rutaihwa commented 8 years ago

Thanks @zoe-1 will play with sofajs.

zoe-1 commented 8 years ago

Your welcome @rutaihwa. I will look more at your project we have been corresponding about too.