Skip to content

[category] (feat/delete-auth): Implemented role based authorization f… - #274

Open
anamul-hoque-shourov wants to merge 1 commit into
NesoHQ:masterfrom
anamul-hoque-shourov:fix/delete-category-auth
Open

[category] (feat/delete-auth): Implemented role based authorization f…#274
anamul-hoque-shourov wants to merge 1 commit into
NesoHQ:masterfrom
anamul-hoque-shourov:fix/delete-category-auth

Conversation

@anamul-hoque-shourov

Copy link
Copy Markdown

📘 Description
Adds role-based JWT authentication to the DELETE /api/v1/categories/{id} endpoint. Only users with the admin role can delete categories. Also updates JWT generation to include role and is_admin claims.

📂 Related Issue
Closes #198

🚀 Changes Made

  • Updated handlers.DeleteCategoryByID to enforce admin-only access
  • Modified middlewares.AuthenticateJWT to store role and is_admin in the request context
  • Added helper function middlewares.IsAdmin(r *http.Request) bool
  • Updated util.GenerateToken to include role and is_admin in JWT claims
  • Updated tests for token generation and authorization

✅ Checklist

  • Follows contribution guidelines
  • Tested endpoint with admin and non-admin JWT tokens

…or DELETE /api/v1/categories/{category_id} api endpoint
@cla-assistant

cla-assistant Bot commented Oct 30, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@geomachine

Copy link
Copy Markdown
Collaborator

We have further developed the product. please check the product and find another issue and acknowledge. then we will close the pr,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CORTEX] Delete category API

3 participants