NEMO icon indicating copy to clipboard operation
NEMO copied to clipboard

[Feature request] Allow users to modify their own profiles (and edit groups)

Open abuckles-uci opened this issue 1 year ago • 6 comments

Hello,

At UC Irvine we've implemented a customization to allow users to edit their own profiles. Clicking your name in the navbar will take you to /user/{user_id}/ where user_id is your own user id.

We also added functionality to create_or_modify_user to allow users to add and remove themselves from groups (just like projects). Maybe this should be a different feature request / PR?

What do you think would be a good way to implement this feature? It appears the "Modify user" page is geared towards staff currently. Maybe there could be a setting to allow users to edit their own profiles. Thanks!

image

abuckles-uci avatar Dec 05 '23 23:12 abuckles-uci

Hello, That's an interesting idea, but I am not sure users should be able to modify many of the fields. In fact, I don't think they should be able to modify anything except for their first and last name possibly. The username is their unique identifier, used for ldap login and other authentication a lot, and would be a pretty big issue if they could change it. Also badge number, access expiration, whether they are active and/or need to complete the facility rules tutorial, their projects and tool qualifications would also present a lot of issues if they could modify them.

So if I were to do that, I would put it in a separate page, or probably just stick it in the preferences page.

Are the groups django authentication groups? or some other kind of group you created?

rptmat57 avatar Dec 08 '23 13:12 rptmat57

Hi @rptmat57,

Yeah I see the issue with allowing users to edit a lot of those fields. The groups are from django.contrib.auth.models. It's the groups relationship in the NEMO User class.

abuckles-uci avatar Dec 08 '23 15:12 abuckles-uci

Ah this is an important note that I forgot. If the user is not user.is_any_part_of_staff we set the form to readonly. Though it looks like "Projects" is still editable.

Staff can still edit all the fields like shown above.

image

abuckles-uci avatar Dec 08 '23 16:12 abuckles-uci

Oh I see, if it's just a read only user profile page, that might be useful. it would have to be turned off by default and have an option in Customization. Not sure if the badge number should be hidden or not

Regarding the groups, this functionality is available in the NEMO-User-details plugin: https://gitlab.com/nemo-community/atlantis-labs/nemo-user-details

rptmat57 avatar Dec 08 '23 17:12 rptmat57

Hello! We've worked a bit on having a separate page for readonly users to view and have come up with the following: image (2-1) For UCI we need our non staff users to assign their own projects, but would a readonly view without editing be useful for NEMO?

Valilian avatar Apr 12 '24 20:04 Valilian

Hi, Yes, I think that would be extremely useful. It would allow users to see their information and potential report any missing projects/tools etc. In the future, I could see using that page to allow users to hide/show and order projects in case they don't use some of them very often, etc.

rptmat57 avatar Apr 12 '24 20:04 rptmat57

Hi! I've got the PR together here: https://github.com/usnistgov/NEMO/pull/229

I've added a staff check to send staff to the original user edit page, whereas users get sent to the readonly page. Let me know if there's any changes we can make. Thanks!

Valilian avatar May 16 '24 00:05 Valilian

One small issue I ran across is that when a staff member clicks on the link in the "Welcome, User" it will use the view_user url but send them to the create_or_modify_user page. I will look into ways to redirect to the correct url, but if you have any insight on how to easily fix that please let me know.

Valilian avatar May 16 '24 00:05 Valilian

Hi @rptmat57,

I see that the PR has been merged, thanks! I was wondering if in the future you could see there being an option to allow users to edit aspects of their profile? Admin would have to opt-in on the customizations page. For example at UC Irvine, an option to allow users to edit their projects (add/remove) would be helpful. I understand that the page being read-only (at least by default) is desired.

Thanks, Aaron

abuckles-uci avatar May 28 '24 16:05 abuckles-uci

Hi @abuckles-uci, Honestly, I highly doubt letting users edit their own projects will ever be an option. It would lead to so many issues, with users charging other projects without approval, etc.

I am going to close this issue. We can always reopen it if things change

rptmat57 avatar May 29 '24 17:05 rptmat57

I understand. Thank you for the response!

abuckles-uci avatar May 29 '24 19:05 abuckles-uci