-
Notifications
You must be signed in to change notification settings - Fork 62
Feat : update org members API learners ENT-11260 #2503
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
base: master
Are you sure you want to change the base?
Feat : update org members API learners ENT-11260 #2503
Conversation
3726ebe to
5a73629
Compare
| WHERE | ||
| ecu.enterprise_customer_id = %s | ||
| AND | ||
| AND |
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.
nit: remove extra space
kiram15
left a comment
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.
Looks good, but I would add a test to validate that it is no longer including users with the admin role here.
5fb55a8 to
5e12dea
Compare
|
Hi @kiram15 , |
| return response.Response( | ||
| {"detail": "Could not find enterprise uuid {}".format(enterprise_uuid)}, | ||
| status=status.HTTP_404_NOT_FOUND, | ||
| except OperationalError as exc: |
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.
Please add comment
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.
Hi @msaha-sonata ,
Added comments.
e94d224 to
da135d5
Compare
msaha-sonata
left a comment
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.
Looks good to me
kiram15
left a comment
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.
Looks good! But I'm confused why you have a similar one open without the tests? I think this should be the only one that is merged in.
pwnage101
left a comment
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.
The query SQL change looks good, but I have a concern about the exception handler fallback logic.
| # Fallback query without auth_userprofile | ||
| fallback_query = query.replace( | ||
| "LEFT JOIN auth_userprofile as aup on au.id = aup.user_id", | ||
| "" | ||
| ).replace( | ||
| "coalesce(NULLIF(aup.name, ''), au.username)", | ||
| "au.username" |
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.
In my opinion, this kind of SQL manipulation is extremely risky. Are you sure auth_userprofile is sometimes missing in test/minimal environments? The UserProfile model does not seem optional.
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.
Hi @pwnage101
I worked on your comments. could you please check once let me the same.
…ializers, and tests - Added comments to EnterpriseCustomerAdmin and EnterpriseCustomerMembers - Updated views and serializer tests for learners vs admins - Verified invited_date and joined_date handling in tests
ac2c05a to
9e107ea
Compare
| @staticmethod | ||
| def has_auth_userprofile_table(): | ||
| """ | ||
| Some minimal / test Open edX environments do not include auth_userprofile. |
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.
Where did you learn this?
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.
Hi @pwnage101
I actually I didn't understand your question.
can you please elaborate.
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.
Your code states "Some minimal / test Open edX environments do not include auth_userprofile."
I don't think this is true, so I am curious where you learned this.

feat : [BE] Update Organizations Members API.
Update “Organizations Members” API to only fetch learner data.
This PR updates the existing Organization Members API to strictly return learner-type records for an enterprise customer. Previously, the API could return a mix of users with different roles
ENT-11260