-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Update forum role membership api to DRF ( 11th ) #35343
base: master
Are you sure you want to change the base?
Conversation
|
||
if rolename not in [FORUM_ROLE_ADMINISTRATOR, FORUM_ROLE_MODERATOR, FORUM_ROLE_GROUP_MODERATOR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this line, now serializer will do all the validation.
has_instructor_access = has_access(request.user, 'instructor', course) | ||
has_forum_admin = has_forum_access( | ||
request.user, course_id, FORUM_ROLE_ADMINISTRATOR | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a shortcoming of the permissions.InstructorPermission class? that we can't check these two and the above EDIT_FORUM_ROLES
permissions at the same time for a user? Could we adapt the permission class to check for multiple roles or use a different one so that all the permissions checks happen as DRF permission checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@feanil in separate API which is related with forums I have re-write the functionality.
Related [PR]
(#35366). I will merge 35366
first and then I will rebase this later.
has_instructor_access
means user must be instructor.
has_forum_admin
means user be added as Administrator
in Django_Comment_Common > Roles
.
Issues
Verify via postman
unique_student_identifier
:username
rolename
: pass any from the list [Administrator
,Moderator
,Group Moderator
,Community TA
]action
:allow
orrevoke
expected result
{ "course_id": "course-v1:edx+cs222+2311", "action": "allow" }
Verify via instructor dashboard
Discussion Moderators list
.