Make WordPress Core

Opened 4 years ago

Last modified 3 months ago

#13972 new defect (bug)

Add new category link - capability check needed

Reported by: wjm Owned by:
Milestone: Future Release Priority: normal
Severity: minor Version: 3.0
Component: Posts, Post Types Keywords: has-patch needs-testing commit
Focuses: administration Cc:



If user doesn´t have "manage_categories" capability, add new link page, will show "add new category" link and form,
it should be hidden.

Attachments (5)

add_new_link_category.patch (590 bytes) - added by wjm 4 years ago.
13972.diff (2.3 KB) - added by wojtek.szkutnik 4 years ago.
13972-2.patch (2.2 KB) - added by bpetty 22 months ago.
13972-3.patch (2.2 KB) - added by bpetty 10 months ago.
13972.4.patch (3.3 KB) - added by SergeyBiryukov 10 months ago.

Download all attachments as: .zip

Change History (18)

wjm4 years ago

comment:1 nacin4 years ago

  • Keywords needs-patch added
  • Milestone changed from Unassigned to Future Release

We should probably use the taxonomy API here and utilize the caps object.

comment:2 wojtek.szkutnik4 years ago

  • Cc wojtek.szkutnik@… added
  • Keywords has-patch needs-testing gsoc added; needs-patch removed

comment:3 wojtek.szkutnik4 years ago

Does this patch do the job? I was wondering whether it should be assign_terms or edit_terms?

wojtek.szkutnik4 years ago

comment:4 wojtek.szkutnik4 years ago

OK, this one should work.

comment:5 azizur3 years ago

  • Cc azizur added

bpetty22 months ago

comment:6 bpetty22 months ago

  • Cc bpetty added
  • Keywords gsoc removed

Previous patch used the wrong taxonomy (needed to be "link_category"), and also used the wrong capability terms (used edit_terms and assign_terms when it needed to only be manage_terms for adding new link categories).

Also, patches should be built with directory context, not from single files, and since this the old patch didn't apply cleanly anyway, I've refreshed that as well.

comment:7 bpetty22 months ago

Guess I should also note that this bug is only a problem for anyone using custom capability plugins to modify or add new roles that have the manage_links capability, but *not* the manage_categories capability. The default roles are not configured like this.

I installed and used the popular Capability Manager plugin to do this and test with.

bpetty10 months ago

comment:8 bpetty10 months ago

Refreshed patch against latest trunk (r24432).

comment:9 nacin10 months ago

  • Keywords commit added
  • Milestone changed from Future Release to 3.6

SergeyBiryukov10 months ago

comment:10 SergeyBiryukov10 months ago

13972.4.patch also fixes tabs vs. spaces in post_categories_meta_box().

We check for edit_terms there. Should it be manage_terms too?

comment:11 bpetty9 months ago

This might be a little more confusing than I thought. For some reason wp_ajax_add_link_category() is checking for manage_categories as well, but I'm fairly certain that should also be manage_links just like the wp_ajax_delete_link() method uses, and also as determined from the default link_category taxonomy.

I haven't thought through the possible back compat issues that might arise from actually fixing it though, so I'm just not sure on applying this yet.

Maybe punt for now?

comment:12 nacin9 months ago

  • Milestone changed from 3.6 to Future Release

comment:13 nacin3 months ago

  • Component changed from Administration to Posts, Post Types
  • Focuses administration added
Note: See TracTickets for help on using tickets.