Implement role-based access control and enhance security features#1926
Merged
vikrantwiz02 merged 3 commits intoJun 29, 2026
Merged
Conversation
…ce result announcement API
…pdating access control for views
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors authentication and authorization checks in the academic modules by replacing the use of the
@login_requireddecorator with a new, more granular@require_designationdecorator for view functions. This change enhances security by ensuring that only users with appropriate roles can access specific endpoints, and also introduces a missing@role_required(['student'])decorator in an API view. Additionally, some views and utility functions have had the login requirement removed entirely, likely because they are now only called internally or are otherwise protected.The most important changes are:
Authorization and Authentication Improvements:
@login_requiredwith@require_designationon key views inacademic_procedures/views.pyto enforce role-based access control for students, faculty, and admins. For example, student actions (like course registration) now require the "student" designation, and faculty/admin actions require their respective roles. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]@role_required(['student'])to theget_next_sem_coursesAPI view inacademic_procedures/api/views.pyto restrict access to students only.Code Simplification and Cleanup:
@login_requiredfrom utility/helper functions that are not exposed as views or are used internally, reducing unnecessary authentication checks and potential confusion. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19]Dependency Updates:
require_designationdecorator fromapplications.globals.accessinacademic_procedures/views.py.These changes collectively improve the security model of the academic modules by ensuring that only users with the correct roles can access or modify sensitive academic data and actions.