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

Group managers UI #108

Merged
merged 13 commits into from
Jan 23, 2025
Merged

Group managers UI #108

merged 13 commits into from
Jan 23, 2025

Conversation

Sahil590
Copy link
Contributor

@Sahil590 Sahil590 commented Jan 22, 2025

Description

Added two view functions for adding and removing users, respectively.
I have added a link as the HTML page doesn't look the cleanest, so can change if needed.

Fixes #73 #93 (issue)

Type of change

  • Documentation (non-breaking change that adds or improves the documentation)
  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass (eg. python -m pytest)
  • The documentation builds and looks OK (eg. python -m sphinx -b html docs docs/build)
  • Pre-commit hooks run successfully (eg. pre-commit run --all-files)

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added or an issue has been opened to tackle that in the future. (Indicate issue here: # (issue))

@Sahil590 Sahil590 linked an issue Jan 22, 2025 that may be closed by this pull request
Copy link
Collaborator

@cc-a cc-a left a comment

Choose a reason for hiding this comment

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

Thanks @Sahil590. Looking good. One tweak to the behaviour I think.

imperial_coldfront_plugin/views.py Outdated Show resolved Hide resolved
imperial_coldfront_plugin/templates/group_members.html Outdated Show resolved Hide resolved
imperial_coldfront_plugin/views.py Outdated Show resolved Hide resolved
@Sahil590 Sahil590 requested a review from cc-a January 23, 2025 10:39
Comment on lines 9 to 14
{% if request.user.userprofile.is_pi or request.user == member.group_owner %}
| <a href="{% url 'imperial_coldfront_plugin:make_manager' member.pk %}">Make manager</a>
{% endif %}
{% if member.is_manager and request.user.userprofile.is_pi or member.group_owner %}
| <a href="{% url 'imperial_coldfront_plugin:remove_manager' member.pk %}">Remove manager</a>
{% endif %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe the only logic required here is to hide both of these if is_manager is true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was overthinking this one too much.

Copy link
Contributor Author

@Sahil590 Sahil590 Jan 23, 2025

Choose a reason for hiding this comment

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

It also needs to hide the remove button if the member is not manger and the same with the make manager button

Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe that only group owners, managers and superusers can access the view. Managers are the only ones that shouldn't see the links so it should be enough to check that.

@Sahil590 Sahil590 requested a review from cc-a January 23, 2025 13:32
@cc-a cc-a enabled auto-merge January 23, 2025 18:08
@cc-a cc-a force-pushed the group-managers-ui branch from 76e5e7f to 100a189 Compare January 23, 2025 18:08
@cc-a cc-a merged commit f5d5d4d into main Jan 23, 2025
3 of 4 checks passed
@cc-a cc-a deleted the group-managers-ui branch January 23, 2025 18:09
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.

View/UI for removal of group managers View/UI for creation of group managers
2 participants