Resource Locker

Core → Silver
💰 $1000

Downloadable resources tied to each course or session.

Technology iconTechnology iconTechnology icon
# Resource Locker Overview

## **Purpose**
The Resource Locker module is designed to serve as a centralized repository for managing downloadable educational resources tied to specific courses or sessions. Its primary goal is to streamline the storage, organization, and distribution of these materials while ensuring secure access based on user permissions.

## **Benefits**

1. **Secure Access Control:** Ensures that only authorized users, such as enrolled students or session participants, can access specific resources, enhancing data security.

2. **Version Management:** Tracks different versions of files, allowing updates without disrupting current access and providing historical records for reference.

3. **Integration Capability:** Seamlessly integrates with Learning Management Systems (LMS), enabling direct linking of course materials from the LMS platform.

4. **Efficient Distribution:** Automates the delivery process, making it easy for users to download resources directly, thereby reducing manual effort and potential errors.

5. **Usage Tracking:** Logs access and download activities, offering insights into resource usage for monitoring and reporting purposes.

6. **Compliance Assurance:** Helps maintain regulatory compliance by controlling access to sensitive materials and tracking their distribution history.

## **Usage Scenarios**

1. **Course Material Management:** Instructors can upload and organize course syllabi, lecture notes, assignments, and supplementary materials within the Resource Locker, which are then linked to specific courses in the LMS.

2. **Session Files Handling:** Session-specific files such as presentation decks, meeting recordings, or handouts are stored and accessed by participants through their session enrollment details.

3. **User Downloads:** Students and participants can access course materials or session resources directly from the Resource Locker via login, ensuring they have necessary files for their studies.

4. **Regular Updates:** Facilitates easy updates of existing resources to correct errors, add new information, or replace outdated content without affecting current users' access.

5. **Audit and Compliance:** Institutions can audit resource usage to ensure compliance with internal policies and external regulations regarding data access and distribution.

6. **Team Collaboration:**structors and administrative staff can collaborate on managing resources, with role-based permissions ensuring appropriate access levels for each user.

7. **Offline Access Options:** Resources can be downloaded for offline use, benefiting users without consistent internet access or preferring offline work.

8. **Customizable Permissions:** Offers granular control over resource access, allowing tailored permissions based on user roles, courses, or specific sessions.

## **Key Features**

- Centralized storage and organization of educational resources.
- Role-based access control with customizable permissions.
- Versioning system for file updates and historical tracking.
- Integration APIs for seamless LMS integration.
- Logging and reporting tools for usage tracking and auditing.
- Secure file download options with optional offline access.
- User-friendly interface for easy navigation and resource retrieval.

This overview highlights the essential aspects of the Resource Locker module, detailing its purpose, benefits, and various usage scenarios to provide a comprehensive understanding of its functionality and value within an educational framework.

Resource Locker Module Documentation

1. Role-Based Access Control

The Resource Locker module enforces role-based access control, allowing only authorized users (e.g., instructors, students, or admins) to view, download, or manage resources based on predefined permissions.

2. Resource Management

Manages downloadable files, videos, PDFs, and other media types tied to specific courses or sessions.

3. Session-Based Access Control

Enforces time-bound access to resources based on course schedules or session availability.

4. Audit Logging

Tracks user activity and resource access for auditing purposes.

5. Download Limits

Enforces download limits on resources to prevent overuse or misuse.

6. Integration with External Storage

Supports integration with third-party storage solutions (e.g., AWS S3, Google Cloud Storage) for scalable and reliable resource hosting.

7. Cleanup Policy

Automatically removes unused or expired resources based on predefined rules (e.g., last accessed time, file size, or version).

8. Version Control

Manages different versions of the same resource to allow users to access historical or updated content.

Resource Locker Module Documentation

The Resource Locker module provides functionality to manage downloadable resources tied to specific courses or sessions. Below is a breakdown of the implementation details, including an API endpoint, React UI snippet, and data schema.

1. FastAPI Endpoint (Resource Upload)

from fastapi import APIRouter, Depends, HTTPException
from fastapi.security import OAuth2PasswordBearer
import os
from typing import Optional
from pydantic import BaseModel

router = APIRouter()
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")

class Resource(BaseModel):
    title: str
    description: str
    resource_type: str  # e.g., 'PDF', 'IMAGE', 'VIDEO'
    file_size: int
    upload_date: str

# Mock database storage (replace with actual DB)
resources = {}

async def get_current_user(token: str = Depends(oauth2_scheme)):
    # Implement user authentication logic here
    return {"username": "current-user"}  # Replace with actual user retrieval

@router.post("/api/resources/upload", dependencies=[Depends(get_current_user)])
async def upload_resource(
    file, 
    title: str,
    description: Optional[str] = "",
    resource_type: str = "PDF"
):
    if not file:
        raise HTTPException(status_code=400, detail="File is required")
    
    # Validate resource type
    allowed_types = ['PDF', 'IMAGE', 'VIDEO']
    if resource_type not in allowed_types:
        raise HTTPException(
            status_code=400,
            detail=f"Invalid resource type. Allowed types: {allowed_types}"
        )
    
    # Save file to storage
    filename = os.path.join("uploads", file.filename)
    with open(filename, "wb") as f:
        f.write(await file.read())
    
    resource_data = {
        "title": title,
        "description": description,
        "resource_type": resource_type,
        "file_size": file.size,
        "upload_date": str(datetime.now())
    }
    
    resources[filename] = Resource(**resource_data)
    return {"message": f"Resource '{title}' uploaded successfully"}

