Skip to content

Refactor user permissions and enhance stack, tag, and techie of the m…#135

Merged
TMCreme merged 2 commits intomainfrom
Ransford/backend-upgrade
Apr 6, 2026
Merged

Refactor user permissions and enhance stack, tag, and techie of the m…#135
TMCreme merged 2 commits intomainfrom
Ransford/backend-upgrade

Conversation

@RansfordGenesis
Copy link
Copy Markdown
Contributor

…onth routes

  • Introduced user_accepted permission check to ensure only accepted users can access certain endpoints.
  • Updated routes in stacks.py, tags.py, techieotm.py, technical_task.py, users.py, weekly_meetings.py to use user_accepted for user validation.
  • Modified SkillRepository to normalize skill names for consistency.
  • Enhanced ProjectService to validate project tools and stacks during creation and updates, ensuring no duplicates and proper error handling.
  • Updated tests to reflect changes in user authentication and permissions, ensuring proper access control for various endpoints.
  • Improved skill search functionality and response formats across services and tests.

Copilot AI review requested due to automatic review settings April 5, 2026 19:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens access control across multiple endpoints by introducing a shared “accepted user” permission guard, while also standardizing skill naming/skill API responses and strengthening project relationship validation.

Changes:

  • Added user_accepted permission dependency and updated multiple routes to require accepted/active users.
  • Normalized skill naming and adjusted skill search/response formats (including /skills/all returning a flat list).
  • Enhanced project create/update validation for stacks/tools (existence checks, duplicate handling in create, relationship updates in update).

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
utils/permissions.py Introduces user_accepted and applies it to admin/PM checks.
services/user_service.py Extends profile search to accept an optional status filter.
db/repository/users.py Adds status filtering and expands text search (email + full name).
api/routes/profile_page.py Exposes status filter and applies user_accepted to profile endpoints.
api/routes/users.py Opens org-chart read endpoint to accepted users (admin remains for write/admin views).
api/routes/weekly_meetings.py Restricts meeting read endpoints to accepted users.
api/routes/coding_challenges.py Restricts challenge read endpoints to accepted users.
api/routes/techieotm.py Restricts techie-of-the-month read endpoints to accepted users.
api/routes/tags.py Restricts tag endpoints to accepted users.
api/routes/stacks.py Restricts stack read/list endpoints to accepted users.
api/routes/project.py Restricts project reads/list/members endpoints to accepted users.
api/routes/feeds.py Restricts feed endpoints to accepted users.
api/routes/skills.py Requires accepted users for most skill operations; changes /skills/all response shape; admin-gates /skills/data.
services/skill_service.py Improves “add skills” behavior, adjusts search output fields, normalizes pool skill creation.
db/repository/skills.py Centralizes skill-name normalization in repo methods.
api/api_models/skills.py Changes skill name normalization behavior at the schema level.
services/project_service.py Adds duplicate checks on create and relationship validation on update.
api/routes/technical_task.py Applies user_accepted consistently to applicant task/submission reads/writes.
api/routes/email_templates.py Admin-gates reads of templates.
api/routes/announcements.py Adds admin-only image upload endpoint; requires accepted users for reads.
test/conftest.py Ensures admin fixture user is ACCEPTED so admin-gated endpoints pass.
test/test_weekly_meetings.py Updates tests for accepted-user requirement.
test/test_coding_challenges.py Updates tests for accepted-user requirement.
test/test_techieotm.py Updates tests to include auth headers for now-protected endpoints.
test/test_stacks.py Updates tests to include auth headers for protected endpoints.
test/test_projects.py Updates tests to include auth headers for protected endpoints.
test/test_profile_page.py Updates tests to include auth headers for now-protected endpoint(s).
test/test_org_chart.py Updates org-chart tests to reflect accepted-user access model.
test/test_feeds.py Updates feed tests to include auth headers.
test/test_announcements.py Updates announcement tests to include auth headers.
test/test_email_templates.py Updates email template tests to include auth headers.
test/test_skills.py Updates skill tests for auth and new /skills/all response shape.
test/test_skill_service_response.py Updates skill search response-format expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TMCreme TMCreme merged commit 0b3c58c into main Apr 6, 2026
1 check passed
@TMCreme TMCreme deleted the Ransford/backend-upgrade branch April 6, 2026 00:28
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.

3 participants