#39065 closed enhancement (fixed)
Replace `is_super_admin()` checks with `manage_network` cap checks for `get_dashboard_url()`
| Reported by: | flixos90 | Owned by: | flixos90 |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.8 |
| Component: | Role/Capability | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests commit |
| Cc: | Focuses: | multisite |
Description
This is part of the #37616 task. The two is_super_admin() checks in get_dashboard_url() should be replaced by user_can( $user_id, 'manage_network' ) which is a suitable cap here. In addition to the mentioned ticket's goals, this fixes a possible bug since one of the two checks does not actually pass the $user_id to is_super_admin() which would always check for the current user instead of the ID passed to the function.
Since there are no unit tests for get_dashboard_url(), these should be added as well.
Attachments (3)
Change History (9)
#2
@
10 years ago
- Keywords has-unit-tests added
- Owner set to
- Status new → assigned
Thanks again for the patch @iaaxpage!
I added unit tests in 39065.diff.
#3
@
10 years ago
39065.2.diff improves the unit tests as the common test user is now created in wpSetUpBeforeClass() to speed up the related tests.
#4
@
10 years ago
- Keywords commit added
+1 39065.2.diff looks good, @flixos90.
We already discussed this off-ticket a bit, but we can remove the $wp_rewrite->init(); portion as it isn't necessary here.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Replaced is_super_admin with user_can($user_id, 'manage_network' )