• Tony G

    (@starbuck)


    As a site admin I create new status codes, but I don’t see how to make these available to non-admin users who have Author role. There are no ‘capabilities’ defined by the plugin so we cannot give individual roles a cap like ‘ext_status_modify’.

    I would welcome a new capability for every status type, so that we can manage who gets to set each type, and who gets to view posts that have a specific status.

    Specifically: For a new status slug “on_hold”, the following capabilities can be assigned to different roles to define their access:

    ext_status_view-on_hold : Role may see posts in this status.
    ext_status_edit-on_hold : Along with edit_posts, role can edit posts in this status.
    ext_status_to-on_old : Role may change status to this status.

    When I get time to look at this plugin’s code, I will think about how to add this feature.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Felix W.

    (@welly2103)

    Hi @starbuck

    That’s a pretty cool idea.

    If I understand you correctly, then the selection of all roles per status would be sufficient, right? So that you can additionally define for a role who can use / assign the status, who can see posts with the status and who can edit the status. However, I would keep the editing of statuses general, i.e. a general capability to edit statuses.

    I’ll think about it, if you come up with something better, please let me know. I would first implement such a solution in a test branch and try it out.

    Greetings Felix

    Thread Starter Tony G

    (@starbuck)

    Glad to see you jazzed. ?? I think “yes” to everything you’ve said.

    To be clear: A capability is just a unique flag. A role is a collection of specific flags. Any post gets a status that has its related _view_ and _edit_ permissions.
    When any post is requested, hook the related action or filter. For example, load-post.php, wp_before_admin_bar_render, post_row_actions, page_row_actions, manage_posts_columns, manage_posts_custom_column, edit_form_top, etc.
    In those hooks, generate the cap for the status, maybe $cap='ext_status_view-'.get_post_status($post->ID). Then use current_user_can($cap) to see if the user/role has permission to do that function.
    I’d standardize that permission check in a consistent function and then call it from various hooks to determine “can this user view or edit on this post at this time?”

    The ability to view or edit the list of statuses can itself be given a capability ext_status_edit or ext_status_view. If the user has the administrator role and the manage_options permission, then there’s no need to check plugin-specific options. But if the user is not an admin, then these caps can be checked to determine if the menu option is available at all, or if the user has the right to submit a change from the admin page if they can see it. I dunno about you but personally I wouldn’t want anyone but the administrator to modify taxonomy or statuses, so inititally it would be safe to just check manage_options – I haven’t looked but you are probably already doing that. ??

    As to “selection of all roles per status”, sure, it would be nice to see a list of the roles and maybe the users in those roles who have view/edit permissions for a selected status. I can picture a grid with status across the top and role down the left side. In fact this is exactly how some issue tracking systems do this – and some allow for editing the permissions in that grid. For purposes here, it’s seems enough to suggest that admins use a plugin like User Role Editor to view and manage caps for specific roles.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Permissions to see/use extended statuses?’ is closed to new replies.