#236 Make admin portal easier to discover
Merged 5 years ago by jflory7. Opened 5 years ago by alishapapun.
fedora-commops/ alishapapun/fedora-happiness-packets experiment  into  master

file modified
+2 -2
@@ -14,8 +14,8 @@ 

  

  if settings.ADMIN_ENABLED or settings.DEBUG:

      urlpatterns += [

-         re_path(r'^drunken-octo-lama/login/', RedirectView.as_view(url=settings.LOGIN_URL, permanent=True, query_string=True)),

-         re_path(r'^drunken-octo-lama/', admin.site.urls)

+         re_path(r'^admin/login/', RedirectView.as_view(url=settings.LOGIN_URL, permanent=True, query_string=True), name='admin_login'),

+         re_path(r'^admin/', admin.site.urls, name='admin')

I almost forgot about this. The number of times I have forgotten this obscure URL is too often. :stuck_out_tongue_closed_eyes:

      ]

  

  if settings.DEBUG:

file modified
+10 -5
@@ -38,11 +38,16 @@ 

                          <img class="arrow-expanding" src="/static/images/arrow-white.png" alt="side menu expanding icon">

                      </h3>

                      <ul class="dropdown-menu">

-                         {% url 'messaging:received_messages' as url %}

-                         <li><a class="dropdown-item" href="{{ url }}">My Received Packets</a></li>

-                         {% url 'messaging:sent_messages' as url %}

-                         <li><a class="dropdown-item" href="{{ url }}">My Sent Packets</a></li>

- 

+                         

+                         {% if user.is_superuser %}

+                         {% url 'admin:index' as url %}

+                             <li><a class="dropdown-item" href="{{ url }}">Admin Portal</a></li>

+                         {% endif %}

+                             {% url 'messaging:received_messages' as url %}

+                             <li><a class="dropdown-item" href="{{ url }}">My Received Packets</a></li>

+                             {% url 'messaging:sent_messages' as url %}

+                             <li><a class="dropdown-item" href="{{ url }}">My Sent Packets</a></li>

+                         

                          <form id="logout" action="{% url 'oidc_logout' %}" method="post">

                              {% csrf_token %}

                              <button type="submit" class="btn btn-logout">

This PR address #207 and needs some debugging and walkthrough. @shraddhaag could you have a look?

The current setup:
If the user is superuser => only Admin Portal list item is available to the user. My Received Packets and My Sent Packets are not available.
If the user is not a superuser => My Received Packets and My Sent Packets list items available.
Expected Setup:
If the user is superuser => All three option, My Received Packets, My Sent Packets and Admin Portal must be available.
If the user is not a superuser => My Received Packets and My Sent Packets list items available.

We need to only check if the user is a superuser for the Admin Portal option. So this conditional can be moved at the bottom after the other two list items such that those are always available to the user.

admin:index works without including admin_urls. You can remove this :)

@alishapapun awesome work :raised_hands:
The PR looks good to me. It just needs a couple minor changes I mentioned inline.
Let me know if the comments make sense :)

I almost forgot about this. The number of times I have forgotten this obscure URL is too often. :stuck_out_tongue_closed_eyes:

Metadata Update from @jflory7:
- Pull-request tagged with: PASSED, improvement, needs changes, type - frontend, type - summer coding
- Request assigned

5 years ago

@alishapapun Looking good! :thumbsup: Thanks @shraddhaag for jumping on this review. :raised_hands:

1 new commit added

  • Fix bugs
5 years ago

rebased onto ecc92f5

5 years ago

@shraddhaag Hope this PR is perfect to get merged?

@shraddhaag Hope this PR is perfect to get merged?

Definitely! Looks good to me, I'm +1 for merging.

Metadata Update from @jflory7:
- Pull-request untagged with: needs changes

5 years ago

Looks good to me too. Thanks @alishapapun!

Merging. :ocean:

Pull-Request has been merged by jflory7

5 years ago