Skip to content
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: list_forum_members-to-drf api to drf ( 14th ) #35366

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

awais786
Copy link
Contributor

@awais786 awais786 commented Aug 23, 2024

issue

  1. API is not DRF compatible.
  2. Added new tests to verify all exceptions.
  3. Added new test to verify JWT is working.

verify via postman

1: Try this URL with post request.
post-data = rolename: Group Moderator or any other role.

2: Valid data should be existed in admin/django_comment_common/role/ table.

expected result
{ "course_id": "course-v1:edx+cs222+2311", "Group Moderator": [ { "username": "login_service_user", "email": "[email protected]", "first_name": "", "last_name": "", "group_name": null } ], "division_scheme": "none" }

Verify from dashboard
1: Go to this page
2: User needs aleast two roles ( course-access-role as staff and Administrator as Forum Admin.

Screenshot 2024-08-27 at 6 24 55 PM

@awais786 awais786 changed the title feat: upgrading simple api to drf compatible. feat: upgrading simple api to drf compatible ( 14th ) Aug 23, 2024
@awais786 awais786 changed the title feat: upgrading simple api to drf compatible ( 14th ) feat: list_forum_members-to-drf api to drf compatible ( 14th ) Aug 23, 2024
@awais786 awais786 changed the title feat: list_forum_members-to-drf api to drf compatible ( 14th ) feat: list_forum_members-to-drf api to drf ( 14th ) Aug 23, 2024
@awais786 awais786 requested a review from feanil August 27, 2024 09:08
@awais786 awais786 closed this Aug 27, 2024
@awais786 awais786 reopened this Aug 27, 2024
@awais786 awais786 marked this pull request as ready for review September 6, 2024 13:28
if rolename == FORUM_ROLE_ADMINISTRATOR and not has_instructor_access:
raise PermissionDenied("Operation requires instructor access.")

return True
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of defaulting to True I think it's better to default to false and have a check for each of the combinations we're okay with. I'm having a little bit of trouble understanding how the two checks are different. If you're already checking to see if the user is a FORUM_ROLE_ADMINSTATOR do you care about whether or not that parameter is passed into the request?

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.

2 participants