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

Always allow admins to edit any interface in PortAdmin #2786

Merged

Conversation

lunkwill42
Copy link
Member

This changes the authorization logic for editing interface in PortAdmin. Originally, an interface is only considered "editable" if its native VLAN value is one of the VLANs the logged-in user is allowed to edit. For an admin, this list of VLANs consists of all the VLANs that PortAdmin found to be configured on a switch. However, if a port is configured with an invalid native VLAN value, or, as is supported on platforms like JunOS, no default VLAN value is set at all, PortAdmin was unable to determine that such a port was editable at all.

This change ensures the VLAN verification is outright skipped if the user has admin privileges in NAV. All interfaces will be marked as editable.

Fixes #2477

It doesn't matter that a port is set to an invalid native VLAN, if the
user has admin-level access, they should still be allowed to edit the
port and fix the problem.
@lunkwill42 lunkwill42 self-assigned this Dec 13, 2023
Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

codecov bot commented Dec 13, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (b51ca9d) 57.00% compared to head (2e73fd7) 57.03%.
Report is 3 commits behind head on 5.8.x.

Files Patch % Lines
python/nav/web/portadmin/utils.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            5.8.x    #2786      +/-   ##
==========================================
+ Coverage   57.00%   57.03%   +0.03%     
==========================================
  Files         567      567              
  Lines       41277    41280       +3     
==========================================
+ Hits        23528    23544      +16     
+ Misses      17749    17736      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Test results

     12 files       12 suites   12m 4s ⏱️
3 303 tests 3 303 ✔️ 0 💤 0
9 384 runs  9 384 ✔️ 0 💤 0

Results for commit 2e73fd7.

@lunkwill42 lunkwill42 merged commit 2b52575 into Uninett:5.8.x Dec 13, 2023
11 checks passed
@lunkwill42 lunkwill42 deleted the bugfix/portadmin-admin-edit-all-ports branch December 13, 2023 13:47
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.

2 participants