Skip to content

jaslam94/Roles-Management-Blazor-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blazor Roles Management

.NET 5 Blazor Server ASP.NET Core Entity Framework Bootstrap SQL Server

A comprehensive user and role management system built with Blazor Server and ASP.NET Core Identity, demonstrating advanced authentication and authorization features.

Overview

This application provides a complete administrative interface for managing users and roles in an ASP.NET Core application. It features a clean, responsive UI built with Blazor Server components and Bootstrap styling.

Features

User Management

  • Create Users: Add new users with email, first name, and last name
  • Edit Users: Update user information including extended profile fields (NickName, TaxID_RUC)
  • Delete Users: Remove users from the system
  • Password Generation: Generate secure random passwords for users
  • User Search & Pagination: Sortable table with pagination support

Role Management

  • Create Roles: Add new roles to the system
  • Edit Roles: Modify existing role names
  • Delete Roles: Remove roles (with proper validation)
  • Role Assignment: Assign/remove roles from users

Authentication & Security

  • ASP.NET Core Identity: Complete identity management system
  • Role-based Authorization: Admin-only access to management features
  • Secure Password Handling: Hashed passwords with secure generation
  • Profile Management: Users can manage their own profiles

UI/UX Features

  • Responsive Design: Bootstrap-based responsive layout
  • Modal Dialogs: Clean popup interfaces for user interactions
  • Data Tables: Sortable, paginated tables using BlazorTable component
  • Real-time Updates: Server-side Blazor for immediate UI updates

Technology Stack

  • .NET 5: Target framework
  • Blazor Server: UI framework for interactive web applications
  • ASP.NET Core Identity: Authentication and authorization
  • Entity Framework Core: Data access with SQL Server
  • Bootstrap: CSS framework for responsive design
  • BlazorTable: Component library for data tables

Project Structure

BlazorRolesMgmt/
??? Areas/Identity/          # ASP.NET Core Identity scaffolded pages
??? Data/                    # Entity Framework models and context
??? Helpers/                 # Utility classes (password, string helpers)
??? Pages/                   # Blazor pages and components
?   ??? Components/          # Reusable Blazor components
?   ??? ManageUsers.razor    # User management interface
?   ??? ManageRoles.razor    # Role management interface
??? Services/                # Business logic services
??? wwwroot/                 # Static files and assets

Getting Started

Prerequisites

  • .NET 5 SDK
  • SQL Server (LocalDB supported)
  • Visual Studio 2019/2022 or VS Code

Installation

  1. Clone the repository
  2. Update the connection string in appsettings.json
  3. Run Entity Framework migrations:
    dotnet ef database update
  4. Build and run the application:
    dotnet run

Default Setup

The application automatically creates default roles (Admin, Client) on startup. Register a new account and manually assign the Admin role in the database to access management features.

Key Components

Services

  • IManageUsersService: User CRUD operations and role assignment
  • IManageRolesService: Role management operations

Helper Classes

  • PasswordHelper: Secure password generation with complexity requirements
  • StringHelper: Utility methods for string operations
  • Hasher: Password hashing utilities

UI Components

  • EditUserModal: User creation/editing interface
  • EditUserRolesModal: Role assignment interface
  • PasswordModal: Password display for new users
  • EditRoleModal: Role management interface

Database Schema

The application extends ASP.NET Core Identity with:

  • ApplicationUser: Extended user model with FirstName, LastName, NickName, TaxID_RUC
  • Standard Identity Tables: Users, Roles, UserRoles, etc.

Security Features

  • Role-based Authorization: [Authorize(Roles = "Admin")] protection
  • Secure Password Generation: 12-character passwords with complexity requirements
  • Input Validation: Server-side validation for all forms
  • CSRF Protection: Built-in ASP.NET Core protection

Development Notes

This project was built as a learning exercise and portfolio demonstration. It showcases:

  • Clean architecture patterns
  • Separation of concerns with service layers
  • Modern Blazor development practices
  • Comprehensive user management features

Last updated: Based on commit from 2021 (project built with .NET 5)


Note: This project is not open for public contributions. It serves as a portfolio piece demonstrating technical capabilities in ASP.NET Core and Blazor development

About

Open-source .NET Blazor app for roles and users management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published