Changeset 3511 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-capabilities.php
- Timestamp:
- 06/20/2016 05:34:18 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-capabilities.php
r3225 r3511 2 2 namespace WordPressdotorg\Plugin_Directory; 3 3 use WordPressdotorg\Plugin_Directory\Tools; 4 4 5 /** 5 6 * Manages the capabilities for the WordPress.org plugins directory. … … 11 12 /** 12 13 * Filters a user's capabilities depending on specific context and/or privilege. 14 * 15 * @static 13 16 * 14 17 * @param array $required_caps Returns the user's actual capabilities. … … 72 75 } 73 76 77 /** 78 * Sets up custom roles and makes them available. 79 * 80 * @static 81 */ 74 82 public static function add_roles() { 75 83 $committer = array( 76 'read' => true,84 'read' => true, 77 85 'plugin_dashboard_access' => true, 78 'plugin_edit_own' => true,79 'plugin_set_category' => true,80 'plugin_add_committer' => true,81 'plugin_edit_others' => true,86 'plugin_edit_own' => true, 87 'plugin_set_category' => true, 88 'plugin_add_committer' => true, 89 'plugin_edit_others' => true, 82 90 ); 83 91 84 92 $reviewer = array_merge( $committer, array( 85 'moderate_comments' => true,93 'moderate_comments' => true, 86 94 'plugin_edit_pending' => true, 87 'plugin_review' => true,95 'plugin_review' => true, 88 96 ) ); 89 97 90 98 $admin = array_merge( $reviewer, array( 91 'plugin_approve' => true,92 'plugin_reject' => true,93 'plugin_disable' => true,94 'plugin_close' => true,99 'plugin_approve' => true, 100 'plugin_reject' => true, 101 'plugin_disable' => true, 102 'plugin_close' => true, 95 103 'plugin_set_section' => true, // Special categories. 96 'manage_categories' => true, // Let them assign these special categories.104 'manage_categories' => true, // Let them assign these special categories. 97 105 ) ); 98 106 99 107 // Remove the roles first, incase we've changed the permission set. 100 108 remove_role( 'plugin_committer' ); 101 remove_role( 'plugin_reviewer' );102 remove_role( 'plugin_admin' );109 remove_role( 'plugin_reviewer' ); 110 remove_role( 'plugin_admin' ); 103 111 add_role( 'plugin_committer', 'Plugin Committer', $committer ); 104 add_role( 'plugin_reviewer', 'Plugin Reviewer', $reviewer );105 add_role( 'plugin_admin', 'Plugin Admin', $admin );112 add_role( 'plugin_reviewer', 'Plugin Reviewer', $reviewer ); 113 add_role( 'plugin_admin', 'Plugin Admin', $admin ); 106 114 107 foreach ( array( 'contributor', 'author', 'editor', 'administrator' ) as $role ) {115 foreach ( array( 'contributor', 'author', 'editor', 'administrator' ) as $role ) { 108 116 $wp_role = get_role( $role ); 109 117
Note: See TracChangeset
for help on using the changeset viewer.