-
Notifications
You must be signed in to change notification settings - Fork 113
feat: add affiliation attribute to user #4113
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
Conversation
|
@jaeyun0503 Could you please move the field to the already existing modal of |
I think this is a design question whether to use affiliation for one of the two purposes:
If option 1, then we should go with your implementation so that every time when a new user comes into our system, the admin user can see their affiliation to decide whether to approve or not. If we choose option 2, then I think my implementation works fine since the affiliation part is collected once people are approved into the system. I think we should ask Professor Li to see which option seems better for our system. |
|
My general thought is that each user can provide their affiliation optionally, as some of them prefer not to provide such information. If the design is still not clear, we can do a short meeting and report the decision here. |
That aligns with my current design where users can optionally enter the affiliation at the very first time they log into the system. I think this PR is good for review. |
|
@aicam Please review it. |
aicam
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.
My biggest concern currently is the new field in User type, most of file changes in this PR are due to adding redundant null to all User objects
...r/src/main/scala/org/apache/texera/web/resource/dashboard/admin/user/AdminUserResource.scala
Show resolved
Hide resolved
amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/UserResource.scala
Show resolved
Hide resolved
Head branch was pushed to by a user without write access
# What changes were proposed in this PR? ## Summary To gather more user information for a better overview of users, this PR introduces a new column `affiliation` to the `user` table. Now when a user logins to the Texera for the first time (after getting approved to REGULAR role), they will be prompted to enter their affiliation. The answer will be recorded to the database and retrieved when admins enter the admin dashboard. ## For Developers Please do the following steps to incorporate with new changes: - Apply sql/updates/16.sql to your local postgres instance - Run common/dao/src/main/scala/org/apache/texera/dao/JooqCodeGenerator.scala to generate jooq tables ## Sample Video https://github.com/user-attachments/assets/61e895db-8e30-4c59-8e98-fa527995b486 ## Design of the Feature When a user logins to the system for the first time, they will be prompted to enter their affiliation after getting approved to REGULAR role. The user can submit their affiliation and the frontend would send this information to the backend to save in the database. Users can choose to either enter the affiliation or skip the prompt and the system would remember if the user has been prompted or not by checking the user data from the database. Depending on the user's answer, the `affiliation` column would have different data (more details are included in "Backend Changes"). The system would only prompt once when the user logins to the system for the first time and would never ask again. To view the affiliation information, admins can go to the admin dashboard to view the affiliations of users. ## Backend Changes Introduced column `affiliation` to the `user` table. This column would have three types of entry: 1. null: Indicates the user has never been prompted before. Next time when the user logins to the system, they will be prompted to answer the affiliation question. 2. emptry string "": the user has been prompted and did not answer the affiliation question. This is to indicate that the user did not answer this question (whether by hitting the skip button, ESC, X, or pressing spaces outside of the prompt). 3. Actual value. `16.sql` adds the column to the `user` table and ensures the existing users' affiliation column is set to null. ddl file changed as well. Added a `UserResource.scala` file to include the functions/apis related to retrieving & updating User data. Currently it only contains functions related to this PR, but in future other related functions can be added to this file as well. ### Original `user` Schema <img width="300" height="400" alt="image" src="https://github.com/user-attachments/assets/5be89398-583e-486c-96af-448fffbbf2d5" /> ### Proposed `user` Schema <img width="300" height="400" alt="image" src="https://github.com/user-attachments/assets/b1522ce0-f905-4865-a62d-813770eef3d7" /> ## Frontend Changes Added the prompt window to pop up in the main page after logging in. Added `affiliation` column to admin dashboard to cooperate with the new data. Changed files that contain class `User` as new attribute `affiliation` is added to the class. ### Any related issues, documentation, discussions? <!-- Please use this section to link other resources if not mentioned already. 1. If this PR fixes an issue, please include `Fixes apache#1234`, `Resolves apache#1234` or `Closes apache#1234`. If it is only related, simply mention the issue number. 5. If there is design documentation, please add the link. 6. If there is a discussion in the mailing list, please add the link. --> Closes Issue apache#4118. ### How was this PR tested? <!-- If tests were added, say they were added here. Or simply mention that if the PR is tested with existing test cases. Make sure to include/update test cases that check the changes thoroughly including negative and positive cases if possible. If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future. If tests were not added, please describe why they were not added and/or why it was difficult to add. --> Manually tested. ### Was this PR authored or co-authored using generative AI tooling? <!-- If generative AI tooling has been used in the process of authoring this PR, please include the phrase: 'Generated-by: ' followed by the name of the tool and its version. If no, write 'No'. Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details. --> Generated-by: ChatGPT 5.1 (bug fixing)
### What changes were proposed in this PR? This PR introduces sorting by affiliation to admin dashboard. In PR #4113 we introduced a new field `afiiliation` to `user` table. To allow admins to sort by affiliation to quickly navigate through users with affiliation, we added the sort by affiliation feature to the admin dashboard. It uses the same comparison logic as other sort functions. ### Any related issues, documentation, discussions? <!-- Please use this section to link other resources if not mentioned already. 1. If this PR fixes an issue, please include `Fixes #1234`, `Resolves #1234` or `Closes #1234`. If it is only related, simply mention the issue number. 2. If there is design documentation, please add the link. 3. If there is a discussion in the mailing list, please add the link. --> Improves #4118. ### Sample screenshot <img width="1796" height="1226" alt="image" src="https://github.com/user-attachments/assets/d6310e37-e58a-4df1-bfe4-af5959995ebb" /> ### How was this PR tested? <!-- If tests were added, say they were added here. Or simply mention that if the PR is tested with existing test cases. Make sure to include/update test cases that check the changes thoroughly including negative and positive cases if possible. If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future. If tests were not added, please describe why they were not added and/or why it was difficult to add. --> Manually tested. ### Was this PR authored or co-authored using generative AI tooling? <!-- If generative AI tooling has been used in the process of authoring this PR, please include the phrase: 'Generated-by: ' followed by the name of the tool and its version. If no, write 'No'. Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details. --> No.
What changes were proposed in this PR?
Summary
To gather more user information for a better overview of users, this PR introduces a new column
affiliationto theusertable. Now when a user logins to the Texera for the first time (after getting approved to REGULAR role), they will be prompted to enter their affiliation. The answer will be recorded to the database and retrieved when admins enter the admin dashboard.For Developers
Please do the following steps to incorporate with new changes:
Sample Video
Screen.Recording.2025-12-08.at.00.10.17.mov
Design of the Feature
When a user logins to the system for the first time, they will be prompted to enter their affiliation after getting approved to REGULAR role. The user can submit their affiliation and the frontend would send this information to the backend to save in the database. Users can choose to either enter the affiliation or skip the prompt and the system would remember if the user has been prompted or not by checking the user data from the database. Depending on the user's answer, the
affiliationcolumn would have different data (more details are included in "Backend Changes"). The system would only prompt once when the user logins to the system for the first time and would never ask again. To view the affiliation information, admins can go to the admin dashboard to view the affiliations of users.Backend Changes
Introduced column
affiliationto theusertable. This column would have three types of entry:16.sqladds the column to theusertable and ensures the existing users' affiliation column is set to null. ddl file changed as well.Added a
UserResource.scalafile to include the functions/apis related to retrieving & updating User data. Currently it only contains functions related to this PR, but in future other related functions can be added to this file as well.Original
userSchemaProposed
userSchemaFrontend Changes
Added the prompt window to pop up in the main page after logging in.
Added
affiliationcolumn to admin dashboard to cooperate with the new data.Changed files that contain class
Useras new attributeaffiliationis added to the class.Any related issues, documentation, discussions?
Closes Issue #4118.
How was this PR tested?
Manually tested.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: ChatGPT 5.1 (bug fixing)