Git Product home page Git Product logo

secret-project-331's Introduction

Secret Project 331

Before you start working on this project, please run npm ci in the repo root.

Development environment setup

Read Development.md on how to setup using Windows or Linux.

Seed cluster database

bin/seed

Code style:

npm run eslint

Documentation

Backend: https://rage.github.io/secret-project-331/headless_lms_server/index.html

Database: https://rage.github.io/secret-project-331-db-docs/

Shared module storybook: https://rage.github.io/secret-project-storybook/

Mobile first design: https://github.com/rage/secret-project-331/tree/master/docs/mobile-first-design.md

For other documentation, check out the docs folder.

License

The program in folder services/cms is licensed under the GNU General Public License, Version 3 (https://www.gnu.org/licenses/gpl-3.0.en.html). Everything else is licensed under Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0).

secret-project-331's People

Contributors

anadis504 avatar d471061c avatar dependabot[bot] avatar george-misan avatar hegepi avatar heliozoa avatar ipegii avatar jolampi avatar kenkku avatar maijjay avatar nygrenh avatar redande avatar sebazai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

kenkku eerohuusko

secret-project-331's Issues

LMS: Deleting e.g. front page twice fails:

Reproduce:

  • Create course front page
  • Delete course front page
  • Create course front page
  • Delete course front page -> FAILS
[2021-05-06T08:57:29Z ERROR actix_http::response] Internal Server Error: InternalServerError("error returned from database: duplicate key value violates unique constraint \"pages_url_path_course_id_deleted_key\"")
[headless-lms] [2021-05-06T08:57:29Z INFO  actix_web::middleware::logger] "DELETE /api/v0/cms/pages/7d3e3666-7491-439f-9c98-80f718bfabfa HTTP/1.1" 500 213 "http://project-331.local/cms/courses/d86cf910-4d26-40e9-8c9c-1cc35294fdbb/overview" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36" 172.17.0.2:35108 14.703912ms

Endpoint for the cms namespace for getting a paginated list of submissions for a exercise.

The endpoint is meant for teachers who want to list all submissions to a exercise.

Accepted endpoint paths:

  • /api/v0/cms/exercises/:exercise_id/submissions => defaults to page 1 and page size 100
  • /api/v0/cms/exercises/:exercise_id/submissions?page=2 => page 2 and page size 100
  • /api/v0/cms/exercises/:exercise_id/submissions?page=3&limit=1000 => page 3 and page size 1000

Endpoint accepts all page sizes under or equal to 1000.
The endpoint should return all fields that's in the exercises table.

Output could be something like this:

{
  "data": [...],
  "total_pages: 22
}

For the controller we need a exercises module here: https://rage.github.io/secret-project-331/headless_lms_actix/controllers/cms/index.html

Automatically open Chapter in course-material when given timestamp

automatically_open_at timestamp to db
status enum which tells whether a chapter is opened

in course grid, chapters not open greyed out and they will have a timestamp (date and time).

in the last ten minutes, show a countdown to the time. e.g. "Chapter opens in 9minutes 31 seconds"

Permissions management

The system will feature role-based access control where roles can either be global, organization-specific or course-specific.

Different roles are able to perform different actions.

For this we'll need:

  1. Table for storing the roles
  2. Functions to check whether someone has the permission to perform an action.
  3. Interfaces for managing the user's roles

The table

I think one table for all the roles is enough. The table should include columns for user_id, organization_id, course_id and one for the role enum.

User id and role enum are mandatory fields, the others are optional.

If course_id and organization_id are null the role is considered global.
If organization_id is not null and course_id is null the role is considered organization-specific.
If course_id is not null the role is considered course-specific.

Functions

Functions sound like a better idea than a middleware because that enables us to do the check at any point in the request's lifecycle. For the function signature I'd take inspiration from the cancancan library: https://github.com/CanCanCommunity/cancancan

Rough idea:

pub fn authorize(action: &Action, user_id: &Uuid, resource: x) -> Result

If the result is ok, the authorization succeeded, if the result is err, the authorization failed.

For the implementation we'll also need a mapping from roles to allowed actions. It could be something like this: https://github.com/rage/quizzes/blob/99de38798a0e20536bf198abf457a685ccdc8dd1/packages/backendv2/src/controllers/dashboard/util.ts#L51-L56

Course progress

  • CMS Block
  • LMS Endpoint
  • Course-material component

image

image

Data from this table: https://github.com/rage/secret-project-331-db-docs/blob/master/public.user_exercise_states.md -- course progress for current logged in user for the current course instance.

Rendering implemented by adding a new block to the course material: https://github.com/rage/secret-project-331/blob/master/services/course-material/src/components/ContentRenderer/index.tsx#L41

lms endpoint

{
   "score_given": 3,
   "score_maximum": 10,
   "total_exericises": 66,
   "completed_exercises": 13
}

Endpoint:

GET /api/v0/course-material/course-instances/:course_instance_id/progress

course material scope: endpoint for getting next page in material

Intstructions: https://github.com/rage/secret-project-331/blob/e173d9ec08466e8d5637ad5bb0722c4e95836cc4/docs/headless-lms.md#new-endpoint

GET /api/v0/course-material/pages/:current_page_id/next-page

New pages module here: https://rage.github.io/secret-project-331/headless_lms_actix/controllers/course_material/index.html

{
   "path": "/path-to-next/page",
   "name": "Name of the next page",
   "part": 1,
}

Most stuff from here: https://github.com/rage/secret-project-331-db-docs/blob/master/public.pages.md

Part number from here: https://github.com/rage/secret-project-331-db-docs/blob/master/public.course_parts.md

Uniqueness constraint:

CREATE UNIQUE INDEX xxx ON yyyy (order_number, chapter_id)
WHERE deleted_at IS NOT NULL;

Course variant status enum

  • enum

    • Draft - "Hidden from everyone except course staff"
    • Upcoming - "Course is visible in course listings as upcoming but only a special front page is visible. The special front page could be an optional field on a course variant e.g. marketing_page_for_before_publishing_id REFERENCES pages"
    • Active
    • Ended
  • Support for automatically opening and closing a course variant based on timestamp

    • binary to headless lms that gets run in a cronjob ("src/bin/update_course_variant_statuses.rs")
[[bin]]
name = "update-course-variant-statuses"
path = "update_course_variant_statuses.rs"

Example chronjob: https://github.com/rage/mooc.fi/blob/master/helm/templates/update-course-statuses-cronjob.yml

command: cargo run --bin update-course-variant-statuses

Starting cronjob manually: kubectl create job --from cronjob/cronjob-name random-unique-name

Chapter progress

  • CMS Block
  • LMS Endpoint to get course chapter progress
  • Material-template component

Pending: Planning & Implementation of unlocking exercises/parts based on something

course material exercises in this chapter block

Implement Common Blocks

https://wordpress.org/support/article/blocks/

  • Paragraph
    • Rendering
    • Attributes
  • Image
    • Rendering
    • Attributes
  • Heading
    • Rendering
    • Attributes
  • Gallery
    • Rendering
    • Attributes
  • List
    • Rendering
    • Attributes
  • Quote
    • Rendering
    • Attributes
  • Audio
    • Rendering
    • Attributes
  • Cover
    • Rendering
    • Attributes
  • File
    • Rendering
    • Attributes
  • Video
    • Rendering
    • Attributes

Support for logging in and logging out

This system is meant to use the mooc.fi's new login system but as that is not ready yet, we'll implement a temporary solution based on TMC.

Steps:

  • add a login page to the main-frontend microservice.
  • Add a endpoint for handling the login requests to backend
    • The endpoint will delegate the login request to TMC and if the tmc approves logging in we will create a entry for the user to the users table and update session to indicate the user is logged in
    • Want to use this: https://docs.rs/actix-session/0.4.1/actix_session/
  • Make frontends somehow aware of the session. Maybe an api for checking the logged in status and storing that into a react context
  • Add an endpoint for logging out. It should just invalidate the session
  • Show log in button and log out buttons in the frontends, probably we'll need some duplicated code for this

Mockups for permission management

Permissions are mappings from users to different roles.
The roles we currently have are: admin, assistant, teacher, reviewer.

For managing permissions we need a view where some people can edit the roles and where some people can only observe the roles. Starting point could be something like this:

image

The roles can be specified on three levels:

  • On course level: grants role only to the course
  • On organization level: grants role to all courses in the organization
  • Global level: grants role to all courses in all organizations

I was thinking for each level we could have a different view but all of them would look similar.

image

image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.