#39065 closed enhancement (fixed)
Replace `is_super_admin()` checks with `manage_network` cap checks for `get_dashboard_url()`
Reported by: | flixos90 | Owned by: | flixos90 |
---|---|---|---|
Milestone: | 4.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Role/Capability | Keywords: | has-patch has-unit-tests commit |
Focuses: | multisite | Cc: |
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
@
8 years ago
- Keywords has-unit-tests added
- Owner set to flixos90
- Status changed from new to assigned
Thanks again for the patch @iaaxpage!
I added unit tests in 39065.diff.
#3
@
8 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
@
8 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.
Replaced is_super_admin with user_can($user_id, 'manage_network' )