2. React UI (Resource Upload Form)

import React, { useState } from 'react';
import { useDropzone } from 'react-dropzone';

function ResourceUpload() {
    const [selectedFile, setSelectedFile] = useState(null);
    const [formData, setFormData] = useState({
        title: '',
        description: ''
    });

    const onDrop = (acceptedFiles) => {
        setSelectedFile(acceptedFiles[0]);
    };

    const { getRootProps, getInputValue } = useDropzone({
        onDrop,
        accept: {
            'image/*': ['.png', '.jpg', '.jpeg'],
            'application/pdf': ['.pdf']
        }
    });

    const handleSubmit = async (e) => {
        e.preventDefault();
        
        // Implement API call here
        try {
            // Replace with actual API endpoint and file upload logic
            console.log('Uploading resource:', formData);
        } catch (error) {
            console.error('Upload failed:', error);
        }
    };

    return (
        <form onSubmit={handleSubmit}>
            <div {...getRootProps()}>
                <input {...getInputValue()} type="file" />
                {selectedFile && (
                    <div>
                        Selected File: {selectedFile.name}
                    </div>
                )}
            </div>

            <input
                type="text"
                placeholder="Resource Title"
                value={formData.title}
                onChange={(e) => setFormData({ ...formData, title: e.target.value })}
            />

            <textarea
                placeholder="Description"
                value={formData.description}
                onChange={(e) => setFormData({ ...formData, description: e.target.value })}
            />

            <select 
                name="resourceType" 
                value={formData.resource_type || 'PDF'}
                onChange={(e) => setFormData({ ...formData, resource_type: e.target.value })}
            >
                <option value="PDF">PDF</option>
                <option value="IMAGE">IMAGE</option>
                <option value="VIDEO">VIDEO</option>
            </select>

            <button type="submit">Upload Resource</button>
        </form>
    );
}

export default ResourceUpload;

3. Pydantic Data Schema (Resource Model)

from pydantic import BaseModel
from datetime import datetime

class Resource(BaseModel):
    id: str
    title: str
    description: Optional[str] = None
    resource_type: Literal['PDF', 'IMAGE', 'VIDEO']
    file_size: int
    upload_date: datetime
    file_path: str

    class Config:
        json_schema_extra = {
            "example": {
                "id": "64a3f2d8-7c0e-454e-b9c9-123abcde4567",
                "title": "Sample Resource",
                "description": "This is a sample resource for demonstration purposes.",
                "resource_type": "PDF",
                "file_size": 123456,
                "upload_date": "2023-10-05T12:34:56Z",
                "file_path": "/uploads/sample-resource.pdf"
            }
        }

Notes

Resource Locker Module Documentation

Overview

The Resource Locker module provides functionality for managing downloadable resources tied to specific courses or sessions. It allows users to upload, manage, and access course materials securely.



Use Cases

  1. Instructor Resource Upload: Instructors can upload course materials (PDFs, videos, etc.) directly or via a user interface.
  2. Student Resource Access: Students can download assigned resources based on their enrolled courses and permissions.
  3. Administrator Resource Management: Administrators can manage resource access rights across multiple courses.
  4. External Storage Integration: Supports integration with external storage solutions (e.g., AWS S3) for large-scale resource hosting.
  5. Resource Versioning: Allows instructors to upload multiple versions of the same resource and track changes.

Integration Tips

  1. Secure Credential Management:
    • If using external storage (e.g., S3), store credentials securely in environment variables or a secret manager.
  2. Session-Based Access:
    • Use session tokens to control access to resources during active sessions.
  3. Resource Validation:
    • Implement checks for file types and sizes to prevent misuse.
  4. Cache Optimization:
    • Cache frequently accessed resources to reduce server load and improve performance.
  5. Audit Logging:
    • Log resource download attempts, including user IDs and timestamps, for auditing purposes.

Configuration Options

Option NameDescriptionDefault ValuePossible Values
enable_anonymous_accessAllow anonymous users to access resources?falsetrue, false
max_download_attemptsMaximum number of failed download attempts before blocking the user5Any non-negative integer
resource_expiry_durationDuration (in hours) after which a resource expires24Any positive integer
file_format_restrictionsList of allowed file formats for upload and download['pdf', 'docx']Array of file extensions (e.g., [‘pdf’, ‘zip’])
storage_backendStorage backend to use (local, s3, gcs)'local''local', 's3', 'gcs'
download_chunk_sizeSize of chunks for streaming large files1024Any positive integer

Conclusion

The Resource Locker module is a critical component for managing course materials and ensuring secure access. By integrating with related modules like Course Management and User Authentication, it provides a robust solution for educational platforms.