DEV Community

Cover image for AI Content Assistant with Role-Based Access Control (RBAC)
Ravindra Kumar
Ravindra Kumar

Posted on

AI Content Assistant with Role-Based Access Control (RBAC)

This is my submission for the [https://Permit.io Dev Challenge]
#permitio #devchallenge #rbac #javascript #webdev #ai


πŸ” What I Built

An AI-powered content assistant where:

  • Users submit content for AI summarization.
  • Admins can review, approve, reject, and publish summaries.
  • RBAC is handled using Permit.io to ensure only authorized actions.

πŸ’‘ AI Summary is mocked due to API limits, but the RBAC and flows are fully functional!


🎯 The Problem It Solves

AI-generated content is powerful, but publishing it without review can lead to misinformation.

This tool helps solve that by ensuring:

  • Users can use AI to generate drafts.
  • Only approved roles (admins) can publish or approve that content.

🌟 Demo

πŸ”— Live App: [https://ai-content-review-fjt8.vercel.app/)

πŸ“ GitHub Repo: https://github.com/Ravi-Coding/ai-content-review


πŸ› οΈ How I Built It

  • Frontend: React (Vite) + TypeScript + Tailwind CSS
  • Backend: Express.js + Node.js
  • Authorization: @permit.io/sdk
  • Hosting: Vercel (Frontend), Render (Backend)
  • AI Summary: Mocked for now (can be extended using OpenAI)

πŸ” RBAC with Permit.io

Using permit.check(user, action, resource) to validate access.


ts
const allowed = await permit.check(user, "summarize", "content");
if (!allowed) {
  return res.status(403).json({ error: "Access Denied" });
}

## πŸ” Roles Defined

- **user**: Can submit content  
- **admin**: Can approve, delete, and publish  

---

## πŸ–₯️ Dashboards Included

### User Dashboard:
- Submit content  
- View status  

### Admin Dashboard:
- View all submissions  
- Approve / Delete / Publish  

---

## πŸ’‘ Lessons & Challenges

- πŸ”„ Mocked AI summaries to simulate production AI logic  
- πŸ›‘οΈ Implemented clean role-based permissions using Permit.io’s policy UI  
- ⚠️ Error handling and fallback logic to ensure seamless UX  

---

## πŸ™Œ Special Thanks

Huge thanks to **Permit.io** for this opportunity and their powerful SDK + Policy Studio!

---

## πŸ“Œ Final Thoughts

Permit.io made it **incredibly easy** to manage permissions without hardcoding logic.  
This challenge helped me understand how secure AI tools can be built in real-world production.

Feel free to try it out and give feedback πŸ™
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
ravi-coding profile image
Ravindra Kumar

very Help Full !