Skip to content

ray-shani/alx-hub-access-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 

Repository files navigation

ALX Hub Access Management System

A Django-based backend application for managing user access to the ALX Hub in Westlands. This system replaces manual Google Sheets sign-ins with a secure, programmatic system. Users are categorized as Students, Alumni, Staff, or Community Members, and administrators can track hub usage in real-time.

This project highlights backend development, REST API design, and role-based access control.


Features

  • User Management (CRUD)

    • Create new user profiles
    • Read user details
    • Update existing user information
    • Delete user records
  • Role-Based Categorization

    • Users categorized as Student, Alumni, Staff, or Community Member
  • Admin Panel

    • Manage users via Django’s built-in admin interface
  • REST API

    • Fully functional API endpoints for programmatic user management
  • Optional API Integration

    • Fetch sample users/emails from external APIs for testing

Technologies Used

  • Backend: Python, Django, Django REST Framework
  • Database: SQLite (upgradeable to PostgreSQL)
  • API Testing: Postman
  • Authentication: Django Admin (superuser login)
  • Other: JSON for API payloads, RESTful architecture

Challenges & Solutions

  • Replacing manual sign-ins:
    Created a UserProfile model with role-based access and CRUD APIs using Django REST Framework

  • Validating user roles:
    Added serializer validation to enforce allowed statuses:

    student, staff, alumni, community
    

** Project Structure**

│
├── alx_hub_access/      # Project settings and configuration
│   ├── __init__.py
│   ├── settings.py      # Project settings
│   ├── urls.py          # Root URL routes
│   └── wsgi.py
│
├── users/               # App handling user profiles
│   ├── __init__.py
│   ├── admin.py         # Register models in Django admin
│   ├── apps.py
│   ├── migrations/      # Database migrations
│   ├── models.py        # UserProfile model
│   ├── serializers.py   # DRF serializer for UserProfile
│   ├── tests.py
│   ├── urls.py          # API endpoints for CRUD
│   └── views.py         # API views (CRUD logic)
│
├── db.sqlite3           # SQLite database
└── manage.py            # Django management tool

** Admin Access

-Visit: http://127.0.0.1:8000/admin/

-Log in with superuser credentials

-Manage user profiles directly from the web interface

**Testing

** Installation & Usage**

Create a virtual environment

  • python -m venv env
  • source env/bin/activate # macOS/Linux
  • env\Scripts\activate # Windows

Install dependencies

  • pip install -r requirements.txt

Apply migrations

  • python manage.py migrate

Create a superuser

  • python manage.py createsuperuser

Run the server

  • python manage.py runserver

Access API endpoints:

Access Admin Panel:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages